45 lines
942 B
TypeScript
45 lines
942 B
TypeScript
|
import {
|
||
|
Column,
|
||
|
CreateDateColumn,
|
||
|
Entity,
|
||
|
ManyToOne,
|
||
|
PrimaryGeneratedColumn,
|
||
|
UpdateDateColumn,
|
||
|
} from 'typeorm';
|
||
|
import { OAuth2Client } from './oauth2-client.entity';
|
||
|
|
||
|
export enum OAuth2ClientURLType {
|
||
|
REDIRECT_URI = 'redirect_uri',
|
||
|
TERMS = 'terms',
|
||
|
PRIVACY = 'privacy',
|
||
|
WEBSITE = 'website',
|
||
|
}
|
||
|
|
||
|
@Entity()
|
||
|
export class OAuth2ClientURL {
|
||
|
@PrimaryGeneratedColumn()
|
||
|
public id: number;
|
||
|
|
||
|
@Column({ nullable: false })
|
||
|
public url: string;
|
||
|
|
||
|
@Column({ type: 'enum', enum: OAuth2ClientURLType, nullable: false })
|
||
|
public type: OAuth2ClientURLType;
|
||
|
|
||
|
@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;
|
||
|
|
||
|
@ManyToOne(() => OAuth2Client, (client) => client.urls)
|
||
|
public client: OAuth2Client;
|
||
|
}
|