This commit is contained in:
Narul Hidayah
2026-01-06 18:29:53 +07:00
2 changed files with 54 additions and 36 deletions

View File

@ -64,14 +64,23 @@ export class User {
@CreateDateColumn() @CreateDateColumn()
created_at: Date; created_at: Date;
@Column({ nullable: true, length: 256 })
created_by: string;
@Column({ nullable: true }) @Column({ nullable: true })
@UpdateDateColumn() @UpdateDateColumn()
updated_at: Date; updated_at: Date;
@Column({ nullable: true, length: 256 })
updated_by: string;
@Column({ nullable: true }) @Column({ nullable: true })
@DeleteDateColumn() @DeleteDateColumn()
deleted_at: Date; deleted_at: Date;
@Column({ nullable: true, length: 256 })
deleted_by: string;
hashPassword() { hashPassword() {
this.password = bcrypt.hashSync(this.password, 8); this.password = bcrypt.hashSync(this.password, 8);
} }

View File

@ -1,34 +1,34 @@
import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, JoinColumn, ManyToOne, ManyToMany } 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'; import { User } from "./users";
@Entity('user_roles') @Entity("user_roles")
export class UserRole { export class UserRole {
@PrimaryGeneratedColumn('uuid') @PrimaryGeneratedColumn("uuid")
id: string; id: string;
@ManyToOne(() => Application, { onDelete: "RESTRICT" }) @ManyToOne(() => Application, { onDelete: "RESTRICT" })
@JoinColumn({ name: 'application' }) @JoinColumn({ name: "application" })
application: Application application: Application;
@Column({ @Column({
nullable: false, nullable: false,
unique: false, unique: false,
length: 128 length: 128,
}) })
name: string; name: string;
@Column({ @Column({
nullable: false, nullable: false,
type: 'jsonb' type: "jsonb",
}) })
roles: string[]; roles: string[];
@Column({ @Column({
nullable: false, nullable: false,
length: 64 length: 64,
}) })
status: Status; status: Status;
@ -36,11 +36,20 @@ export class UserRole {
@CreateDateColumn() @CreateDateColumn()
created_at: Date; created_at: Date;
@Column({ nullable: true, length: 256 })
created_by: string;
@Column({ nullable: true }) @Column({ nullable: true })
@UpdateDateColumn() @UpdateDateColumn()
updated_at: Date; updated_at: Date;
@Column({ nullable: true, length: 256 })
updated_by: string;
@Column({ nullable: true }) @Column({ nullable: true })
@DeleteDateColumn() @DeleteDateColumn()
deleted_at: Date; deleted_at: Date;
@Column({ nullable: true, length: 256 })
deleted_by: string;
} }