74 lines
1.4 KiB
TypeScript
74 lines
1.4 KiB
TypeScript
import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, Index, JoinColumn, ManyToOne } from 'typeorm';
|
|
|
|
import { ActivityType } from '../types/action';
|
|
import { Application } from './application';
|
|
import { User } from './users';
|
|
|
|
@Entity('user_activities')
|
|
export class UserActivity {
|
|
@PrimaryGeneratedColumn('uuid')
|
|
id: string;
|
|
|
|
@ManyToOne(() => Application, { onDelete: "RESTRICT" })
|
|
@JoinColumn({ name: 'application' })
|
|
application: Application
|
|
|
|
@ManyToOne(() => User, (user) => user.id, { nullable: true })
|
|
// @JoinColumn({ name: 'id_user' })
|
|
@JoinColumn()
|
|
user: User;
|
|
|
|
@Column({
|
|
type: 'uuid'
|
|
})
|
|
id_user: string;
|
|
|
|
@Index()
|
|
@Column({
|
|
type: 'uuid'
|
|
})
|
|
refresh_token: string;
|
|
|
|
@Index()
|
|
@Column({
|
|
nullable: false,
|
|
length: 512
|
|
})
|
|
module: string;
|
|
|
|
@Column({
|
|
nullable: false,
|
|
length: 2048
|
|
})
|
|
description: string;
|
|
|
|
@Column({
|
|
nullable: true,
|
|
length: 1
|
|
})
|
|
action: ActivityType;
|
|
|
|
@Column({
|
|
nullable: false,
|
|
length: 2048,
|
|
})
|
|
url: String;
|
|
|
|
@Column({
|
|
type: 'text',
|
|
nullable: true,
|
|
})
|
|
data_body: String;
|
|
|
|
@Column()
|
|
@CreateDateColumn()
|
|
created_at: Date;
|
|
|
|
@Column({ nullable: true })
|
|
@UpdateDateColumn()
|
|
updated_at: Date;
|
|
|
|
@Column({ nullable: true })
|
|
@DeleteDateColumn()
|
|
deleted_at: Date;
|
|
} |