add user module

This commit is contained in:
liuyi 2025-06-22 08:43:48 +08:00
parent 9865f294e9
commit 89d4a7c78f

View File

@ -0,0 +1,81 @@
import { Exclude, Expose, Type } from 'class-transformer';
import {
Column,
CreateDateColumn,
DeleteDateColumn,
Entity,
PrimaryColumn,
UpdateDateColumn,
} from 'typeorm';
/**
*
*/
@Exclude()
@Entity('user')
export class UserEntity {
/**
*ID
*/
@Expose()
@PrimaryColumn({ type: 'varchar', generated: 'uuid', length: 36 })
id: string;
/**
*
*/
@Expose()
@Column({ comment: '昵称', nullable: true, length: 64 })
nickname?: string;
/**
*
*/
@Expose()
@Column({ comment: '用户名', unique: true, length: 64 })
username: string;
/**
*
*/
@Column({ comment: '用户密码', length: 500, select: false })
password: string;
/**
*
*/
@Expose()
@Column({ comment: '用户手机号', length: 64, nullable: false, unique: true })
phone?: string;
/**
*
*/
@Expose()
@Column({ comment: '用户邮箱', length: 256, nullable: true, unique: true })
email?: string;
/**
*
*/
@Expose()
@Type(() => Date)
@CreateDateColumn({ comment: '用户创建时间' })
createdAt?: Date;
/**
*
*/
@Expose()
@Type(() => Date)
@UpdateDateColumn({ comment: '用户更新时间' })
updatedAt?: Date;
/**
*
*/
@Expose()
@Type(() => Date)
@DeleteDateColumn({ comment: '用户销户时间' })
deletedAt?: Date;
}