update user, auth, token, roles, done
This commit is contained in:
@ -3,7 +3,7 @@ import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateCol
|
||||
@Entity('user_refresh_tokens')
|
||||
export class UserRefreshToken {
|
||||
@PrimaryGeneratedColumn('uuid')
|
||||
id: string;
|
||||
refresh_token: string;
|
||||
|
||||
@Index()
|
||||
@Column({
|
||||
@ -19,10 +19,22 @@ export class UserRefreshToken {
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 64
|
||||
length: 128
|
||||
})
|
||||
os: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 256
|
||||
})
|
||||
device: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 64
|
||||
})
|
||||
platform: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 64
|
||||
@ -35,6 +47,9 @@ export class UserRefreshToken {
|
||||
})
|
||||
remote_addr: string;
|
||||
|
||||
@Column('timestamp')
|
||||
expired_at: Date;
|
||||
|
||||
@Column()
|
||||
@CreateDateColumn()
|
||||
created_at: Date;
|
||||
@ -1,7 +1,6 @@
|
||||
import bcrypt from 'bcryptjs';
|
||||
import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn } from 'typeorm';
|
||||
|
||||
import { Role } from '../types/role';
|
||||
import { Status } from '../types/status';
|
||||
|
||||
@Entity('users')
|
||||
@ -38,10 +37,9 @@ export class User {
|
||||
|
||||
@Column({
|
||||
nullable: false,
|
||||
default: 'STAFF' as Role,
|
||||
length: 30,
|
||||
type: 'uuid'
|
||||
})
|
||||
role: Role;
|
||||
id_role: string;
|
||||
|
||||
@Column({
|
||||
nullable: false,
|
||||
|
||||
41
src/entity/users_roles.ts
Normal file
41
src/entity/users_roles.ts
Normal file
@ -0,0 +1,41 @@
|
||||
import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn } from 'typeorm';
|
||||
|
||||
import { Status } from '../types/status';
|
||||
import { RoleList } from '../types/role';
|
||||
|
||||
@Entity('user_roles')
|
||||
export class UserRole {
|
||||
@PrimaryGeneratedColumn('uuid')
|
||||
id: string;
|
||||
|
||||
@Column({
|
||||
nullable: false,
|
||||
unique: true,
|
||||
length: 128
|
||||
})
|
||||
name: string;
|
||||
|
||||
@Column({
|
||||
nullable: false,
|
||||
type: 'jsonb'
|
||||
})
|
||||
roles: RoleList[];
|
||||
|
||||
@Column({
|
||||
nullable: false,
|
||||
length: 64
|
||||
})
|
||||
status: Status;
|
||||
|
||||
@Column()
|
||||
@CreateDateColumn()
|
||||
created_at: Date;
|
||||
|
||||
@Column({ nullable: true })
|
||||
@UpdateDateColumn()
|
||||
updated_at: Date;
|
||||
|
||||
@Column({ nullable: true })
|
||||
@DeleteDateColumn()
|
||||
deleted_at: Date;
|
||||
}
|
||||
Reference in New Issue
Block a user