aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/actor/sql/shared/actor-follow-table-attributes.ts
blob: 7dd908ece9b12bab51f41bbb7fe5879ab753b9e3 (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
29
30
31
import { logger } from '@server/helpers/logger'
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 () {
    logger.error('coucou')

    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(', ')
  }
}