listpage_cli 0.0.192 → 0.0.193

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "listpage_cli",
3
- "version": "0.0.192",
3
+ "version": "0.0.193",
4
4
  "private": false,
5
5
  "bin": {
6
6
  "listpage_cli": "bin/cli.js"
@@ -0,0 +1,14 @@
1
+ # 智能体
2
+
3
+ 你是一个擅长后端开发(NestJS + Prisma)的智能助手
4
+
5
+
6
+ # 开发规范
7
+
8
+ 默认情况下,接口均采用 `POST` 方法。
9
+
10
+
11
+ # 命令
12
+
13
+ `npm run dev`: 启动开发服务器
14
+ `npm run prisma:gen`: 生成 Prisma 客户端
@@ -23,7 +23,7 @@
23
23
  "class-transformer": "^0.5.1",
24
24
  "class-validator": "~0.14.2",
25
25
  "rxjs": "^7.8.1",
26
- "listpage-next-nest": "~0.0.163"
26
+ "listpage-next-nest": "~0.0.193"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@nestjs/schematics": "^11.0.0",
@@ -1,8 +1,22 @@
1
1
  import { NestFactory } from '@nestjs/core';
2
- import { AppModule } from './app.module';
2
+ import { ValidationPipe } from '@nestjs/common';
3
+ import { ResponseInterceptor } from 'listpage-next-nest';
4
+
5
+ import { AppModule } from './modules/app.module';
3
6
 
4
7
  async function bootstrap() {
5
8
  const app = await NestFactory.create(AppModule);
6
- await app.listen(process.env.PORT ?? 3000);
9
+ app.useGlobalInterceptors(new ResponseInterceptor());
10
+ app.setGlobalPrefix('api/v1');
11
+ // 启用全局验证管道
12
+ app.useGlobalPipes(
13
+ new ValidationPipe({
14
+ whitelist: true,
15
+ transform: true,
16
+ }),
17
+ );
18
+ // 启用CORS
19
+ app.enableCors();
20
+ await app.listen(3000);
7
21
  }
8
22
  bootstrap();
@@ -0,0 +1,7 @@
1
+ import { Module } from '@nestjs/common';
2
+ import { PrismaModule } from './prisma/prisma.module';
3
+
4
+ @Module({
5
+ imports: [PrismaModule],
6
+ })
7
+ export class AppModule {}
@@ -0,0 +1,8 @@
1
+ import { Module } from '@nestjs/common';
2
+ import { PrismaService } from './prisma.service';
3
+
4
+ @Module({
5
+ providers: [PrismaService],
6
+ exports: [PrismaService],
7
+ })
8
+ export class PrismaModule {}
@@ -0,0 +1,12 @@
1
+ import { Injectable } from '@nestjs/common';
2
+
3
+ @Injectable()
4
+ export class PrismaService implements OnModuleInit {
5
+ async onModuleInit() {
6
+ await this.$connect();
7
+ }
8
+
9
+ async onModuleDestroy() {
10
+ await this.$disconnect();
11
+ }
12
+ }
@@ -12,7 +12,7 @@
12
12
  "dependencies": {
13
13
  "react": "^19.2.0",
14
14
  "react-dom": "^19.2.0",
15
- "listpage-next": "~0.0.192",
15
+ "listpage-next": "~0.0.193",
16
16
  "react-router-dom": ">=6.0.0",
17
17
  "@ant-design/v5-patch-for-react-19": "~1.0.3",
18
18
  "ahooks": "^3.9.5",
@@ -1,12 +0,0 @@
1
- import { Controller, Get } from '@nestjs/common';
2
- import { AppService } from './app.service';
3
-
4
- @Controller()
5
- export class AppController {
6
- constructor(private readonly appService: AppService) {}
7
-
8
- @Get()
9
- getHello(): string {
10
- return this.appService.getHello();
11
- }
12
- }
@@ -1,10 +0,0 @@
1
- import { Module } from '@nestjs/common';
2
- import { AppController } from './app.controller';
3
- import { AppService } from './app.service';
4
-
5
- @Module({
6
- imports: [],
7
- controllers: [AppController],
8
- providers: [AppService],
9
- })
10
- export class AppModule {}
@@ -1,8 +0,0 @@
1
- import { Injectable } from '@nestjs/common';
2
-
3
- @Injectable()
4
- export class AppService {
5
- getHello(): string {
6
- return 'Hello World!';
7
- }
8
- }