diff --git a/backend/design/README.md b/backend/design/README.md index 65235cb7..e422ed36 100644 --- a/backend/design/README.md +++ b/backend/design/README.md @@ -2,8 +2,8 @@ ## Contents -- [Architecture](./architecture.md): The architecture of CodePair's NestJS backend -- [Yorkie Auth Webhook](./auth-webhook.md): Auth Webhook to prevent users from accessing unauthorized documents using a Public Key +- [Architecture](./architecture.md): The architecture of CodePair's NestJS backend +- [Yorkie Auth Webhook](./auth-webhook.md): Auth Webhook to prevent users from accessing unauthorized documents using a Public Key ## Maintaining the Document @@ -11,8 +11,8 @@ For significant scope and complex new features, it is recommended to write a Des Writing a design document for big features has many advantages: -- It helps new visitors or contributors understand the inner workings or the architecture of the project. -- We can agree with the community before code is written that could waste effort in the wrong direction. +- It helps new visitors or contributors understand the inner workings or the architecture of the project. +- We can agree with the community before code is written that could waste effort in the wrong direction. While working on your design, writing code to prototype your functionality may be useful to refine your approach. diff --git a/backend/design/architecture.md b/backend/design/architecture.md index 778d85ec..90feef31 100644 --- a/backend/design/architecture.md +++ b/backend/design/architecture.md @@ -19,11 +19,11 @@ If you want to add a new component, you can use the command `nest generate contr ``` -- Pipe: Handles data transformation/validation in the request/response pipeline. -- Guard: Implements access control and validation logic for routes. -- Controller: Defines the endpoints/routes and their corresponding request handling logic. -- Service: Contains the business logic and performs operations required by the application. -- Repository: Handles data persistence and retrieval operations from the data source. +- Pipe: Handles data transformation/validation in the request/response pipeline. +- Guard: Implements access control and validation logic for routes. +- Controller: Defines the endpoints/routes and their corresponding request handling logic. +- Service: Contains the business logic and performs operations required by the application. +- Repository: Handles data persistence and retrieval operations from the data source. Note that the naming for the Repository Layer is `PrismaService`. diff --git a/backend/design/auth-webhook.md b/backend/design/auth-webhook.md index 3aed51ef..8fe17739 100644 --- a/backend/design/auth-webhook.md +++ b/backend/design/auth-webhook.md @@ -6,7 +6,7 @@ This document covers the structure of the Auth Webhook to prevent users from acc A webhook is an HTTP POST that is called when something happens. If the Auth Webhook has been configured, when a Server receives a request from a Client, the Server checks if the Client has been authorized for a certain Document by asking an outside service with a REST request. -- [Yorkie Auth Webhook](https://yorkie.dev/docs/cli#auth-webhook) +- [Yorkie Auth Webhook](https://yorkie.dev/docs/cli#auth-webhook) In a production environment, it is strongly recommended to enable the Auth Webhook. @@ -27,6 +27,7 @@ In a production environment, it is strongly recommended to enable the Auth Webho - dockey - verb: r or rw ``` + **Webhook URL**: `/check/yorkie` **Token Format**: `share:` or `default:` @@ -35,4 +36,4 @@ In a production environment, it is strongly recommended to enable the Auth Webho The code related to AuthWebhook is already implemented in [`useYorkieDocument`](../../frontend/src/hooks/useYorkieDocument.ts) and [`check.controller.ts`](../src/check/check.controller.ts). Simply visit the Yorkie Project Dashboard and add `/check/yorkie` to the Settings > Webhook > Auth webhook URL. -Note that if `YOUR_BACKEND_URL` is `http://localhost` and Yorkie is not running on `http://localhost`, this will not work. \ No newline at end of file +Note that if `YOUR_BACKEND_URL` is `http://localhost` and Yorkie is not running on `http://localhost`, this will not work. diff --git a/backend/nest-cli.json b/backend/nest-cli.json index f9aa683b..95538fb9 100644 --- a/backend/nest-cli.json +++ b/backend/nest-cli.json @@ -1,8 +1,8 @@ { - "$schema": "https://json.schemastore.org/nest-cli", - "collection": "@nestjs/schematics", - "sourceRoot": "src", - "compilerOptions": { - "deleteOutDir": true - } + "$schema": "https://json.schemastore.org/nest-cli", + "collection": "@nestjs/schematics", + "sourceRoot": "src", + "compilerOptions": { + "deleteOutDir": true + } } diff --git a/backend/package.json b/backend/package.json index d626e9c7..ad41e4d7 100644 --- a/backend/package.json +++ b/backend/package.json @@ -2,6 +2,7 @@ "name": "@codepair/backend", "version": "0.1.14", "description": "CodePair Backend", + "type": "module", "author": "yorkie-team", "license": "Apache-2.0", "scripts": { @@ -17,8 +18,8 @@ "test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand", "test:e2e": "jest --config ./test/jest-e2e.json", "lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix", - "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"", - "format:check": "prettier --check \"src/**/*.ts\" \"test/**/*.ts\"" + "format": "prettier . --write", + "format:check": "prettier . --check" }, "lint-staged": { "*.{ts,tsx}": [ @@ -93,4 +94,4 @@ "src/(.*)": "/src/$1" } } -} \ No newline at end of file +} diff --git a/backend/test/jest-e2e.json b/backend/test/jest-e2e.json index e9d912f3..f43e8a69 100644 --- a/backend/test/jest-e2e.json +++ b/backend/test/jest-e2e.json @@ -1,9 +1,9 @@ { - "moduleFileExtensions": ["js", "json", "ts"], - "rootDir": ".", - "testEnvironment": "node", - "testRegex": ".e2e-spec.ts$", - "transform": { - "^.+\\.(t|j)s$": "ts-jest" - } + "moduleFileExtensions": ["js", "json", "ts"], + "rootDir": ".", + "testEnvironment": "node", + "testRegex": ".e2e-spec.ts$", + "transform": { + "^.+\\.(t|j)s$": "ts-jest" + } } diff --git a/backend/tsconfig.build.json b/backend/tsconfig.build.json index 64f86c6b..4491981e 100644 --- a/backend/tsconfig.build.json +++ b/backend/tsconfig.build.json @@ -1,4 +1,4 @@ { - "extends": "./tsconfig.json", - "exclude": ["node_modules", "test", "dist", "**/*spec.ts"] + "extends": "./tsconfig.json", + "exclude": ["node_modules", "test", "dist", "**/*spec.ts"] } diff --git a/backend/tsconfig.json b/backend/tsconfig.json index 8a022302..8f5aedf3 100644 --- a/backend/tsconfig.json +++ b/backend/tsconfig.json @@ -16,6 +16,6 @@ "noImplicitAny": false, "strictBindCallApply": false, "forceConsistentCasingInFileNames": false, - "noFallthroughCasesInSwitch": false, - }, + "noFallthroughCasesInSwitch": false + } }