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