创建user模块
先用nest的命令创建一个 user 模块,
nest g res user
实现user实体
然后就生成了 user 模块,在它的实体中创建一个用户表user.entity.ts,包含 id、用户名、密码,头像、邮箱等等一些字段:
@Entity('sys_user')
export class UserEntity {
@Expose()
@ApiProperty({ type: String, description: 'id' })
@PrimaryGeneratedColumn({ type: 'bigint' })
public id: string
@Exclude({ toPlainOnly: true }) // 输出屏蔽密码
@Column({ type: 'varchar', length: 200, nullable: false, comment: '用户登录密码' })
public password: string
@Exclude({ toPlainOnly: true }) // 输出屏蔽盐
@Column({ type: 'varchar', length: 200, nullable: false, comment: '盐' })
public salt: string
@Expose()
@ApiProperty({ type: String, description: '用户登录账号' })
@Column({ type: 'varchar', length: 32, comment: '用户登录账号' })
public account: string
@Expose()
@ApiProperty({ type: String, description: '手机号' })
@Column({ type:

最低0.47元/天 解锁文章
1670

被折叠的 条评论
为什么被折叠?



