diff options
author | Chocobozzz <me@florianbigard.com> | 2023-01-09 10:29:23 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2023-01-09 10:29:23 +0100 |
commit | eb66ee88351a93eb68c366cfbe30d35ed7c57b03 (patch) | |
tree | fb2ebb3b5accbbf06438709ae7e222f7ea7c9ffd /server/models/video/video-comment.ts | |
parent | 0a8a79552cf59c800011c9f63eaa8658230acddc (diff) | |
download | PeerTube-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.ts | 14 |
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 { | |||
40 | import { VideoCommentAbuseModel } from '../abuse/video-comment-abuse' | 40 | import { VideoCommentAbuseModel } from '../abuse/video-comment-abuse' |
41 | import { AccountModel } from '../account/account' | 41 | import { AccountModel } from '../account/account' |
42 | import { ActorModel } from '../actor/actor' | 42 | import { ActorModel } from '../actor/actor' |
43 | import { buildLocalAccountIdsIn, throwIfNotValid } from '../utils' | 43 | import { buildLocalAccountIdsIn, buildSQLAttributes, throwIfNotValid } from '../utils' |
44 | import { ListVideoCommentsOptions, VideoCommentListQueryBuilder } from './sql/comment/video-comment-list-query-builder' | 44 | import { ListVideoCommentsOptions, VideoCommentListQueryBuilder } from './sql/comment/video-comment-list-query-builder' |
45 | import { VideoModel } from './video' | 45 | import { VideoModel } from './video' |
46 | import { VideoChannelModel } from './video-channel' | 46 | import { 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: { |