From 7021aa7f20b2cc967e57fa529928c03b6f488888 Mon Sep 17 00:00:00 2001 From: Ly Tuan Kiet Date: Mon, 2 Dec 2024 22:52:41 +0700 Subject: [PATCH] refactor: update README and document schema for improved clarity and functionality - Revised README.md to provide a clearer project overview, installation instructions, and service descriptions, enhancing onboarding for new developers. - Removed unnecessary comments in document.schema.ts to streamline the code and improve readability. - Updated the LiveKit service descriptions in the README to reflect the integration of new functionalities and services. --- README.md | 129 ++++++++++++++++++-------------- src/Document/document.schema.ts | 1 - 2 files changed, 71 insertions(+), 59 deletions(-) diff --git a/README.md b/README.md index c997880..cf20570 100644 --- a/README.md +++ b/README.md @@ -1,85 +1,98 @@ -

- Nest Logo -

+# Project Name -[circleci-image]: https://img.shields.io/circleci/build/github/nestjs/nest/master?token=abc123def456 -[circleci-url]: https://circleci.com/gh/nestjs/nest +## Overview -

A progressive Node.js framework for building efficient and scalable server-side applications.

-

-NPM Version -Package License -NPM Downloads -CircleCI -Coverage -Discord -Backers on Open Collective -Sponsors on Open Collective - Donate us - Support us - Follow us on Twitter -

- +This project is built using NestJS and LiveKit server SDK to manage video collaboration sessions, scheduling, and user services. It utilizes Prisma as an ORM for database interactions. -## Description +## Getting Started -[Nest](https://github.com/nestjs/nest) framework TypeScript starter repository. +### Prerequisites -## Project setup +- Node.js installed on your machine. +- A PostgreSQL database or another SQL database supported by Prisma. +- Environment variables for LiveKit and database credentials set up correctly. + +### Installation + +1. **Clone the repository:** + + ```bash + git clone https://github.com/EPESS/epess-web-backend.git + cd epess-server + ``` + +2. **Install the dependencies:** + + ```bash + npm install + ``` + +3. **Create the `.env` file:** + + Create a file named `.env` at the root of the project and set the following environment variables: + + ``` + LIVEKIT_API_KEY=your_livekit_api_key + LIVEKIT_API_SECRET=your_livekit_api_secret + DATABASE_URL=your_database_url + ``` + +4. **Run database migrations:** + + Ensure your database is set up, and use Prisma to run migrations. + + ```bash + npx prisma migrate dev + ``` + +### Running the Application + +To start the application: ```bash -$ npm install +npm run start:dev ``` -## Compile and run the project +This command will start the application in development mode with live reload enabled. -```bash -# development -$ npm run start +## Services Description -# watch mode -$ npm run start:dev +### LiveKit Participant Service -# production mode -$ npm run start:prod +This service handles operations related to participants in a LiveKit room. It utilizes the `RoomServiceClient` from the `livekit-server-sdk`. + +Reference: + +```typescript:src/LiveKit/livekit.participant.service.ts +startLine: 1 +endLine: 8 ``` -## Run tests +### LiveKit Service -```bash -# unit tests -$ npm run test +Responsible for generating access tokens for users to join LiveKit rooms. It utilizes API keys and secrets for authorization. -# e2e tests -$ npm run test:e2e +Reference: -# test coverage -$ npm run test:cov +```typescript:src/LiveKit/livekit.service.ts +startLine: 1 +endLine: 26 ``` -## Resources +### Other Services -Check out a few resources that may come in handy when working with NestJS: +The project includes additional service files for room management (`livekit.room.service.ts`) and integration with other modules like notifications and payment handling. -- Visit the [NestJS Documentation](https://docs.nestjs.com) to learn more about the framework. -- For questions and support, please visit our [Discord channel](https://discord.gg/G7Qnnhy). -- To dive deeper and get more hands-on experience, check out our official video [courses](https://courses.nestjs.com/). -- Visualize your application graph and interact with the NestJS application in real-time using [NestJS Devtools](https://devtools.nestjs.com). -- Need help with your project (part-time to full-time)? Check out our official [enterprise support](https://enterprise.nestjs.com). -- To stay in the loop and get updates, follow us on [X](https://x.com/nestframework) and [LinkedIn](https://linkedin.com/company/nestjs). -- Looking for a job, or have a job to offer? Check out our official [Jobs board](https://jobs.nestjs.com). +## Additional Notes -## Support +- Ensure that the Prisma service is properly configured and running. +- Always make sure to keep your environment variables secure. +- To seed the database with initial data, refer to `epess-database/prisma/seed.js`. -Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please [read more here](https://docs.nestjs.com/support). +## Contributing -## Stay in touch - -- Author - [Kamil Myƛliwiec](https://twitter.com/kammysliwiec) -- Website - [https://nestjs.com](https://nestjs.com/) -- Twitter - [@nestframework](https://twitter.com/nestframework) +Please feel free to contribute by opening issues or pull requests. ## License -Nest is [MIT licensed](https://github.com/nestjs/nest/blob/master/LICENSE). +This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. diff --git a/src/Document/document.schema.ts b/src/Document/document.schema.ts index 7a20655..fb65f08 100644 --- a/src/Document/document.schema.ts +++ b/src/Document/document.schema.ts @@ -400,7 +400,6 @@ export class DocumentSchema extends PothosSchema { const random = Math.random() // 0.5% chance to request sync if (random <= 0.005) { - // set requestSync to true payload.requestSync = true return payload }