PeerTube/server/models/video/sql/comment/video-comment-table-attribu...

44 lines
1.2 KiB
TypeScript
Raw Normal View History

2023-01-09 10:29:23 +01:00
import { Memoize } from '@server/helpers/memoize'
import { AccountModel } from '@server/models/account/account'
import { ActorModel } from '@server/models/actor/actor'
import { ActorImageModel } from '@server/models/actor/actor-image'
import { ServerModel } from '@server/models/server/server'
import { VideoCommentModel } from '../../video-comment'
2023-01-05 15:31:51 +01:00
export class VideoCommentTableAttributes {
2023-01-09 10:29:23 +01:00
@Memoize()
2023-01-05 15:31:51 +01:00
getVideoCommentAttributes () {
2023-01-09 10:29:23 +01:00
return VideoCommentModel.getSQLAttributes('VideoCommentModel').join(', ')
2023-01-05 15:31:51 +01:00
}
2023-01-09 10:29:23 +01:00
@Memoize()
2023-01-05 15:31:51 +01:00
getAccountAttributes () {
2023-01-09 10:29:23 +01:00
return AccountModel.getSQLAttributes('Account', 'Account.').join(', ')
2023-01-05 15:31:51 +01:00
}
2023-01-09 10:29:23 +01:00
@Memoize()
2023-01-05 15:31:51 +01:00
getVideoAttributes () {
return [
`"Video"."id" AS "Video.id"`,
`"Video"."uuid" AS "Video.uuid"`,
`"Video"."name" AS "Video.name"`
].join(', ')
}
2023-01-09 10:29:23 +01:00
@Memoize()
2023-01-05 15:31:51 +01:00
getActorAttributes () {
2023-01-09 10:29:23 +01:00
return ActorModel.getSQLAPIAttributes('Account->Actor', `Account.Actor.`).join(', ')
2023-01-05 15:31:51 +01:00
}
2023-01-09 10:29:23 +01:00
@Memoize()
2023-01-05 15:31:51 +01:00
getServerAttributes () {
2023-01-09 10:29:23 +01:00
return ServerModel.getSQLAttributes('Account->Actor->Server', `Account.Actor.Server.`).join(', ')
2023-01-05 15:31:51 +01:00
}
2023-01-09 10:29:23 +01:00
@Memoize()
2023-01-05 15:31:51 +01:00
getAvatarAttributes () {
2023-01-10 09:16:33 +01:00
return ActorImageModel.getSQLAttributes('Account->Actor->Avatars', 'Account.Actor.Avatars.').join(', ')
2023-01-05 15:31:51 +01:00
}
}