aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/actor/sql/shared/actor-follow-table-attributes.ts
blob: 156b37d44d56d77f7cdf68d8166c3d0307076b3e (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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
export class ActorFollowTableAttributes {

  getFollowAttributes () {
    return [
      '"ActorFollowModel"."id"',
      '"ActorFollowModel"."state"',
      '"ActorFollowModel"."score"',
      '"ActorFollowModel"."url"',
      '"ActorFollowModel"."actorId"',
      '"ActorFollowModel"."targetActorId"',
      '"ActorFollowModel"."createdAt"',
      '"ActorFollowModel"."updatedAt"'
    ].join(', ')
  }

  getActorAttributes (actorTableName: string) {
    return [
      `"${actorTableName}"."id" AS "${actorTableName}.id"`,
      `"${actorTableName}"."type" AS "${actorTableName}.type"`,
      `"${actorTableName}"."preferredUsername" AS "${actorTableName}.preferredUsername"`,
      `"${actorTableName}"."url" AS "${actorTableName}.url"`,
      `"${actorTableName}"."publicKey" AS "${actorTableName}.publicKey"`,
      `"${actorTableName}"."privateKey" AS "${actorTableName}.privateKey"`,
      `"${actorTableName}"."followersCount" AS "${actorTableName}.followersCount"`,
      `"${actorTableName}"."followingCount" AS "${actorTableName}.followingCount"`,
      `"${actorTableName}"."inboxUrl" AS "${actorTableName}.inboxUrl"`,
      `"${actorTableName}"."outboxUrl" AS "${actorTableName}.outboxUrl"`,
      `"${actorTableName}"."sharedInboxUrl" AS "${actorTableName}.sharedInboxUrl"`,
      `"${actorTableName}"."followersUrl" AS "${actorTableName}.followersUrl"`,
      `"${actorTableName}"."followingUrl" AS "${actorTableName}.followingUrl"`,
      `"${actorTableName}"."remoteCreatedAt" AS "${actorTableName}.remoteCreatedAt"`,
      `"${actorTableName}"."serverId" AS "${actorTableName}.serverId"`,
      `"${actorTableName}"."createdAt" AS "${actorTableName}.createdAt"`,
      `"${actorTableName}"."updatedAt" AS "${actorTableName}.updatedAt"`
    ].join(', ')
  }

  getServerAttributes (actorTableName: string) {
    return [
      `"${actorTableName}->Server"."id" AS "${actorTableName}.Server.id"`,
      `"${actorTableName}->Server"."host" AS "${actorTableName}.Server.host"`,
      `"${actorTableName}->Server"."redundancyAllowed" AS "${actorTableName}.Server.redundancyAllowed"`,
      `"${actorTableName}->Server"."createdAt" AS "${actorTableName}.Server.createdAt"`,
      `"${actorTableName}->Server"."updatedAt" AS "${actorTableName}.Server.updatedAt"`
    ].join(', ')
  }

  getAvatarAttributes (actorTableName: string) {
    return [
      `"${actorTableName}->Avatars"."id" AS "${actorTableName}.Avatars.id"`,
      `"${actorTableName}->Avatars"."filename" AS "${actorTableName}.Avatars.filename"`,
      `"${actorTableName}->Avatars"."height" AS "${actorTableName}.Avatars.height"`,
      `"${actorTableName}->Avatars"."width" AS "${actorTableName}.Avatars.width"`,
      `"${actorTableName}->Avatars"."fileUrl" AS "${actorTableName}.Avatars.fileUrl"`,
      `"${actorTableName}->Avatars"."onDisk" AS "${actorTableName}.Avatars.onDisk"`,
      `"${actorTableName}->Avatars"."type" AS "${actorTableName}.Avatars.type"`,
      `"${actorTableName}->Avatars"."actorId" AS "${actorTableName}.Avatars.actorId"`,
      `"${actorTableName}->Avatars"."createdAt" AS "${actorTableName}.Avatars.createdAt"`,
      `"${actorTableName}->Avatars"."updatedAt" AS "${actorTableName}.Avatars.updatedAt"`
    ].join(', ')
  }
}