aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-02-28 11:14:26 +0100
committerChocobozzz <chocobozzz@cpy.re>2019-03-18 11:17:59 +0100
commit07b1a18aa678d260009a93e36606c5c5f585723d (patch)
tree27a399fa0f7a29a7ac1d7d7cf077a24ea6ee39de /server/models
parent418d092afa81e2c8fe8ac6838fc4b5eb0af6a782 (diff)
downloadPeerTube-07b1a18aa678d260009a93e36606c5c5f585723d.tar.gz
PeerTube-07b1a18aa678d260009a93e36606c5c5f585723d.tar.zst
PeerTube-07b1a18aa678d260009a93e36606c5c5f585723d.zip
Add playlist check param tests
Diffstat (limited to 'server/models')
-rw-r--r--server/models/video/video-channel.ts2
-rw-r--r--server/models/video/video-playlist-element.ts3
-rw-r--r--server/models/video/video-playlist.ts4
3 files changed, 5 insertions, 4 deletions
diff --git a/server/models/video/video-channel.ts b/server/models/video/video-channel.ts
index 112abf8cf..c077fb518 100644
--- a/server/models/video/video-channel.ts
+++ b/server/models/video/video-channel.ts
@@ -223,7 +223,7 @@ export class VideoChannelModel extends Model<VideoChannelModel> {
223 223
224 @HasMany(() => VideoPlaylistModel, { 224 @HasMany(() => VideoPlaylistModel, {
225 foreignKey: { 225 foreignKey: {
226 allowNull: false 226 allowNull: true
227 }, 227 },
228 onDelete: 'cascade', 228 onDelete: 'cascade',
229 hooks: true 229 hooks: true
diff --git a/server/models/video/video-playlist-element.ts b/server/models/video/video-playlist-element.ts
index d76149d12..5530e0492 100644
--- a/server/models/video/video-playlist-element.ts
+++ b/server/models/video/video-playlist-element.ts
@@ -188,7 +188,8 @@ export class VideoPlaylistElementModel extends Model<VideoPlaylistElementModel>
188 [Sequelize.Op.lte]: endPosition 188 [Sequelize.Op.lte]: endPosition
189 } 189 }
190 }, 190 },
191 transaction 191 transaction,
192 validate: false // We use a literal to update the position
192 } 193 }
193 194
194 return VideoPlaylistElementModel.update({ position: Sequelize.literal(`${newPosition} + "position" - ${firstPosition}`) }, query) 195 return VideoPlaylistElementModel.update({ position: Sequelize.literal(`${newPosition} + "position" - ${firstPosition}`) }, query)
diff --git a/server/models/video/video-playlist.ts b/server/models/video/video-playlist.ts
index 93b8c2f58..397887ebf 100644
--- a/server/models/video/video-playlist.ts
+++ b/server/models/video/video-playlist.ts
@@ -197,7 +197,7 @@ export class VideoPlaylistModel extends Model<VideoPlaylistModel> {
197 197
198 @BelongsTo(() => VideoChannelModel, { 198 @BelongsTo(() => VideoChannelModel, {
199 foreignKey: { 199 foreignKey: {
200 allowNull: false 200 allowNull: true
201 }, 201 },
202 onDelete: 'CASCADE' 202 onDelete: 'CASCADE'
203 }) 203 })
@@ -351,7 +351,7 @@ export class VideoPlaylistModel extends Model<VideoPlaylistModel> {
351 updatedAt: this.updatedAt, 351 updatedAt: this.updatedAt,
352 352
353 ownerAccount: this.OwnerAccount.toFormattedSummaryJSON(), 353 ownerAccount: this.OwnerAccount.toFormattedSummaryJSON(),
354 videoChannel: this.VideoChannel.toFormattedSummaryJSON() 354 videoChannel: this.VideoChannel ? this.VideoChannel.toFormattedSummaryJSON() : null
355 } 355 }
356 } 356 }
357 357