初始化参股
This commit is contained in:
55
后端/src/entities/user.entity.ts
Normal file
55
后端/src/entities/user.entity.ts
Normal file
@@ -0,0 +1,55 @@
|
||||
import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn } from 'typeorm';
|
||||
|
||||
@Entity('users')
|
||||
export class User {
|
||||
@PrimaryGeneratedColumn()
|
||||
id: number;
|
||||
|
||||
@Column({ unique: true, length: 50, nullable: true })
|
||||
username: string;
|
||||
|
||||
@Column({ unique: true, length: 100, nullable: true })
|
||||
email: string;
|
||||
|
||||
@Column({ select: false, nullable: true })
|
||||
password: string;
|
||||
|
||||
@Column({ length: 50, nullable: true })
|
||||
realName: string;
|
||||
|
||||
@Column({ length: 20, nullable: true })
|
||||
phone: string;
|
||||
|
||||
@Column({ type: 'text', nullable: true })
|
||||
avatar: string;
|
||||
|
||||
// 微信小程序相关字段
|
||||
@Column({ unique: true, length: 50, nullable: true })
|
||||
openid: string; // 微信openid
|
||||
|
||||
@Column({ length: 100, nullable: true })
|
||||
unionid: string; // 微信unionid
|
||||
|
||||
@Column({ type: 'text', nullable: true })
|
||||
sessionKey: string; // 微信session_key
|
||||
|
||||
@Column({
|
||||
type: 'enum',
|
||||
enum: ['admin', 'customer', 'worker'],
|
||||
default: 'customer'
|
||||
})
|
||||
role: string;
|
||||
|
||||
@Column({
|
||||
type: 'enum',
|
||||
enum: ['active', 'inactive', 'banned'],
|
||||
default: 'active'
|
||||
})
|
||||
status: string;
|
||||
|
||||
@CreateDateColumn()
|
||||
createdAt: Date;
|
||||
|
||||
@UpdateDateColumn()
|
||||
updatedAt: Date;
|
||||
}
|
||||
Reference in New Issue
Block a user