使用sqlite替换nedb

This commit is contained in:
whyour
2022-01-06 22:51:12 +08:00
parent 653b1cef20
commit 5d19ee0ab5
38 changed files with 1040 additions and 856 deletions
+15 -3
View File
@@ -1,23 +1,26 @@
import { sequelize } from '.';
import { DataTypes, Model, ModelDefined } from 'sequelize';
export class App {
name: string;
scopes: AppScope[];
client_id: string;
client_secret: string;
tokens?: AppToken[];
_id?: string;
id?: number;
constructor(options: App) {
this.name = options.name;
this.scopes = options.scopes;
this.client_id = options.client_id;
this.client_secret = options.client_secret;
this._id = options._id;
this.id = options.id;
}
}
export interface AppToken {
value: string;
type: 'Bearer';
type?: 'Bearer';
expiration: number;
}
@@ -29,3 +32,12 @@ export enum CrontabStatus {
'disabled',
'queued',
}
interface AppInstance extends Model<App, App>, App {}
export const AppModel = sequelize.define<AppInstance>('App', {
name: DataTypes.STRING,
scopes: DataTypes.JSON,
client_id: DataTypes.STRING,
client_secret: DataTypes.STRING,
tokens: DataTypes.JSON,
});