|
@@ -77,7 +77,7 @@
|
|
|
```typescript
|
|
```typescript
|
|
|
import { DataSource, Repository } from 'typeorm';
|
|
import { DataSource, Repository } from 'typeorm';
|
|
|
import { YourEntity } from './your-entity.entity';
|
|
import { YourEntity } from './your-entity.entity';
|
|
|
- import { CreateYourEntityDto, UpdateYourEntityDto } from './your-entity.entity';
|
|
|
|
|
|
|
+ import { CreateYourEntityDto, UpdateYourEntityDto } from './your-entity.schema';
|
|
|
|
|
|
|
|
export class YourEntityService {
|
|
export class YourEntityService {
|
|
|
private repository: Repository<YourEntity>;
|
|
private repository: Repository<YourEntity>;
|
|
@@ -188,7 +188,7 @@
|
|
|
```typescript
|
|
```typescript
|
|
|
import { createRoute, OpenAPIHono } from '@hono/zod-openapi';
|
|
import { createRoute, OpenAPIHono } from '@hono/zod-openapi';
|
|
|
import { z } from 'zod';
|
|
import { z } from 'zod';
|
|
|
- import { YourEntitySchema } from '@/server/modules/your-module/your-entity.entity';
|
|
|
|
|
|
|
+ import { YourEntitySchema } from '@/server/modules/your-module/your-entity.schema';
|
|
|
import { ErrorSchema } from '@/server/utils/errorHandler';
|
|
import { ErrorSchema } from '@/server/utils/errorHandler';
|
|
|
import { AppDataSource } from '@/server/data-source';
|
|
import { AppDataSource } from '@/server/data-source';
|
|
|
import { YourEntityService } from '@/server/modules/your-module/your-entity.service';
|
|
import { YourEntityService } from '@/server/modules/your-module/your-entity.service';
|
|
@@ -276,7 +276,7 @@
|
|
|
- **创建实体路由示例** (post.ts):
|
|
- **创建实体路由示例** (post.ts):
|
|
|
```typescript
|
|
```typescript
|
|
|
import { createRoute, OpenAPIHono } from '@hono/zod-openapi';
|
|
import { createRoute, OpenAPIHono } from '@hono/zod-openapi';
|
|
|
- import { CreateYourEntityDto, YourEntitySchema } from '@/server/modules/your-module/your-entity.entity';
|
|
|
|
|
|
|
+ import { CreateYourEntityDto, YourEntitySchema } from '@/server/modules/your-module/your-entity.schema';
|
|
|
import { ErrorSchema } from '@/server/utils/errorHandler';
|
|
import { ErrorSchema } from '@/server/utils/errorHandler';
|
|
|
import { AppDataSource } from '@/server/data-source';
|
|
import { AppDataSource } from '@/server/data-source';
|
|
|
import { YourEntityService } from '@/server/modules/your-module/your-entity.service';
|
|
import { YourEntityService } from '@/server/modules/your-module/your-entity.service';
|