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 { 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 { UserRole } from './users_roles';
|
||||
@ -11,7 +11,7 @@ export class User {
|
||||
|
||||
@Column({
|
||||
nullable: false,
|
||||
unique: true,
|
||||
unique: false,
|
||||
length: 64
|
||||
})
|
||||
email: string;
|
||||
@ -25,7 +25,7 @@ export class User {
|
||||
|
||||
@Column({
|
||||
nullable: false,
|
||||
unique: true,
|
||||
unique: false,
|
||||
length: 64
|
||||
})
|
||||
username: string;
|
||||
@ -33,15 +33,13 @@ export class User {
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 64,
|
||||
unique: true,
|
||||
unique: false,
|
||||
})
|
||||
name: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
type: 'uuid'
|
||||
})
|
||||
id_role: string;
|
||||
@ManyToMany(() => UserRole, { onDelete: 'CASCADE' })
|
||||
@JoinTable()
|
||||
roles: UserRole[]
|
||||
|
||||
@Index()
|
||||
@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 { Application } from './application';
|
||||
import { User } from './users';
|
||||
|
||||
@Entity('user_roles')
|
||||
export class UserRole {
|
||||
|
||||
Reference in New Issue
Block a user