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

44 lines
1.2 KiB
TypeScript
Raw Normal View History

2023-01-09 03:29:23 -06: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 08:31:51 -06:00
export class VideoCommentTableAttributes {
2023-01-09 03:29:23 -06:00
@Memoize()
2023-01-05 08:31:51 -06:00
getVideoCommentAttributes () {
2023-01-09 03:29:23 -06:00
return VideoCommentModel.getSQLAttributes('VideoCommentModel').join(', ')
2023-01-05 08:31:51 -06:00
}
2023-01-09 03:29:23 -06:00
@Memoize()
2023-01-05 08:31:51 -06:00
getAccountAttributes () {
2023-01-09 03:29:23 -06:00
return AccountModel.getSQLAttributes('Account', 'Account.').join(', ')
2023-01-05 08:31:51 -06:00
}
2023-01-09 03:29:23 -06:00
@Memoize()
2023-01-05 08:31:51 -06:00
getVideoAttributes () {
return [
`"Video"."id" AS "Video.id"`,
`"Video"."uuid" AS "Video.uuid"`,
`"Video"."name" AS "Video.name"`
].join(', ')
}
2023-01-09 03:29:23 -06:00
@Memoize()
2023-01-05 08:31:51 -06:00
getActorAttributes () {
2023-01-09 03:29:23 -06:00
return ActorModel.getSQLAPIAttributes('Account->Actor', `Account.Actor.`).join(', ')
2023-01-05 08:31:51 -06:00
}
2023-01-09 03:29:23 -06:00
@Memoize()
2023-01-05 08:31:51 -06:00
getServerAttributes () {
2023-01-09 03:29:23 -06:00
return ServerModel.getSQLAttributes('Account->Actor->Server', `Account.Actor.Server.`).join(', ')
2023-01-05 08:31:51 -06:00
}
2023-01-09 03:29:23 -06:00
@Memoize()
2023-01-05 08:31:51 -06:00
getAvatarAttributes () {
2023-01-10 02:16:33 -06:00
return ActorImageModel.getSQLAttributes('Account->Actor->Avatars', 'Account.Actor.Avatars.').join(', ')
2023-01-05 08:31:51 -06:00
}
}