Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions docs/tiny-pro-backend-dev-guideline.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,31 @@ Application is running on: http://[::1]:3000
```


### 关闭演示模式

`TinyPro` 提供了一个 `RejectGuard` 的 `Guard`. 如果你需要关闭演示模式, 请在 `nestJS/src/app.module.ts` 中移除 L66~L69. 最终代码应当如下

Comment on lines +65 to +66
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Same guard name mismatch and brittle line-number reference.

与另一篇文档相同,说明文字应使用 RejectRequestGuard,且不应引用“L66~L69”。

Apply:

-`TinyPro` 提供了一个 `RejectGuard` 的 `Guard`. 如果你需要关闭演示模式, 请在 `nestJS/src/app.module.ts` 中移除 L66~L69. 最终代码应当如下
+`TinyPro` 提供了一个名为 `RejectRequestGuard` 的 Guard。若需关闭演示模式,请在 `nestJS/src/app.module.ts` 的 `@Module` 中移除 `APP_GUARD` 的 `useClass: RejectRequestGuard` 提供者项。最终代码应当如下:
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
`TinyPro` 提供了一个 `RejectGuard``Guard`. 如果你需要关闭演示模式, 请在 `nestJS/src/app.module.ts` 中移除 L66~L69. 最终代码应当如下
`TinyPro` 提供了一个名为 `RejectRequestGuard` 的 Guard。若需关闭演示模式,请在 `nestJS/src/app.module.ts` `@Module` 中移除 `APP_GUARD``useClass: RejectRequestGuard` 提供者项。最终代码应当如下
🤖 Prompt for AI Agents
In docs/tiny-pro-backend-dev-guideline.md around lines 65-66, the text
incorrectly names the guard as "RejectGuard" and uses a brittle line-number
reference "L66~L69"; update the wording to reference the correct guard name
"RejectRequestGuard" and remove any hard-coded line numbers—instead instruct
readers to remove the RejectRequestGuard registration/usage from
nestJS/src/app.module.ts (e.g., delete the import and global provider/guard
registration that applies the RejectRequestGuard) so the guidance is robust and
accurate.

```diff
@Module({
...
providers: [
{
provide: APP_GUARD,
useClass: AuthGuard,
},
- {
- provide: APP_GUARD,
- useClass: RejectRequestGuard,
- },
{
provide: APP_GUARD,
useClass: PermissionGuard,
},
],
})
export class AppModule implements OnModuleInit {
```

## 初始化数据

有些时候我们需要自动初始化一些数据(比如前端的默认国际化字段). 这些逻辑**均需**写在`App.module.ts`中`AppModule`类中的`onModuleInit`函数中。
Expand Down
25 changes: 25 additions & 0 deletions docs/tiny-pro.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,31 @@ tiny-pro

后端服务支持`docker启动`与`命令启动`, 执行操作前请先确保所处位置为`tiny-pro/nestJS`

### 关闭演示模式

`TinyPro` 提供了一个 `RejectGuard` 的 `Guard`. 如果你需要关闭演示模式, 请在 `nestJS/src/app.module.ts` 中移除 L66~L69. 最终代码应当如下

Comment on lines +44 to +45
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Fix guard name and wording; remove brittle line-number reference.

  • Text says “RejectGuard 的 Guard” but the example uses RejectRequestGuard. This mismatch can confuse readers.
  • Referring to “L66~L69” in another file is brittle and will rot.

Apply:

-`TinyPro` 提供了一个 `RejectGuard` 的 `Guard`. 如果你需要关闭演示模式, 请在 `nestJS/src/app.module.ts` 中移除 L66~L69. 最终代码应当如下
+`TinyPro` 提供了一个名为 `RejectRequestGuard` 的 Guard。若需关闭演示模式,请在 `nestJS/src/app.module.ts` 的 `@Module` 中移除 `APP_GUARD` 的 `useClass: RejectRequestGuard` 提供者项(如下所示的删除块)。最终代码应当如下:
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
`TinyPro` 提供了一个 `RejectGuard``Guard`. 如果你需要关闭演示模式, 请在 `nestJS/src/app.module.ts` 中移除 L66~L69. 最终代码应当如下
`TinyPro` 提供了一个名为 `RejectRequestGuard` 的 Guard。若需关闭演示模式,请在 `nestJS/src/app.module.ts` `@Module` 中移除 `APP_GUARD``useClass: RejectRequestGuard` 提供者项(如下所示的删除块)。最终代码应当如下
🤖 Prompt for AI Agents
In docs/tiny-pro.md around lines 44-45, the text mistakenly says "RejectGuard 的
Guard" while the example uses RejectRequestGuard and also points to brittle line
numbers "L66~L69" in another file; update the wording to reference the correct
guard name (e.g., "RejectRequestGuard") and remove the exact line-number
reference, instead instructing readers to remove the demo-mode guard
registration from nestJS/src/app.module.ts (e.g., remove the RejectRequestGuard
import/registration or entry in providers/guards) so the instruction remains
stable as the file changes.

```diff
@Module({
...
providers: [
{
provide: APP_GUARD,
useClass: AuthGuard,
},
- {
- provide: APP_GUARD,
- useClass: RejectRequestGuard,
- },
{
provide: APP_GUARD,
useClass: PermissionGuard,
},
],
})
export class AppModule implements OnModuleInit {
```

### Docker启动

在运行`docker compose up -d`之前,请先修改`.env`环境变量文件,示例如下
Expand Down