aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/actor/sql/shared/actor-follow-table-attributes.ts
blob: 4431aa6d1cdcb63281c56cbf3bf4aef20cfbb4c8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import { Memoize } from '@server/helpers/memoize'
import { ServerModel } from '@server/models/server/server'
import { ActorModel } from '../../actor'
import { ActorFollowModel } from '../../actor-follow'
import { ActorImageModel } from '../../actor-image'

export class ActorFollowTableAttributes {

  @Memoize()
  getFollowAttributes () {
    return ActorFollowModel.getSQLAttributes('ActorFollowModel').join(', ')
  }

  @Memoize()
  getActorAttributes (actorTableName: string) {
    return ActorModel.getSQLAttributes(actorTableName, `${actorTableName}.`).join(', ')
  }

  @Memoize()
  getServerAttributes (actorTableName: string) {
    return ServerModel.getSQLAttributes(`${actorTableName}->Server`, `${actorTableName}.Server.`).join(', ')
  }

  @Memoize()
  getAvatarAttributes (actorTableName: string) {
    return ActorImageModel.getSQLAttributes(`${actorTableName}->Avatars`, `${actorTableName}.Avatars.`).join(', ')
  }
}