From 6be127e18bdbea6031698baeb8632f917a8346eb Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 28 Mar 2020 11:24:37 +0900 Subject: Implement MiAuth --- src/models/entities/access-token.ts | 54 +++++++++++++++++++++++++++++++++++-- 1 file changed, 52 insertions(+), 2 deletions(-) (limited to 'src/models') diff --git a/src/models/entities/access-token.ts b/src/models/entities/access-token.ts index 137bf1444d..5f41b3c1fc 100644 --- a/src/models/entities/access-token.ts +++ b/src/models/entities/access-token.ts @@ -13,12 +13,26 @@ export class AccessToken { }) public createdAt: Date; + @Column('timestamp with time zone', { + nullable: true, + default: null, + }) + public lastUsedAt: Date | null; + @Index() @Column('varchar', { length: 128 }) public token: string; + @Index() + @Column('varchar', { + length: 128, + nullable: true, + default: null + }) + public session: string | null; + @Index() @Column('varchar', { length: 128 @@ -35,12 +49,48 @@ export class AccessToken { @JoinColumn() public user: User | null; - @Column(id()) - public appId: App['id']; + @Column({ + ...id(), + nullable: true, + default: null + }) + public appId: App['id'] | null; @ManyToOne(type => App, { onDelete: 'CASCADE' }) @JoinColumn() public app: App | null; + + @Column('varchar', { + length: 128, + nullable: true, + default: null + }) + public name: string | null; + + @Column('varchar', { + length: 512, + nullable: true, + default: null + }) + public description: string | null; + + @Column('varchar', { + length: 512, + nullable: true, + default: null + }) + public iconUrl: string | null; + + @Column('varchar', { + length: 64, array: true, + default: '{}' + }) + public permission: string[]; + + @Column('boolean', { + default: false + }) + public fetched: boolean; } -- cgit v1.2.3-freya