1 import { AllowNull, Column, Default, DefaultScope, HasOne, IsInt, Model, Table } from 'sequelize-typescript'
2 import { AccountModel } from '../account/account'
3 import * as memoizee from 'memoizee'
5 export const getServerActor = memoizee(async function () {
6 const application = await ApplicationModel.load()
7 if (!application) throw Error('Could not load Application from database.')
9 const actor = application.Account.Actor
10 actor.Account = application.Account
15 @DefaultScope(() => ({
24 tableName: 'application',
27 export class ApplicationModel extends Model<ApplicationModel> {
33 migrationVersion: number
35 @HasOne(() => AccountModel, {
43 static countTotal () {
44 return ApplicationModel.count()
48 return ApplicationModel.findOne()