0.0.1 • Published 4 years ago

connect-transactions-api v0.0.1

Weekly downloads
-
License
ISC
Repository
bitbucket
Last release
4 years ago

connect-transactions-api

Documentation still WIP.

Description

This microservice is for transaction related features/functionalities

TODO

[] utilitize sequelize-paginate (https://www.npmjs.com/package/sequelize-paginate) for transaction list (TO BE DISCUSSED) [] use req.user to get user details (instead of kauth object)

Prerequisites

  • Migration file
  • SQL Database Access
  • Unit and integration tests
  • Keycloak server for authorization

Environment Variables

NODE_ENV=develop
LOG_LEVEL=info
API_LOGGER=true

PORT=3000

DB_CONNECTION_STRING=mysql://<username>:<password>@<connection_ip>:<port>/<default_db>
CONNECT_URLS='{"programs": "https://develop.connect.mcltech.dev/programs"}'
CONNECT_TOPICS='{"emailMessage": "email_message_develop", "handleEmailMessage": "handle_email_message_develop", "handleMessageQueue": "handle_message_queue_develop", "handleSmsMessage": "handle_sms_message_develop", "smsMessage": "sms_message_develop", "nexmoReply": "nexmo_reply_develop", "generateRefillMessage": "generate_refill_message_develop", "generateAppointmentMessage": "generate_appointment_message_develop", "generateFreeGoodReminderMessage": "generate_free_good_reminder_message_develop", "generateHealthMessage": "generate_health_message_develop"}'
GOOGLE_APPLICATION_CREDENTIALS=<your google service-account.json path>
GOOGLE_APPLICATION_PROJECT=mclinica-dev

NOTE: GOOGLE_APPLICATION_CREDENTIALS is only used in local development if an UnhandledPromiseRejectionWarning: Error: Resource not found error is encountered.

Installation (How to run)

  1. Copy keycloak.json file to root of this project
  2. Run nodemon

Helm Prerequisites

Before running helm install on this chart you need to:

  1. Have an accessible ConfigMap named keycloak-config with the contents of keycloak.json

Other notes


NOTE: if you encounter "certificate has expired, include this in your env variable NODE_TLS_REJECT_UNAUTHORIZED = '0';

Keycloak Session Data Sample

{
  jti: 'f2769ee7-8a92-4498-856a-a4c84d89c75e',
  exp: 1567956464,
  nbf: 0,
  iat: 1567956164,
  iss: 'https://keycloak.mcltech.dev/auth/realms/connect-develop',
  aud: 'account',
  sub: '4fdaa74d-9913-4813-a4cc-c902a036a947',
  typ: 'Bearer',
  azp: 'public',
  auth_time: 0,
  session_state: '951a07d5-1b42-4106-8e7e-fb7c772500a6',
  acr: '1',
  'allowed-origins': [ '*' ],
  realm_access:
    { roles: [ 'offline_access', 'uma_authorization', 'app-user' ] },
  resource_access: { public: { roles: [Array] }, account: { roles: [Array] } },
  scope: 'email profile',
  email_verified: false,
  name: 'Justin Sanciangco',
  preferred_username: 'justin@thinkingpandas.com',
  given_name: 'Justin',
  family_name: 'Sanciangco',
  email: 'justin@thinkingpandas.com'
}

Windows Users

You need to run these commands after checking out the project

git config core.autocrlf false
git rm --cached -r .
git reset --hard