2024-03-20 22:02:51 +01:00
|
|
|
import { UserEntity } from 'src/entities/user.entity';
|
2023-01-02 21:22:33 +01:00
|
|
|
import { Column, CreateDateColumn, Entity, ManyToOne, PrimaryGeneratedColumn, UpdateDateColumn } from 'typeorm';
|
|
|
|
|
|
|
|
@Entity('api_keys')
|
|
|
|
export class APIKeyEntity {
|
2023-02-18 21:58:55 +01:00
|
|
|
@PrimaryGeneratedColumn('uuid')
|
|
|
|
id!: string;
|
2023-01-02 21:22:33 +01:00
|
|
|
|
|
|
|
@Column()
|
|
|
|
name!: string;
|
|
|
|
|
|
|
|
@Column({ select: false })
|
|
|
|
key?: string;
|
|
|
|
|
2023-05-23 22:40:04 +02:00
|
|
|
@ManyToOne(() => UserEntity, { onUpdate: 'CASCADE', onDelete: 'CASCADE' })
|
2023-01-02 21:22:33 +01:00
|
|
|
user?: UserEntity;
|
|
|
|
|
2023-02-18 21:58:55 +01:00
|
|
|
@Column()
|
|
|
|
userId!: string;
|
|
|
|
|
2023-01-02 21:22:33 +01:00
|
|
|
@CreateDateColumn({ type: 'timestamptz' })
|
2023-05-30 15:15:56 +02:00
|
|
|
createdAt!: Date;
|
2023-01-02 21:22:33 +01:00
|
|
|
|
|
|
|
@UpdateDateColumn({ type: 'timestamptz' })
|
2023-05-30 15:15:56 +02:00
|
|
|
updatedAt!: Date;
|
2023-01-02 21:22:33 +01:00
|
|
|
}
|