feat(entities): 集成 MikroORM 并配置实体文件规则
- 添加 MikroORM CLI 和实体生成器依赖包 - 配置 ESLint 规则以适配 MikroORM 生成的实体文件 - 添加 mikro-orm 和 generate-entities 命令脚本 - 更新 pnpm 锁定文件包含新依赖项 - 移除手动创建的 meeting-user 实体文件,改用 ORM 自动生成
This commit is contained in:
17
node_api/src/entities/MeetingUser.ts
Normal file
17
node_api/src/entities/MeetingUser.ts
Normal file
@ -0,0 +1,17 @@
|
||||
import { defineEntity, p } from '@mikro-orm/core';
|
||||
|
||||
export class MeetingUser {
|
||||
id!: bigint;
|
||||
longUserId!: bigint;
|
||||
createdAt?: Date;
|
||||
}
|
||||
|
||||
export const MeetingUserSchema = defineEntity({
|
||||
class: MeetingUser,
|
||||
uniques: [{ name: 'idx_hostUserId', properties: ['longUserId'] }],
|
||||
properties: {
|
||||
id: p.bigint().primary().unsigned(false).comment('短id'),
|
||||
longUserId: p.bigint().name('long_user_Id').comment('用户的uid').unique('hostUserId'),
|
||||
createdAt: p.datetime().length(3).nullable().comment('创建时间').defaultRaw(`current_timestamp(3)`),
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user