aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/video/video-comment.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-12-08 14:30:29 +0100
committerChocobozzz <chocobozzz@cpy.re>2020-12-09 11:41:22 +0100
commitb49f22d8f9a52ab75fd38db2d377249eb58fa678 (patch)
treea2825877d7b3b53454804a79c9d2a14c5d37385c /server/models/video/video-comment.ts
parent6c8c15f914cd375da1db5d0cd4d924a86c53d4c1 (diff)
downloadPeerTube-b49f22d8f9a52ab75fd38db2d377249eb58fa678.tar.gz
PeerTube-b49f22d8f9a52ab75fd38db2d377249eb58fa678.tar.zst
PeerTube-b49f22d8f9a52ab75fd38db2d377249eb58fa678.zip
Upgrade sequelize to v6
Diffstat (limited to 'server/models/video/video-comment.ts')
-rw-r--r--server/models/video/video-comment.ts13
1 files changed, 6 insertions, 7 deletions
diff --git a/server/models/video/video-comment.ts b/server/models/video/video-comment.ts
index ed4a345eb..8d1c38826 100644
--- a/server/models/video/video-comment.ts
+++ b/server/models/video/video-comment.ts
@@ -1,4 +1,3 @@
1import * as Bluebird from 'bluebird'
2import { uniq } from 'lodash' 1import { uniq } from 'lodash'
3import { FindAndCountOptions, FindOptions, Op, Order, ScopeOptions, Sequelize, Transaction, WhereOptions } from 'sequelize' 2import { FindAndCountOptions, FindOptions, Op, Order, ScopeOptions, Sequelize, Transaction, WhereOptions } from 'sequelize'
4import { 3import {
@@ -174,7 +173,7 @@ export enum ScopeNames {
174 } 173 }
175 ] 174 ]
176}) 175})
177export class VideoCommentModel extends Model<VideoCommentModel> { 176export class VideoCommentModel extends Model {
178 @CreatedAt 177 @CreatedAt
179 createdAt: Date 178 createdAt: Date
180 179
@@ -255,7 +254,7 @@ export class VideoCommentModel extends Model<VideoCommentModel> {
255 }) 254 })
256 CommentAbuses: VideoCommentAbuseModel[] 255 CommentAbuses: VideoCommentAbuseModel[]
257 256
258 static loadById (id: number, t?: Transaction): Bluebird<MComment> { 257 static loadById (id: number, t?: Transaction): Promise<MComment> {
259 const query: FindOptions = { 258 const query: FindOptions = {
260 where: { 259 where: {
261 id 260 id
@@ -267,7 +266,7 @@ export class VideoCommentModel extends Model<VideoCommentModel> {
267 return VideoCommentModel.findOne(query) 266 return VideoCommentModel.findOne(query)
268 } 267 }
269 268
270 static loadByIdAndPopulateVideoAndAccountAndReply (id: number, t?: Transaction): Bluebird<MCommentOwnerVideoReply> { 269 static loadByIdAndPopulateVideoAndAccountAndReply (id: number, t?: Transaction): Promise<MCommentOwnerVideoReply> {
271 const query: FindOptions = { 270 const query: FindOptions = {
272 where: { 271 where: {
273 id 272 id
@@ -281,7 +280,7 @@ export class VideoCommentModel extends Model<VideoCommentModel> {
281 .findOne(query) 280 .findOne(query)
282 } 281 }
283 282
284 static loadByUrlAndPopulateAccountAndVideo (url: string, t?: Transaction): Bluebird<MCommentOwnerVideo> { 283 static loadByUrlAndPopulateAccountAndVideo (url: string, t?: Transaction): Promise<MCommentOwnerVideo> {
285 const query: FindOptions = { 284 const query: FindOptions = {
286 where: { 285 where: {
287 url 286 url
@@ -293,7 +292,7 @@ export class VideoCommentModel extends Model<VideoCommentModel> {
293 return VideoCommentModel.scope([ ScopeNames.WITH_ACCOUNT, ScopeNames.WITH_VIDEO ]).findOne(query) 292 return VideoCommentModel.scope([ ScopeNames.WITH_ACCOUNT, ScopeNames.WITH_VIDEO ]).findOne(query)
294 } 293 }
295 294
296 static loadByUrlAndPopulateReplyAndVideoUrlAndAccount (url: string, t?: Transaction): Bluebird<MCommentOwnerReplyVideoLight> { 295 static loadByUrlAndPopulateReplyAndVideoUrlAndAccount (url: string, t?: Transaction): Promise<MCommentOwnerReplyVideoLight> {
297 const query: FindOptions = { 296 const query: FindOptions = {
298 where: { 297 where: {
299 url 298 url
@@ -501,7 +500,7 @@ export class VideoCommentModel extends Model<VideoCommentModel> {
501 }) 500 })
502 } 501 }
503 502
504 static listThreadParentComments (comment: MCommentId, t: Transaction, order: 'ASC' | 'DESC' = 'ASC'): Bluebird<MCommentOwner[]> { 503 static listThreadParentComments (comment: MCommentId, t: Transaction, order: 'ASC' | 'DESC' = 'ASC'): Promise<MCommentOwner[]> {
505 const query = { 504 const query = {
506 order: [ [ 'createdAt', order ] ] as Order, 505 order: [ [ 'createdAt', order ] ] as Order,
507 where: { 506 where: {