59 lines
1.3 KiB
TypeScript
59 lines
1.3 KiB
TypeScript
import {
|
|
Column,
|
|
CreateDateColumn,
|
|
Entity,
|
|
ManyToOne,
|
|
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()
|
|
public created_at: Date;
|
|
|
|
@UpdateDateColumn()
|
|
public updated_at: Date;
|
|
|
|
@ManyToOne(() => Upload, { nullable: true, onDelete: 'SET NULL' })
|
|
public picture: Upload;
|
|
|
|
@ManyToOne(() => User, { nullable: true, onDelete: 'SET NULL' })
|
|
public owner: User;
|
|
|
|
@OneToMany(() => OAuth2ClientURL, (url) => url.client)
|
|
public urls: OAuth2ClientURL[];
|
|
}
|