Impersination backend
This commit is contained in:
22
api/src/model/entitites/impersination.entity.ts
Normal file
22
api/src/model/entitites/impersination.entity.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import { Entity, PrimaryGeneratedColumn, ManyToOne, JoinColumn, Column } from "typeorm";
|
||||
import { User } from "./user/user.entity";
|
||||
|
||||
@Entity()
|
||||
export class Impersonation {
|
||||
@PrimaryGeneratedColumn('uuid')
|
||||
id: string;
|
||||
|
||||
@ManyToOne(() => User, { nullable: false, eager: true })
|
||||
@JoinColumn({ name: 'fromUserId' })
|
||||
fromUser: User;
|
||||
|
||||
@ManyToOne(() => User, { nullable: false, eager: true })
|
||||
@JoinColumn({ name: 'toUserId' })
|
||||
toUser: User;
|
||||
|
||||
@Column({ type: 'datetime', default: () => 'CURRENT_TIMESTAMP' })
|
||||
startedAt: Date;
|
||||
|
||||
@Column({ type: 'datetime', nullable: true })
|
||||
endedAt?: Date;
|
||||
}
|
||||
11
api/src/model/repositories/impersination.repository.ts
Normal file
11
api/src/model/repositories/impersination.repository.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { Repository, DataSource } from 'typeorm';
|
||||
import { Impersonation } from '../entitites/impersination.entity';
|
||||
|
||||
@Injectable()
|
||||
export class ImpersonationRepository extends Repository<Impersonation> {
|
||||
constructor(dataSource: DataSource) {
|
||||
super(Impersonation, dataSource.createEntityManager());
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user