diff options
| author | syuilo <Syuilotan@yahoo.co.jp> | 2022-09-18 03:27:08 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-09-18 03:27:08 +0900 |
| commit | b75184ec8e3436200bacdcd832e3324702553d20 (patch) | |
| tree | 8b7e316f29e95df921db57289c8b8da476d18f07 /packages/backend/src/models/entities/AccessToken.ts | |
| parent | Update ROADMAP.md (diff) | |
| download | sharkey-b75184ec8e3436200bacdcd832e3324702553d20.tar.gz sharkey-b75184ec8e3436200bacdcd832e3324702553d20.tar.bz2 sharkey-b75184ec8e3436200bacdcd832e3324702553d20.zip | |
なんかもうめっちゃ変えた
Diffstat (limited to 'packages/backend/src/models/entities/AccessToken.ts')
| -rw-r--r-- | packages/backend/src/models/entities/AccessToken.ts | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/packages/backend/src/models/entities/AccessToken.ts b/packages/backend/src/models/entities/AccessToken.ts new file mode 100644 index 0000000000..8e987ffeef --- /dev/null +++ b/packages/backend/src/models/entities/AccessToken.ts @@ -0,0 +1,90 @@ +import { Entity, PrimaryColumn, Index, Column, ManyToOne, JoinColumn } from 'typeorm'; +import { id } from '../id.js'; +import { User } from './User.js'; +import { App } from './App.js'; + +@Entity() +export class AccessToken { + @PrimaryColumn(id()) + public id: string; + + @Column('timestamp with time zone', { + comment: 'The created date of the AccessToken.', + }) + public createdAt: Date; + + @Column('timestamp with time zone', { + nullable: true, + }) + public lastUsedAt: Date | null; + + @Index() + @Column('varchar', { + length: 128, + }) + public token: string; + + @Index() + @Column('varchar', { + length: 128, + nullable: true, + }) + public session: string | null; + + @Index() + @Column('varchar', { + length: 128, + }) + public hash: string; + + @Index() + @Column(id()) + public userId: User['id']; + + @ManyToOne(type => User, { + onDelete: 'CASCADE', + }) + @JoinColumn() + public user: User | null; + + @Column({ + ...id(), + nullable: true, + }) + public appId: App['id'] | null; + + @ManyToOne(type => App, { + onDelete: 'CASCADE', + }) + @JoinColumn() + public app: App | null; + + @Column('varchar', { + length: 128, + nullable: true, + }) + public name: string | null; + + @Column('varchar', { + length: 512, + nullable: true, + }) + public description: string | null; + + @Column('varchar', { + length: 512, + nullable: true, + }) + public iconUrl: string | null; + + @Column('varchar', { + length: 64, array: true, + default: '{}', + }) + public permission: string[]; + + @Column('boolean', { + default: false, + }) + public fetched: boolean; +} |