forked from Shared/esg
45 lines
955 B
TypeScript
45 lines
955 B
TypeScript
import { Column, CreateDateColumn, Entity, Index, PrimaryGeneratedColumn } from 'typeorm';
|
|
|
|
/** OAuth tokens for outbound provider APIs — credentials stay in env, not stored here. */
|
|
@Entity('general_tokens')
|
|
@Index(['serviceProvider', 'createdAt'])
|
|
export class GeneralToken {
|
|
@PrimaryGeneratedColumn('uuid')
|
|
id!: string;
|
|
|
|
@Index()
|
|
@Column({ type: 'text' })
|
|
serviceProvider!: string;
|
|
|
|
@Column({ type: 'text' })
|
|
tokenType!: string;
|
|
|
|
@Column({ type: 'text' })
|
|
url!: string;
|
|
|
|
@Column({ type: 'text' })
|
|
clientId!: string;
|
|
|
|
@Column({ type: 'text' })
|
|
username!: string;
|
|
|
|
@Column({ type: 'text' })
|
|
scope!: string;
|
|
|
|
@Column({ type: 'text' })
|
|
accessToken!: string;
|
|
|
|
@Column({ type: 'text', nullable: true })
|
|
refreshToken?: string | null;
|
|
|
|
@Column({ type: 'int' })
|
|
expiresIn!: number;
|
|
|
|
@Index()
|
|
@Column({ type: 'timestamptz' })
|
|
expiresAt!: Date;
|
|
|
|
@CreateDateColumn({ type: 'timestamptz' })
|
|
createdAt!: Date;
|
|
}
|