31 lines
650 B
TypeScript
31 lines
650 B
TypeScript
import {
|
|
Column,
|
|
CreateDateColumn,
|
|
Entity,
|
|
ManyToOne,
|
|
PrimaryGeneratedColumn,
|
|
} from 'typeorm';
|
|
import { User } from '../user/user.entity';
|
|
import { OAuth2Client } from './oauth2-client.entity';
|
|
|
|
@Entity()
|
|
export class OAuth2ClientAuthorization {
|
|
@PrimaryGeneratedColumn()
|
|
public id: number;
|
|
|
|
@Column({ type: 'text', nullable: true })
|
|
public scope: string;
|
|
|
|
@Column({ type: 'timestamp' })
|
|
public expires_at: Date;
|
|
|
|
@CreateDateColumn()
|
|
public created_at: Date;
|
|
|
|
@ManyToOne(() => OAuth2Client, { onDelete: 'CASCADE' })
|
|
public client: OAuth2Client;
|
|
|
|
@ManyToOne(() => User, { onDelete: 'CASCADE' })
|
|
public user: User;
|
|
}
|