update users set relation many to many and it's related changed roles
This commit is contained in:
@ -1,5 +1,5 @@
|
|||||||
import bcrypt from 'bcryptjs';
|
import bcrypt from 'bcryptjs';
|
||||||
import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, Index, OneToOne, JoinColumn, ManyToOne } from 'typeorm';
|
import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, Index, OneToOne, JoinColumn, ManyToOne, OneToMany, ManyToMany, JoinTable } from 'typeorm';
|
||||||
|
|
||||||
import { Status } from '../types/status';
|
import { Status } from '../types/status';
|
||||||
import { UserRole } from './users_roles';
|
import { UserRole } from './users_roles';
|
||||||
@ -11,7 +11,7 @@ export class User {
|
|||||||
|
|
||||||
@Column({
|
@Column({
|
||||||
nullable: false,
|
nullable: false,
|
||||||
unique: true,
|
unique: false,
|
||||||
length: 64
|
length: 64
|
||||||
})
|
})
|
||||||
email: string;
|
email: string;
|
||||||
@ -25,7 +25,7 @@ export class User {
|
|||||||
|
|
||||||
@Column({
|
@Column({
|
||||||
nullable: false,
|
nullable: false,
|
||||||
unique: true,
|
unique: false,
|
||||||
length: 64
|
length: 64
|
||||||
})
|
})
|
||||||
username: string;
|
username: string;
|
||||||
@ -33,15 +33,13 @@ export class User {
|
|||||||
@Column({
|
@Column({
|
||||||
nullable: true,
|
nullable: true,
|
||||||
length: 64,
|
length: 64,
|
||||||
unique: true,
|
unique: false,
|
||||||
})
|
})
|
||||||
name: string;
|
name: string;
|
||||||
|
|
||||||
@Column({
|
@ManyToMany(() => UserRole, { onDelete: 'CASCADE' })
|
||||||
nullable: true,
|
@JoinTable()
|
||||||
type: 'uuid'
|
roles: UserRole[]
|
||||||
})
|
|
||||||
id_role: string;
|
|
||||||
|
|
||||||
@Index()
|
@Index()
|
||||||
@Column({
|
@Column({
|
||||||
|
|||||||
@ -1,7 +1,8 @@
|
|||||||
import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, JoinColumn, ManyToOne } from 'typeorm';
|
import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, JoinColumn, ManyToOne, ManyToMany } from 'typeorm';
|
||||||
|
|
||||||
import { Status } from '../types/status';
|
import { Status } from '../types/status';
|
||||||
import { Application } from './application';
|
import { Application } from './application';
|
||||||
|
import { User } from './users';
|
||||||
|
|
||||||
@Entity('user_roles')
|
@Entity('user_roles')
|
||||||
export class UserRole {
|
export class UserRole {
|
||||||
|
|||||||
Reference in New Issue
Block a user