1
0
mirror of https://github.com/h3poteto/whalebird-desktop synced 2024-12-27 01:05:21 +01:00
Whalebird-desktop-client-ma.../renderer/db.ts
2023-11-02 01:20:27 +09:00

31 lines
765 B
TypeScript

import Dexie, { type Table } from 'dexie'
export type Account = {
id?: number
username: string
account_id: string
avatar: string
client_id: string
client_secret: string
access_token: string
refresh_token: string | null
url: string
domain: string
sns: 'mastodon' | 'pleroma' | 'friendica' | 'firefish'
}
export class SubClassedDexie extends Dexie {
// 'friends' is added by dexie when declaring the stores()
// We just tell the typing system this is the case
accounts!: Table<Account>
constructor() {
super('whalebird')
this.version(1).stores({
accounts: '++id, username, account_id, avatar, client_id, client_secret, access_token, refresh_token, url, domain, sns'
})
}
}
export const db = new SubClassedDexie()