]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - server/models/actor/sql/shared/actor-follow-table-attributes.ts
4431aa6d1cdcb63281c56cbf3bf4aef20cfbb4c8
[github/Chocobozzz/PeerTube.git] / server / models / actor / sql / shared / actor-follow-table-attributes.ts
1 import { Memoize } from '@server/helpers/memoize'
2 import { ServerModel } from '@server/models/server/server'
3 import { ActorModel } from '../../actor'
4 import { ActorFollowModel } from '../../actor-follow'
5 import { ActorImageModel } from '../../actor-image'
6
7 export class ActorFollowTableAttributes {
8
9 @Memoize()
10 getFollowAttributes () {
11 return ActorFollowModel.getSQLAttributes('ActorFollowModel').join(', ')
12 }
13
14 @Memoize()
15 getActorAttributes (actorTableName: string) {
16 return ActorModel.getSQLAttributes(actorTableName, `${actorTableName}.`).join(', ')
17 }
18
19 @Memoize()
20 getServerAttributes (actorTableName: string) {
21 return ServerModel.getSQLAttributes(`${actorTableName}->Server`, `${actorTableName}.Server.`).join(', ')
22 }
23
24 @Memoize()
25 getAvatarAttributes (actorTableName: string) {
26 return ActorImageModel.getSQLAttributes(`${actorTableName}->Avatars`, `${actorTableName}.Avatars.`).join(', ')
27 }
28 }