Merge branch 'broker' into 'main'

update readme

See merge request mobicoop/lab/v3/services/user!6
This commit is contained in:
Gsk54 2022-12-22 13:43:19 +00:00
commit 4667e57f0c
1 changed files with 18 additions and 4 deletions

View File

@ -2,10 +2,14 @@
User-related data management.
## Installation
## Requirements
You need [Docker](https://docs.docker.com/engine/) and [Docker-compose](https://docs.docker.com/compose/).
A RabbitMQ instance is also required to send messages when data has been inserted/updated/deleted.
## Installation
Copy `.env.dist` to `.env` :
```bash
@ -33,7 +37,7 @@ sudo chown -R 5050:5050 postgresql/.pgadmin_data
Before using the app, you need to launch the database migration :
```bash
docker exec v3_user sh -c "npx prisma migrate dev"
docker exec v3-user sh -c "npx prisma migrate dev"
```
## Usage
@ -85,14 +89,24 @@ The app exposes the following [gRPC](https://grpc.io/) services :
}
```
## Messages
A mentionned earlier, RabbitMQ messages are sent after these events :
- **Create** (message : the created user informations)
- **Update** (message : the updated user informations)
- **Delete** (message : the uuid of the deleted user)
## Test
```bash
# unit tests
docker exec v3_user sh -c "npm run test"
docker exec v3-user sh -c "npm run test"
# test coverage
docker exec v3_user sh -c "npm run test:cov"
docker exec v3-user sh -c "npm run test:cov"
```
Note : you can run all npm commands directly _outside_ the container (see _scripts_ section of `package.json` for available commands), but you need NodeJS installed locally. We **strongly** advise to install [Node Version Manager](https://github.com/nvm-sh/nvm) and use the latest LTS version of Node.