aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models
diff options
context:
space:
mode:
authorAndrés Maldonado <amaldona@etu.utc.fr>2018-11-27 18:57:02 +0100
committerChocobozzz <me@florianbigard.com>2019-02-12 11:14:37 +0100
commit31d065cc50e17a9abf263ed8c606cb272cd4933d (patch)
tree5e4516cb48dd36490e817bd9e59c41f3cad0d968 /server/models
parent7f8f8bdb4a1fb695a114874c4679605ac8911e2d (diff)
downloadPeerTube-31d065cc50e17a9abf263ed8c606cb272cd4933d.tar.gz
PeerTube-31d065cc50e17a9abf263ed8c606cb272cd4933d.tar.zst
PeerTube-31d065cc50e17a9abf263ed8c606cb272cd4933d.zip
Add search by original publication date
Diffstat (limited to 'server/models')
-rw-r--r--server/models/video/video.ts11
1 files changed, 11 insertions, 0 deletions
diff --git a/server/models/video/video.ts b/server/models/video/video.ts
index 215e26d7d..fe81fab1a 100644
--- a/server/models/video/video.ts
+++ b/server/models/video/video.ts
@@ -1174,6 +1174,8 @@ export class VideoModel extends Model<VideoModel> {
1174 sort?: string 1174 sort?: string
1175 startDate?: string // ISO 8601 1175 startDate?: string // ISO 8601
1176 endDate?: string // ISO 8601 1176 endDate?: string // ISO 8601
1177 originallyPublishedStartDate?: string
1178 originallyPublishedEndDate?: string
1177 nsfw?: boolean 1179 nsfw?: boolean
1178 categoryOneOf?: number[] 1180 categoryOneOf?: number[]
1179 licenceOneOf?: number[] 1181 licenceOneOf?: number[]
@@ -1196,6 +1198,15 @@ export class VideoModel extends Model<VideoModel> {
1196 whereAnd.push({ publishedAt: publishedAtRange }) 1198 whereAnd.push({ publishedAt: publishedAtRange })
1197 } 1199 }
1198 1200
1201 if (options.originallyPublishedStartDate || options.originallyPublishedEndDate) {
1202 const originallyPublishedAtRange = {}
1203
1204 if (options.originallyPublishedStartDate) originallyPublishedAtRange[ Sequelize.Op.gte ] = options.originallyPublishedStartDate
1205 if (options.originallyPublishedEndDate) originallyPublishedAtRange[ Sequelize.Op.lte ] = options.originallyPublishedEndDate
1206
1207 whereAnd.push({ originallyPublishedAt: originallyPublishedAtRange })
1208 }
1209
1199 if (options.durationMin || options.durationMax) { 1210 if (options.durationMin || options.durationMax) {
1200 const durationRange = {} 1211 const durationRange = {}
1201 1212