Skip to content

Commit

Permalink
Fix tab indentation and format script
Browse files Browse the repository at this point in the history
  • Loading branch information
choidabom committed Oct 1, 2024
1 parent ccc87b8 commit 705d825
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 31 deletions.
8 changes: 4 additions & 4 deletions backend/design/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@

## 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

For significant scope and complex new features, it is recommended to write a Design Document before starting any implementation work. On the other hand, we don't need to design documentation for small, simple features and bug fixes.

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.

Expand Down
10 changes: 5 additions & 5 deletions backend/design/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.

Expand Down
5 changes: 3 additions & 2 deletions backend/design/auth-webhook.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand All @@ -27,6 +27,7 @@ In a production environment, it is strongly recommended to enable the Auth Webho
- dockey
- verb: r or rw
```

**Webhook URL**: `<BACKEND_URL>/check/yorkie`
**Token Format**: `share:<SHARE_TOKEN>` or `default:<ACCESS_TOKEN>`

Expand All @@ -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 `<YOUR_BACKEND_URL>/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.
Note that if `YOUR_BACKEND_URL` is `http://localhost` and Yorkie is not running on `http://localhost`, this will not work.
12 changes: 6 additions & 6 deletions backend/nest-cli.json
Original file line number Diff line number Diff line change
@@ -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
}
}
7 changes: 4 additions & 3 deletions backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "@codepair/backend",
"version": "0.1.14",
"description": "CodePair Backend",
"type": "module",
"author": "yorkie-team",
"license": "Apache-2.0",
"scripts": {
Expand All @@ -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}": [
Expand Down Expand Up @@ -93,4 +94,4 @@
"src/(.*)": "<rootDir>/src/$1"
}
}
}
}
14 changes: 7 additions & 7 deletions backend/test/jest-e2e.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
4 changes: 2 additions & 2 deletions backend/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"extends": "./tsconfig.json",
"exclude": ["node_modules", "test", "dist", "**/*spec.ts"]
"extends": "./tsconfig.json",
"exclude": ["node_modules", "test", "dist", "**/*spec.ts"]
}
4 changes: 2 additions & 2 deletions backend/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
"noImplicitAny": false,
"strictBindCallApply": false,
"forceConsistentCasingInFileNames": false,
"noFallthroughCasesInSwitch": false,
},
"noFallthroughCasesInSwitch": false
}
}

0 comments on commit 705d825

Please sign in to comment.