From 0a6658fdcbd779ada8f3758048c326e997902d5a Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 11 Jul 2017 16:01:56 +0200 Subject: Use global uuid instead of remoteId for videos --- server/lib/friends.ts | 4 ++-- server/lib/jobs/handlers/video-transcoder.ts | 4 ++-- server/lib/request/request-video-event-scheduler.ts | 16 ++++++++-------- server/lib/request/request-video-qadu-scheduler.ts | 16 ++++++++-------- 4 files changed, 20 insertions(+), 20 deletions(-) (limited to 'server/lib') diff --git a/server/lib/friends.ts b/server/lib/friends.ts index a65820191..cbdc60441 100644 --- a/server/lib/friends.ts +++ b/server/lib/friends.ts @@ -43,8 +43,8 @@ import { Pod as FormatedPod } from '../../shared' -type QaduParam = { videoId: string, type: RequestVideoQaduType } -type EventParam = { videoId: string, type: RequestVideoEventType } +type QaduParam = { videoId: number, type: RequestVideoQaduType } +type EventParam = { videoId: number, type: RequestVideoEventType } const ENDPOINT_ACTIONS = REQUEST_ENDPOINT_ACTIONS[REQUEST_ENDPOINTS.VIDEOS] diff --git a/server/lib/jobs/handlers/video-transcoder.ts b/server/lib/jobs/handlers/video-transcoder.ts index eeb2d57b0..0d32dfd2f 100644 --- a/server/lib/jobs/handlers/video-transcoder.ts +++ b/server/lib/jobs/handlers/video-transcoder.ts @@ -3,8 +3,8 @@ import { logger } from '../../../helpers' import { addVideoToFriends } from '../../../lib' import { VideoInstance } from '../../../models' -function process (data: { id: string }) { - return db.Video.loadAndPopulateAuthorAndPodAndTags(data.id).then(video => { +function process (data: { videoUUID: string }) { + return db.Video.loadByUUIDAndPopulateAuthorAndPodAndTags(data.videoUUID).then(video => { return video.transcodeVideofile().then(() => video) }) } diff --git a/server/lib/request/request-video-event-scheduler.ts b/server/lib/request/request-video-event-scheduler.ts index 8a008c51b..680232732 100644 --- a/server/lib/request/request-video-event-scheduler.ts +++ b/server/lib/request/request-video-event-scheduler.ts @@ -12,7 +12,7 @@ import { RequestVideoEventType, RemoteVideoEventRequest, RemoteVideoEventType } export type RequestVideoEventSchedulerOptions = { type: RequestVideoEventType - videoId: string + videoId: number count?: number transaction?: Sequelize.Transaction } @@ -49,7 +49,7 @@ class RequestVideoEventScheduler extends AbstractRequestScheduler { const eventsForPod = eventsPerVideoPerPod[toPodId] - Object.keys(eventsForPod).forEach(remoteId => { - const eventsForVideo = eventsForPod[remoteId] + Object.keys(eventsForPod).forEach(uuid => { + const eventsForVideo = eventsForPod[uuid] Object.keys(eventsForVideo).forEach(eventType => { requestsToMakeGrouped[toPodId].datas.push({ data: { - remoteId, + uuid, eventType: eventType as RemoteVideoEventType, count: +eventsForVideo[eventType] } diff --git a/server/lib/request/request-video-qadu-scheduler.ts b/server/lib/request/request-video-qadu-scheduler.ts index 988165170..afb9d5c23 100644 --- a/server/lib/request/request-video-qadu-scheduler.ts +++ b/server/lib/request/request-video-qadu-scheduler.ts @@ -21,8 +21,8 @@ interface RequestsObjectsCustom extends RequestsObjects { datas: U[] videos: { - [ id: string ]: { - remoteId: string + [ uuid: string ]: { + uuid: string likes?: number dislikes?: number views?: number @@ -33,7 +33,7 @@ interface RequestsObjectsCustom extends RequestsObjects { export type RequestVideoQaduSchedulerOptions = { type: RequestVideoQaduType - videoId: string + videoId: number transaction?: Sequelize.Transaction } @@ -78,7 +78,7 @@ class RequestVideoQaduScheduler extends AbstractRequestScheduler { - Object.keys(requestsToMakeGrouped[hashKey].videos).forEach(videoId => { - const videoData = requestsToMakeGrouped[hashKey].videos[videoId] + Object.keys(requestsToMakeGrouped[hashKey].videos).forEach(videoUUID => { + const videoData = requestsToMakeGrouped[hashKey].videos[videoUUID] requestsToMakeGrouped[hashKey].datas.push({ data: videoData -- cgit v1.2.3