Updated models with unique columns constraints
This commit is contained in:
@@ -7,10 +7,14 @@ export class Ingredient {
|
|||||||
@PrimaryGeneratedColumn('uuid')
|
@PrimaryGeneratedColumn('uuid')
|
||||||
public readonly uuid!: string
|
public readonly uuid!: string
|
||||||
|
|
||||||
@Column()
|
@Column({
|
||||||
public name!: string
|
unique: true
|
||||||
@Column()
|
})
|
||||||
public description!: string
|
public name: string
|
||||||
|
@Column({
|
||||||
|
unique: true
|
||||||
|
})
|
||||||
|
public description: string
|
||||||
|
|
||||||
@Column()
|
@Column()
|
||||||
public published: boolean
|
public published: boolean
|
||||||
|
|||||||
@@ -7,10 +7,14 @@ export class MetaSchool {
|
|||||||
@PrimaryGeneratedColumn('uuid')
|
@PrimaryGeneratedColumn('uuid')
|
||||||
public readonly uuid!: string
|
public readonly uuid!: string
|
||||||
|
|
||||||
@Column()
|
@Column({
|
||||||
public name!: string
|
unique: true
|
||||||
@Column()
|
})
|
||||||
public description!: string
|
public name: string
|
||||||
|
@Column({
|
||||||
|
unique: true
|
||||||
|
})
|
||||||
|
public description: string
|
||||||
|
|
||||||
@Column()
|
@Column()
|
||||||
public published: boolean
|
public published: boolean
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Column, CreateDateColumn, Entity, JoinTable, ManyToMany, ManyToOne, PrimaryGeneratedColumn, UpdateDateColumn } from "typeorm";
|
import { BaseEntity, Column, CreateDateColumn, Entity, JoinTable, ManyToMany, ManyToOne, PrimaryGeneratedColumn, Unique, UpdateDateColumn } from "typeorm";
|
||||||
import { User } from "../users/User";
|
import { User } from "../users/User";
|
||||||
import { MetaSchool } from "./MetaSchool";
|
import { MetaSchool } from "./MetaSchool";
|
||||||
import { Spell } from "./Spell";
|
import { Spell } from "./Spell";
|
||||||
@@ -8,10 +8,14 @@ export class School {
|
|||||||
@PrimaryGeneratedColumn('uuid')
|
@PrimaryGeneratedColumn('uuid')
|
||||||
public readonly uuid!: string
|
public readonly uuid!: string
|
||||||
|
|
||||||
@Column()
|
@Column({
|
||||||
public name!: string
|
unique: true
|
||||||
@Column()
|
})
|
||||||
public description!: string
|
public name: string
|
||||||
|
@Column({
|
||||||
|
unique: true
|
||||||
|
})
|
||||||
|
public description: string
|
||||||
|
|
||||||
@Column()
|
@Column()
|
||||||
public published: boolean
|
public published: boolean
|
||||||
|
|||||||
@@ -9,14 +9,18 @@ export class Spell {
|
|||||||
@PrimaryGeneratedColumn('uuid')
|
@PrimaryGeneratedColumn('uuid')
|
||||||
public readonly uuid!: string
|
public readonly uuid!: string
|
||||||
|
|
||||||
@Column()
|
@Column({
|
||||||
public name!: string
|
unique: true
|
||||||
|
})
|
||||||
|
public name: string
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
unique: true
|
||||||
|
})
|
||||||
|
public description: string
|
||||||
|
|
||||||
@Column()
|
|
||||||
public description!: string
|
|
||||||
@Column()
|
@Column()
|
||||||
public level?: number
|
public level?: number
|
||||||
|
|
||||||
@Column()
|
@Column()
|
||||||
public charge?: number
|
public charge?: number
|
||||||
@Column()
|
@Column()
|
||||||
|
|||||||
@@ -7,8 +7,10 @@ export class Variable {
|
|||||||
@PrimaryGeneratedColumn('uuid')
|
@PrimaryGeneratedColumn('uuid')
|
||||||
public readonly uuid!: string
|
public readonly uuid!: string
|
||||||
|
|
||||||
@Column()
|
@Column({
|
||||||
public description!: string
|
unique: true
|
||||||
|
})
|
||||||
|
public description: string
|
||||||
|
|
||||||
@Column()
|
@Column()
|
||||||
public published: boolean
|
public published: boolean
|
||||||
|
|||||||
@@ -6,8 +6,10 @@ export class Permission {
|
|||||||
@PrimaryGeneratedColumn('uuid')
|
@PrimaryGeneratedColumn('uuid')
|
||||||
public readonly uuid!: string
|
public readonly uuid!: string
|
||||||
|
|
||||||
@Column()
|
@Column({
|
||||||
public slug!: string
|
unique: true
|
||||||
|
})
|
||||||
|
public slug: string
|
||||||
|
|
||||||
@ManyToOne(() => Role, role => role.permissions)
|
@ManyToOne(() => Role, role => role.permissions)
|
||||||
public roles: Role[]
|
public roles: Role[]
|
||||||
|
|||||||
@@ -7,10 +7,14 @@ export class Role {
|
|||||||
@PrimaryGeneratedColumn('uuid')
|
@PrimaryGeneratedColumn('uuid')
|
||||||
public readonly uuid!: string
|
public readonly uuid!: string
|
||||||
|
|
||||||
@Column()
|
@Column({
|
||||||
public name!: string
|
unique: true
|
||||||
@Column()
|
})
|
||||||
public description!: string
|
public name: string
|
||||||
|
@Column({
|
||||||
|
unique: true
|
||||||
|
})
|
||||||
|
public description: string
|
||||||
|
|
||||||
@OneToMany(() => Permission, permission => permission.roles)
|
@OneToMany(() => Permission, permission => permission.roles)
|
||||||
public permissions: Permission[]
|
public permissions: Permission[]
|
||||||
|
|||||||
@@ -11,13 +11,15 @@ export class User {
|
|||||||
@PrimaryGeneratedColumn('uuid')
|
@PrimaryGeneratedColumn('uuid')
|
||||||
public readonly uuid!: string
|
public readonly uuid!: string
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
unique: true
|
||||||
|
})
|
||||||
|
public readonly mail: string
|
||||||
@Column()
|
@Column()
|
||||||
public readonly mail!: string
|
public readonly password: string
|
||||||
@Column()
|
|
||||||
public readonly password!: string
|
|
||||||
|
|
||||||
@Column()
|
@Column()
|
||||||
public name!: string
|
public name: string
|
||||||
@Column()
|
@Column()
|
||||||
public avatar: string
|
public avatar: string
|
||||||
@Column()
|
@Column()
|
||||||
|
|||||||
Reference in New Issue
Block a user