mlkpsymph-root v5.0.5
ML KP
Prerequisites
- Source Code Editor
- VS Code (Recommended)
- Node v14.19.3
- Node Version Manager
- Database Tool
Setup
Clone the repository
HTTPS
git clone https://github.com/symphco/mlkpsymph.gitSSH
git clone git@github.com:symphco/mlkpsymph.gitIn root of application, setup everything with one command (make sure you are using node version 14.19.3).
npm installThis installs 3 node_modules. In the root, code, and frontend.
Make sure Husky is working properly
After npm install, there should not be any errors about husky.
Check if husky is installed,
- cd to root
nano .git/hooks/pre-commit
There should be codes in there mentioning words like husky
Git is outdated?
- Download https://sourceforge.net/projects/git-osx-installer/
- check version
git —version, must be >= 2.13
Finally,
npm uninstall huskynpm install husky- Do the “Check if husky is installed” above again
Running locally
For Mac: In root of application, run everything with one command. This will open 2 Terminal windows in OSX.
npm run devFor Windows / Linux:
In root of application, enter cd code in the terminal. Run the backend by entering the following command:
npm run devOpen another terminal window, in root of application, enter cd frontend in the terminal. Run the frontend by entering the following command:
npm run startFirst Login Via Google
Ask anyone from the ML team to create an account for you so you can login.
Building
In root of application, build everything with one command.
npm run buildTesting
In root of application, test everything with one command.
npm run testRunning e2e
Install and add ChromeDriver to your path first: https://chromedriver.chromium.org/home
In root of application, run e2e.
npm install
npm run test:e2eBuilding Releases
git rebase origin/masterCreate tag
when creating a new tag make sure to use an annotated tag by passing -a parameter and add a tag message -m
and always sign tags using -s
List all tags
git tagCreate an annotated tag
git tag -a <the_tag> -m "<message>" (e.g. git tag -a v6.0.8 -m "This is the build")With these we can see why we tagged that specific version and see who is the tagger is by using
git show <tag>Push tag
git push --tags --no-verifyCheck build history in Google Cloud Consle
https://console.cloud.google.com/cloud-build/builds?project=mlkpsymphConfirm build's commit hash is equal to the latest merge commit in repo
Refer to
https://www.notion.so/Releasing-Build-to-ML-Docker-fc7130242ead48bc80414381a2b75669#97198693808445d185ba7d8b98669514How to use the DB Service
import DbService from 'services/db/DbService';
const dbService = new DbService();
const result = await dbService.query('select 1 + 1 as solution');Features
- Billspay
- KYC
- Money Transfer
- Partner Money Transfer
- Express
- Wallet
- Core
- Reports
- Admin
- Dashboard
- Head Office
References
Conventions
- Folders must be lowercase
- Files and class names must be TitleCase
- Controllers must have
Controllersuffix and object must be plural e.g.UsersController - Interfaces must have
Interfacesuffix and object must be singular e.g.UserInterface - Route path resources must be plural e.g.:
/usersfor all users/users/1for specific user/users/1/postsfor specific user's posts
- Follow standard REST API convention on methods:
- GET - for retrieval
- POST - for creation
- PUT - for updates
- DELETE - for deletion
- For actions that don't fit in basic CRUD operations, the format of the path should be
resource/id/verb. Resource should be plural, verb singular. Examples:/messages/{id}/send/messages/{id}/redirect/messages/{id}/redirect-to-message/messages/{id}/forward
- Services must have
Servicesuffix and object must be singular e.g.UserService - Test classes must have
Testsuffix and object must be singular e.g.UserServiceTest - JSON API response structure look here
- Use
sendApiResponse()fromCustomResponseclass, e.g.:(req: Request, res: CustomResponse, next: NextFunction) => { res.status(201); res.code = status.SUCCESS; res.sendApiResponse({ data: data, }); }; - Response data must be in camelCase
- Use
- Reusable frontend components must be placed in
/src/componentsfolder - Components specific to an app must be placed in
/src/apps/<app>/componentsfolder - Global styling with regards to bootstrap may be changed via specifying the bootstrap variable in the
_variables.scssfile. Refer to bootstrap repository in github for possible variables. - Styling unique to a component shoul be in the
/src/assets/utilsfolder with the use of styled-components. - Redux actions and reducers per app should be placed in the
functionscomponent of each app.
💻 Contributing
- Create a branch off of
masterfeature/branch-name- For code that adds features. May include tests.fix/branch-name- For code that fixes a broken feature.fixtest/branch-name- For code that fixes a broken test.misc/branch-name- For code clean up and refactoring changes that don't fix bugs or add new features.test/branch-name- For code that only adds tests.adjustment/branch-name- For code that changes an existing working feature.
- Do your stuff
Make commits according to its purpose. For example, if you are building a new feature, don't do code cleanup. Do code cleanup in a separate commit (or better separate branch)
Commit message template:
[Feature][Albert] Add user login. Commit types are:- Feature
- Fix
- Fix Test
- Misc
- Test
- Adjustment
- Hotfix
- Push to Bitbucket often. Rebase often. Pushing and rebasing often reduces the chance of conflicts and being out of sync. Try to do this a few times a day.
- When ready, create a Pull Request from your branch to
masterbranch. Tag the reviewers to review your PR. Mention the reviewers in Discord along with a link to your PR. Also, follow the guidelines for Code Review - Respond or address reviewers' feedback to your PR. Be receptive to feedback, keep an open mind, and always assume positive intent. ❤️
- Merge when approved 🎉
3 years ago