0
ecosense-functions

ecosense-functions

A set of Firebase Cloud Functions used for automated role-based authentication and data update to database.

About

EcoSense Firebase Functions is a repository for codes run in Cloud Functions to enable role-based authentication and synchronize data to Cloud SQL.

Technologies

JavaScript TypeScript Firebase PostgreSQL NodeJS ESLint

Dependencies

Production

@google-cloud/secret-manager firebase-admin firebase-functions pg

Development

eslint firebase-functions-test typescript

Go to List of Dependencies

Functions

  • addAdminRole
    • Trigger: HTTP Request
  • addSuperAdminRole
    • Trigger: HTTP Request
  • addUserRole
    • Trigger: HTTP Request
  • removeAdminRole
    • Trigger: HTTP Request
  • removeSuperAdminRole
    • Trigger: HTTP Request
  • newUserSignUp
    • Trigger: user.create
  • onUpdateUserDetail
    • Trigger: HTTP Request
  • insertUserDataToDB
    • Trigger: HTTP Request
  • userDeleted
    • Trigger: user.delete

Deploy to Firebase Functions

  1. Make sure you have firebase-tools installed by running npm install -g firebase-tools in terminal.
  2. Go to /functions folder by typing cd functions in terminal.
  3. Run npm run deploy or run firebase deploy --only functions.
  4. Wait until Firebase finish deploying.

Run Locally using Firebase Emulator

  1. Make sure you have firebase-tools installed by running npm install -g firebase-tools in terminal.
  2. Go to /functions folder by typing cd functions in terminal.
  3. Run npm run serve or run firebase emulators:start --only functions.
  4. Call the functions to test them out.

2023 © EcoSense Indonesia.