koa-typescript-sequlize-swagger
Version:
nodejs的后端模板,使用了koa,typescript,koa-swagger-decorator,zod等
26 lines (24 loc) • 545 B
text/typescript
import { Column, DataType, Table, Length } from 'sequelize-typescript'
import BaseModel from '@/schema/baseModal'
@Table({
tableName: 'user',
paranoid: true
// 启用软删除
})
export default class User extends BaseModel {
@Length({
min: 2,
max: 10,
msg: 'userName must between 2 to 10 characters'
})
@Column({
type: DataType.STRING,
comment: '用户名称'
})
declare userName: string
@Column({
type: DataType.STRING,
comment: '密码'
})
declare password: string
}