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.
This commit is contained in:
2024-12-02 22:52:41 +07:00
parent c94f47f28c
commit 7021aa7f20
2 changed files with 71 additions and 59 deletions

129
README.md
View File

@@ -1,85 +1,98 @@
<p align="center">
<a href="http://nestjs.com/" target="blank"><img src="https://nestjs.com/img/logo-small.svg" width="120" alt="Nest Logo" /></a>
</p>
# 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
<p align="center">A progressive <a href="http://nodejs.org" target="_blank">Node.js</a> framework for building efficient and scalable server-side applications.</p>
<p align="center">
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/v/@nestjs/core.svg" alt="NPM Version" /></a>
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/l/@nestjs/core.svg" alt="Package License" /></a>
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/dm/@nestjs/common.svg" alt="NPM Downloads" /></a>
<a href="https://circleci.com/gh/nestjs/nest" target="_blank"><img src="https://img.shields.io/circleci/build/github/nestjs/nest/master" alt="CircleCI" /></a>
<a href="https://coveralls.io/github/nestjs/nest?branch=master" target="_blank"><img src="https://coveralls.io/repos/github/nestjs/nest/badge.svg?branch=master#9" alt="Coverage" /></a>
<a href="https://discord.gg/G7Qnnhy" target="_blank"><img src="https://img.shields.io/badge/discord-online-brightgreen.svg" alt="Discord"/></a>
<a href="https://opencollective.com/nest#backer" target="_blank"><img src="https://opencollective.com/nest/backers/badge.svg" alt="Backers on Open Collective" /></a>
<a href="https://opencollective.com/nest#sponsor" target="_blank"><img src="https://opencollective.com/nest/sponsors/badge.svg" alt="Sponsors on Open Collective" /></a>
<a href="https://paypal.me/kamilmysliwiec" target="_blank"><img src="https://img.shields.io/badge/Donate-PayPal-ff3f59.svg" alt="Donate us"/></a>
<a href="https://opencollective.com/nest#sponsor" target="_blank"><img src="https://img.shields.io/badge/Support%20us-Open%20Collective-41B883.svg" alt="Support us"></a>
<a href="https://twitter.com/nestframework" target="_blank"><img src="https://img.shields.io/twitter/follow/nestframework.svg?style=social&label=Follow" alt="Follow us on Twitter"></a>
</p>
<!--[![Backers on Open Collective](https://opencollective.com/nest/backers/badge.svg)](https://opencollective.com/nest#backer)
[![Sponsors on Open Collective](https://opencollective.com/nest/sponsors/badge.svg)](https://opencollective.com/nest#sponsor)-->
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.

View File

@@ -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
}