Git Product home page Git Product logo

invite's Introduction

Process Invitations in the BZ database

On Docker Hub for local development

Build Status

Different environments

This is codified over at: https://github.com/unee-t/env

dev environment

demo environment

prod environment

Test plan

/health_check for a sanity check with the database connection

invite's People

Contributors

franck-boullier avatar kaihendry avatar

Watchers

 avatar  avatar  avatar

Forkers

unee-t-ins

invite's Issues

processed_datetime contains an id of a failed operation

In the function checkProcessedDatetime, we check if a invite has been processed already with SELECT processed_datetime FROM ut_invitation_api_data WHERE mefe_invitation_id=?

We've come to notice, that this table can contain ids, when in fact the operation failed.

 Oct 19th 11:05:24am INFO production 5b8ec68 Running 1_process_one_invitation_all_scenario_v3.0.sql with invite id N8ANmdnuyNxiiWTWw with env 1
  Oct 19th 11:05:26am ERRO production 5b8ec68 running sql failed: error=Error 1452: Cannot add or update a child row: a foreign key constraint fails (`bugzilla
`.`bugs_activity`, CONSTRAINT `fk_bugs_activity_bug_id_bugs_bug_id` FOREIGN KEY (`bug_id`) REFERENCES `bugs` (`bug_id`) ON DELETE CASCADE ON UPDATE CASCADE)
  Oct 19th 11:05:26am ERRO production 5b8ec68 failed to run 1_process_one_invitation_all_scenario_v3.0.sql: error=Error 1452: Cannot add or update a child row:
 a foreign key constraint fails (`bugzilla`.`bugs_activity`, CONSTRAINT `fk_bugs_activity_bug_id_bugs_bug_id` FOREIGN KEY (`bug_id`) REFERENCES `bugs` (`bug_id
`) ON DELETE CASCADE ON UPDATE CASCADE) invite=map[type:type_assigned unitId:643 _id:N8ANmdnuyNxiiWTWw caseId:0 invitedBy:995 invitee:996 isOccupant:false role
:Contractor]
  Oct 19th 11:05:26am ERRO production 5b8ec68 response: duration=2.043s id=d289bce2-d34b-11e8-b426-d16c95d0b2f1 ip=54.255.152.207 method=GET path=/ size=285 B
status=500

Move Lambda to VPC

Currently our database is publicly accessible (by IP) since Lambda's sourced connection cannot be assigned to a security group.

Furthermore the lambdas (internal) endpoints (via API gateway) are public, since there is no easy way to protect them.

IIUC we need Apex up to support VPC to unblock us here.

demo env not deploying

As we can see in https://travis-ci.org/unee-t/invite/builds/481250871 as well as:

[hendry@t480s invite]$ make demo

apex -r ap-southeast-1 --env demo deploy
   • updating config           env=demo function=invite
   ⨯ Error: function invite: InvalidParameterValueException: The provided execution role does not have permissions to call CreateNetworkInterface on EC2
        status code: 400, request id: ae642f67-1afd-11e9-ab3b-dfcebef64325
make: *** [Makefile:13: demo] Error 1

Show up version

Not just cater for goreleaser:

[hendry@t480s db]$ curl -H "Authorization: Bearer SECRET" https://invite.dev.unee-t.com/version
dev, commit none, built at unknown

Use universal/language agnostic string instead of specific english values.

The problem:

The API uses the string version of the roles (see

invite/invite.go

Lines 162 to 165 in 783aac4

func (h handler) lookupRoleID(roleName string) (IDRoleType int, err error) {
err = h.DB.QueryRow("SELECT id_role_type FROM ut_role_types WHERE role_type=?", roleName).Scan(&IDRoleType)
return IDRoleType, err
}
).

Consequence of that issue:

  • When we want to edit the designation of the roles, we need to make sure that the table ut_role_types uses the new values for the roles.
  • This will make it more complex to localize the application (have different languages).

Unable to create new users with the MEFE API

What I need to do:

  • In the PROD environment
  • Create a new user with the Unee-T Enterprise interface.

The payload:

CALL mysql.lambda_asyncarn:aws:lambda:ap-southeast-1:192458993663:function:alambda_simple{"lastName": "DO Ramasamy", "creatorId": "[sanitized]", "firstName": "Vani", "actionType": "CREATE_USER", "phoneNumber": "", "emailAddress": "[sanitized]@[santized].com", "mefeAPIRequestId": "de6bf82b-966b-11e9-b124-02012a2c6c9a", "userCreationRequestId": 883}

Expected result:

  • user is created in Mongo - PASSED
  • User is created in BZ - PASSED
  • Unee-T Enterprise database is updated - FAILED

The problem:

The Unee-T enterprise database is NOT updated as it should after the user is created.

Need a script to invite a user in a given role for a given unit

After we create a unit, we need to be able to invite users to the existing roles for this unit:

  • Tenant,
  • Landlord
  • Contractor
  • Management Company
  • Agent

We need to have a dedicated script for that.
This script will call many (but not all) of the same:

  • procedures
  • variables
    that we use for the script to invite a user to case.

Make sure we use a dedicate DB user with limited privileges

In order to improve security we need to make sure that the lambda function which performs the insert is run by a db user with limited privileges.
Ideally this user should only be able to insert data in the table 'ut_invitation_api_data' and nothing else.

Update docker / goreleaser image

     • DEPRECATED: `docker.image` should not be used anymore, check https://goreleaser.com/deprecations#docker-image for more info.
     • DEPRECATED: `docker.tag_templates` should not be used anymore, check https://goreleaser.com/deprecations#docker-tag-templates for more info.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.