|
|
@@ -0,0 +1,45 @@
|
|
|
+import { Entity, PrimaryGeneratedColumn, Column, Index } from 'typeorm';
|
|
|
+import { z } from '@hono/zod-openapi';
|
|
|
+
|
|
|
+@Entity('date_notes')
|
|
|
+@Index(['code', 'noteDate'], { unique: true })
|
|
|
+export class DateNotes {
|
|
|
+ @PrimaryGeneratedColumn({ unsigned: true })
|
|
|
+ id!: number;
|
|
|
+
|
|
|
+ @Column({ name: 'code', type: 'varchar', length: 255, nullable: false, comment: '股票代码' })
|
|
|
+ code!: string;
|
|
|
+
|
|
|
+ @Column({ name: 'note_date', type: 'timestamp', nullable: false, comment: '备注日期' })
|
|
|
+ noteDate!: Date;
|
|
|
+
|
|
|
+ @Column({ name: 'note', type: 'varchar', length: 255, nullable: false, comment: '备注内容' })
|
|
|
+ note!: string;
|
|
|
+
|
|
|
+ @Column({ name: 'created_at', type: 'timestamp', default: () => 'CURRENT_TIMESTAMP' })
|
|
|
+ createdAt!: Date;
|
|
|
+
|
|
|
+ @Column({ name: 'updated_at', type: 'timestamp', default: () => 'CURRENT_TIMESTAMP', onUpdate: 'CURRENT_TIMESTAMP' })
|
|
|
+ updatedAt!: Date;
|
|
|
+}
|
|
|
+
|
|
|
+export const DateNotesSchema = z.object({
|
|
|
+ id: z.number().int().positive().openapi({ description: 'ID', example: 1 }),
|
|
|
+ code: z.string().max(255).openapi({ description: '股票代码', example: '001339' }),
|
|
|
+ noteDate: z.date().openapi({ description: '备注日期', example: '2024-11-07T08:00:00Z' }),
|
|
|
+ note: z.string().max(255).openapi({ description: '备注内容', example: 'test01' }),
|
|
|
+ createdAt: z.date().openapi({ description: '创建时间', example: '2025-05-22T16:17:13Z' }),
|
|
|
+ updatedAt: z.date().openapi({ description: '更新时间', example: '2025-05-22T16:17:13Z' })
|
|
|
+});
|
|
|
+
|
|
|
+export const CreateDateNotesDto = z.object({
|
|
|
+ code: z.string().max(255).openapi({ description: '股票代码', example: '001339' }),
|
|
|
+ noteDate: z.date().openapi({ description: '备注日期', example: '2024-11-07T08:00:00Z' }),
|
|
|
+ note: z.string().max(255).openapi({ description: '备注内容', example: 'test01' })
|
|
|
+});
|
|
|
+
|
|
|
+export const UpdateDateNotesDto = z.object({
|
|
|
+ code: z.string().max(255).optional().openapi({ description: '股票代码', example: '001339' }),
|
|
|
+ noteDate: z.date().optional().openapi({ description: '备注日期', example: '2024-11-07T08:00:00Z' }),
|
|
|
+ note: z.string().max(255).optional().openapi({ description: '备注内容', example: 'test01' })
|
|
|
+});
|