@basaldev/blocks-organization-service
v3.0.7
Published
Service for managing organization and its hierarchy and members.
Downloads
205
Keywords
Readme
blocks-organization-service
Overview
Contains code to handle business logic of organizations that containn groups of users. Includes but not limited to the following functions:
- create/update/delete organizations
- adding and managing users to organizations
- managing the roles of users on organizations
- upload attachments and images to organizations
- creating and approving change requests to data on an organization
🏗 Project Structure
.
├── .github
├── .husky # husky settings - @basaldev/lint-staged-config
├── .vscode # vscode settings
├── .yarn # yarn binary, config and project dependencies
├── coverage * # jest coverage report
├── dist *
├── docs
│ ├── assets # documentation related assets
│ └── reference # api docs
├── src
│ ├── adapter
│ ├── test
│ └── index.ts
├── .eslintignore
├── .eslintrc.js # @basaldev/eslint-config
├── .gitignore
├── .nvmrc
├── .pnp.cjs # yarn config
├── .pnp.loader.mjs # yarn config
├── .prettierignore
├── .prettierrc.json # @basaldev/prettier-config
├── .yarnrc.yml # yarn config
├── cspell.config.js # @basaldev/cspell-config
├── .yarnrc.yml # yarn config
├── jest.config.js # @basaldev/jest-preset
├── package.json
├── README.md
├── tsconfig.json # @basaldev/tsconfig
└── yarn.lock
* Not tracked by git🔰 Setup
Get NPMJS private token for nodeblocks
- Please contact @basal-gen or @basal-luke for getting the token
- Add to your local environment -
.zshrc.bashrcetc
export NODEBLOCKS_DEV_TOKEN=__INSERT_YOUR_TOKEN_HERE__Install NVM
Install Yarn (Global)
Yarn must be installed globally for the project's NodeJS version. This should be done so using the command below.
nvm use && npm install -g yarnInstall Husky 🐺
yarn husky install⚠️ IMPORTANT: Only use the yarn command install or run scripts. Do not use npm run xxx
🪄 Usage
Run typescript compiler
yarn startRun debug server on default port: 9339.
- Requires
yarn startto be running in a separate session - Port should be updated to avoid conflicts with other projects
package.json > scripts > debug
yarn debugRun unit tests
docker compose up
yarn testInstalling packages
yarn add <package> | yarn add <package> -D⚡️ Special Notes for VSCode Users
📐 Required Extensions
Please ensure the following extensions are installed:
- arcanis.vscode-zipfs
- dbaeumer.vscode-eslint
- seatonjiang.gitmoji-vscode
- henrynguyen5-vsc.vsc-nvm (optional)
🛠 Workspaces
The kit uses vscode workspaces for vscode project settings:
- All common vscode project settings should be specified in the
.vscode/${project_name}-workspacefile. - Personal user settings should be added to
.vscode/settings.json(gitignored) - ⚠️ You must open this project as a workspace in vscode This can be done by clicking the workspace file while in vscode, or by using
File > Open workspace from file.
🪛 TypeScript
When prompted asking which typescript VSCode should use, it's very important that you choose the local project version located at .yarn/sdks/typescript/...
💅 Prettier
If you have the prettier extension installed, please disable it for this project. ts-kit uses eslint to execute prettier, so having prettier enabled in vscode will cause conflicts and strange behavior.
🤖 Format on Save (optional)
Add the following code to your .vscode/settings.json will automatically fix all eslint errors whenever you save a file.
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
}🏎️ Performance Tests
Start database
docker-compose upSpin up the services
yarn spin-upYou can validate the spin up by checking the following endpoint from browser
http://localhost:3000/ping
http://localhost:3001/ping
http://localhost:3002/pingPopulate data:
yarn perf-populateAfter data populated, run jmeter file, and you can watch the result of performance test.
Run jmeter:
- Firstly install jmeter https://jmeter.apache.org/
- install jmeter plugins manager https://jmeter-plugins.org/wiki/PluginsManager/
- install plugin https://jmeter-plugins.org/wiki/Functions/
Then run the following command in the root of project:
jmeter -n -t src/test/perf/load_test.jmx -l src/test/perf/results/performance-result.jltDocument
Document yaml file is created via stoplight studio, and use ReDoc to create the html. To regenerate html, you need install redoc cli, and
redoc-cli build specs/reference/organization-service-api.yaml --output specs/index.html🚀 Package Deployment
This library uses github registry to publish private npm package. For detailed instructions see here
💡 Note: that npm is used for version & publish commands
1. Bump version
npm version ${VERSION}2. Build Package
yarn build3. Publish Package
npm publishThen go to github https://github.com/basaldev/backend-sdk/packages to check published packages.
