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