2022-03-09 18:37:04 +00:00
|
|
|
import {
|
|
|
|
Column,
|
|
|
|
CreateDateColumn,
|
|
|
|
Entity,
|
2022-03-16 18:37:50 +00:00
|
|
|
ManyToOne,
|
2022-03-09 18:37:04 +00:00
|
|
|
OneToMany,
|
|
|
|
OneToOne,
|
|
|
|
PrimaryGeneratedColumn,
|
|
|
|
UpdateDateColumn,
|
|
|
|
} from 'typeorm';
|
|
|
|
import { Upload } from '../upload/upload.entity';
|
|
|
|
import { User } from '../user/user.entity';
|
|
|
|
import { OAuth2ClientURL } from './oauth2-client-url.entity';
|
|
|
|
|
|
|
|
@Entity()
|
|
|
|
export class OAuth2Client {
|
|
|
|
@PrimaryGeneratedColumn()
|
|
|
|
id: number;
|
|
|
|
|
|
|
|
@Column({ type: 'uuid', length: 36, nullable: false, unique: true })
|
|
|
|
client_id: string;
|
|
|
|
|
|
|
|
@Column({ type: 'text', nullable: false })
|
|
|
|
client_secret: string;
|
|
|
|
|
|
|
|
@Column({ nullable: false })
|
|
|
|
title: string;
|
|
|
|
|
|
|
|
@Column({ type: 'text', nullable: true })
|
|
|
|
description: string;
|
|
|
|
|
|
|
|
@Column({ type: 'text', nullable: true })
|
|
|
|
scope: string;
|
|
|
|
|
|
|
|
@Column({ type: 'text', default: 'authorization_code' })
|
|
|
|
grants: string;
|
|
|
|
|
|
|
|
@Column({ default: false })
|
|
|
|
activated: boolean;
|
|
|
|
|
|
|
|
@Column({ default: false })
|
|
|
|
verified: boolean;
|
|
|
|
|
|
|
|
@CreateDateColumn({
|
|
|
|
type: 'timestamp',
|
|
|
|
default: () => 'CURRENT_TIMESTAMP(6)',
|
|
|
|
})
|
|
|
|
public created_at: Date;
|
|
|
|
|
|
|
|
@UpdateDateColumn({
|
|
|
|
type: 'timestamp',
|
|
|
|
default: () => 'CURRENT_TIMESTAMP(6)',
|
|
|
|
onUpdate: 'CURRENT_TIMESTAMP(6)',
|
|
|
|
})
|
|
|
|
public updated_at: Date;
|
|
|
|
|
2022-03-16 18:37:50 +00:00
|
|
|
@ManyToOne(() => Upload, { nullable: true, onDelete: 'SET NULL' })
|
2022-03-09 18:37:04 +00:00
|
|
|
public picture: Upload;
|
|
|
|
|
2022-03-16 18:37:50 +00:00
|
|
|
@ManyToOne(() => User, { nullable: true, onDelete: 'SET NULL' })
|
2022-03-09 18:37:04 +00:00
|
|
|
public owner: User;
|
|
|
|
|
|
|
|
@OneToMany(() => OAuth2ClientURL, (url) => url.client)
|
|
|
|
public urls: OAuth2ClientURL[];
|
|
|
|
}
|