aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/video/video-comment.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2023-01-09 10:29:23 +0100
committerChocobozzz <me@florianbigard.com>2023-01-09 10:29:23 +0100
commiteb66ee88351a93eb68c366cfbe30d35ed7c57b03 (patch)
treefb2ebb3b5accbbf06438709ae7e222f7ea7c9ffd /server/models/video/video-comment.ts
parent0a8a79552cf59c800011c9f63eaa8658230acddc (diff)
downloadPeerTube-eb66ee88351a93eb68c366cfbe30d35ed7c57b03.tar.gz
PeerTube-eb66ee88351a93eb68c366cfbe30d35ed7c57b03.tar.zst
PeerTube-eb66ee88351a93eb68c366cfbe30d35ed7c57b03.zip
Refactor table attributes
Diffstat (limited to 'server/models/video/video-comment.ts')
-rw-r--r--server/models/video/video-comment.ts14
1 files changed, 13 insertions, 1 deletions
diff --git a/server/models/video/video-comment.ts b/server/models/video/video-comment.ts
index fb9d15e55..28a3d723d 100644
--- a/server/models/video/video-comment.ts
+++ b/server/models/video/video-comment.ts
@@ -40,7 +40,7 @@ import {
40import { VideoCommentAbuseModel } from '../abuse/video-comment-abuse' 40import { VideoCommentAbuseModel } from '../abuse/video-comment-abuse'
41import { AccountModel } from '../account/account' 41import { AccountModel } from '../account/account'
42import { ActorModel } from '../actor/actor' 42import { ActorModel } from '../actor/actor'
43import { buildLocalAccountIdsIn, throwIfNotValid } from '../utils' 43import { buildLocalAccountIdsIn, buildSQLAttributes, throwIfNotValid } from '../utils'
44import { ListVideoCommentsOptions, VideoCommentListQueryBuilder } from './sql/comment/video-comment-list-query-builder' 44import { ListVideoCommentsOptions, VideoCommentListQueryBuilder } from './sql/comment/video-comment-list-query-builder'
45import { VideoModel } from './video' 45import { VideoModel } from './video'
46import { VideoChannelModel } from './video-channel' 46import { VideoChannelModel } from './video-channel'
@@ -192,6 +192,18 @@ export class VideoCommentModel extends Model<Partial<AttributesOnly<VideoComment
192 }) 192 })
193 CommentAbuses: VideoCommentAbuseModel[] 193 CommentAbuses: VideoCommentAbuseModel[]
194 194
195 // ---------------------------------------------------------------------------
196
197 static getSQLAttributes (tableName: string, aliasPrefix = '') {
198 return buildSQLAttributes({
199 model: this,
200 tableName,
201 aliasPrefix
202 })
203 }
204
205 // ---------------------------------------------------------------------------
206
195 static loadById (id: number, t?: Transaction): Promise<MComment> { 207 static loadById (id: number, t?: Transaction): Promise<MComment> {
196 const query: FindOptions = { 208 const query: FindOptions = {
197 where: { 209 where: {