加入userSession实体
This commit is contained in:
20
tone-page-server/src/user/entities/user-session.entity.ts
Normal file
20
tone-page-server/src/user/entities/user-session.entity.ts
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
import { Column, CreateDateColumn, DeleteDateColumn, Entity, Index, PrimaryGeneratedColumn } from "typeorm";
|
||||||
|
|
||||||
|
@Entity()
|
||||||
|
@Index(['sessionId', 'userId'])
|
||||||
|
export class UserSession {
|
||||||
|
@PrimaryGeneratedColumn('uuid')
|
||||||
|
id: string;
|
||||||
|
|
||||||
|
@Column({ length: 36 })
|
||||||
|
sessionId: string;
|
||||||
|
|
||||||
|
@Column({ length: 36 })
|
||||||
|
userId: string;
|
||||||
|
|
||||||
|
@CreateDateColumn({ precision: 3 })
|
||||||
|
createdAt: Date;
|
||||||
|
|
||||||
|
@DeleteDateColumn({ nullable: true, precision: 3 })
|
||||||
|
deletedAt: Date;
|
||||||
|
}
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
import { Column, CreateDateColumn, DeleteDateColumn, Entity, Index, PrimaryGeneratedColumn, UpdateDateColumn } from "typeorm";
|
|
||||||
|
|
||||||
@Entity()
|
|
||||||
export class User {
|
|
||||||
@PrimaryGeneratedColumn()
|
|
||||||
id: number;
|
|
||||||
|
|
||||||
@Column('uuid', { unique: true, default: () => 'gen_random_uuid()' })
|
|
||||||
userId: string;
|
|
||||||
|
|
||||||
@Column({ length: 32 })
|
|
||||||
@Index({ unique: true })
|
|
||||||
username: string;
|
|
||||||
|
|
||||||
@Column({ length: 30 })
|
|
||||||
nickname: string;
|
|
||||||
|
|
||||||
@Column({ nullable: true, type: 'char', length: 32 })
|
|
||||||
salt: string;
|
|
||||||
|
|
||||||
@Column({ nullable: true, type: 'char', length: 64 })
|
|
||||||
password_hash: string;
|
|
||||||
|
|
||||||
@Column({ nullable: true, length: 254 })// RFC 5321
|
|
||||||
@Index({ unique: true })
|
|
||||||
email: string;
|
|
||||||
|
|
||||||
@Column({ nullable: true, length: 20 })// China Mainland
|
|
||||||
@Index({ unique: true })
|
|
||||||
phone: string;
|
|
||||||
|
|
||||||
@Column({ nullable: true })
|
|
||||||
avatar: string;
|
|
||||||
|
|
||||||
@CreateDateColumn({ precision: 3 })
|
|
||||||
created_at: Date;
|
|
||||||
|
|
||||||
@UpdateDateColumn({ precision: 3 })
|
|
||||||
updated_at: Date;
|
|
||||||
|
|
||||||
@DeleteDateColumn({ nullable: true, precision: 3 })
|
|
||||||
deleted_at: Date;
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user