1 import { AllowNull, BelongsTo, Column, CreatedAt, DataType, ForeignKey, Model, Table, UpdatedAt } from 'sequelize-typescript'
2 import { CustomPage } from '@shared/models'
3 import { ActorModel } from '../actor/actor'
4 import { getServerActor } from '../application/application'
7 tableName: 'actorCustomPage',
10 fields: [ 'actorId', 'type' ],
15 export class ActorCustomPageModel extends Model {
18 @Column(DataType.TEXT)
31 @ForeignKey(() => ActorModel)
35 @BelongsTo(() => ActorModel, {
44 static async updateInstanceHomepage (content: string) {
45 const serverActor = await getServerActor()
47 return ActorCustomPageModel.upsert({
49 actorId: serverActor.id,
54 static async loadInstanceHomepage () {
55 const serverActor = await getServerActor()
57 return ActorCustomPageModel.findOne({
59 actorId: serverActor.id
64 toFormattedJSON (): CustomPage {