|
@@ -1,10 +1,10 @@
|
|
|
-import { Entity, PrimaryColumn, Column, Index } from 'typeorm';
|
|
|
|
|
|
|
+import { Entity, PrimaryGeneratedColumn, Column, Index } from 'typeorm';
|
|
|
import { z } from '@hono/zod-openapi';
|
|
import { z } from '@hono/zod-openapi';
|
|
|
|
|
|
|
|
@Entity('file')
|
|
@Entity('file')
|
|
|
export class File {
|
|
export class File {
|
|
|
- @PrimaryColumn({ name: 'id', type: 'varchar', length: 50 })
|
|
|
|
|
- id!: string;
|
|
|
|
|
|
|
+ @PrimaryGeneratedColumn({ name: 'id', type: 'int', unsigned: true })
|
|
|
|
|
+ id!: number;
|
|
|
|
|
|
|
|
@Column({ name: 'name', type: 'varchar', length: 255 })
|
|
@Column({ name: 'name', type: 'varchar', length: 255 })
|
|
|
name!: string;
|
|
name!: string;
|
|
@@ -43,9 +43,9 @@ export class File {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
export const FileSchema = z.object({
|
|
export const FileSchema = z.object({
|
|
|
- id: z.string().max(50).openapi({
|
|
|
|
|
|
|
+ id: z.number().int().positive().openapi({
|
|
|
description: '文件ID',
|
|
description: '文件ID',
|
|
|
- example: 'FILE20230001'
|
|
|
|
|
|
|
+ example: 1
|
|
|
}),
|
|
}),
|
|
|
name: z.string().max(255).openapi({
|
|
name: z.string().max(255).openapi({
|
|
|
description: '文件名称',
|
|
description: '文件名称',
|
|
@@ -110,9 +110,13 @@ export const CreateFileDto = z.object({
|
|
|
description: '文件描述',
|
|
description: '文件描述',
|
|
|
example: '2023年度项目计划书'
|
|
example: '2023年度项目计划书'
|
|
|
}),
|
|
}),
|
|
|
- lastUpdated: z.coerce.date().nullable().optional().openapi({
|
|
|
|
|
|
|
+ uploadUserId: z.string().max(50).openapi({
|
|
|
|
|
+ description: '上传用户ID',
|
|
|
|
|
+ example: 'U1001'
|
|
|
|
|
+ }),
|
|
|
|
|
+ lastUpdated: z.coerce.date().nullable().optional().openapi({
|
|
|
description: '最后更新时间',
|
|
description: '最后更新时间',
|
|
|
- example: '2023-01-16T14:20:00Z'
|
|
|
|
|
|
|
+ example: '2023-01-16T14:20:00Z'
|
|
|
})
|
|
})
|
|
|
});
|
|
});
|
|
|
|
|
|