Skip to content

Commit

Permalink
Commented queue processing. TBD later
Browse files Browse the repository at this point in the history
  • Loading branch information
foyzulkarim committed Oct 8, 2023
1 parent b940f07 commit 4c14f1a
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions server/src/modules/models/video/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const {
} = require('./service');
const { validate } = require('./request');
const { VIDEO_QUEUE_EVENTS: QUEUE_EVENTS } = require('../../queues/constants');
const { VIDEO_STATUS } = require('../../db/constant');
const { addQueueItem } = require('../../queues/queue');
const {
getVideoDurationAndResolution,
Expand Down Expand Up @@ -185,16 +186,17 @@ const setupRoutes = (app) => {
videoLink: req.file.location,
viewCount: 0,
duration: 0,
status: VIDEO_STATUS.PUBLISHED
};
logger.info('dbPayload', { dbPayload });
// TODO: save the file info and get the id from the database
const result = await insert(dbPayload);
logger.info('result', result);
await addQueueItem(QUEUE_EVENTS.VIDEO_UPLOADED, {
id: result.insertedId.toString(),
...req.body,
...req.file,
});
// await addQueueItem(QUEUE_EVENTS.VIDEO_UPLOADED, {
// id: result.insertedId.toString(),
// ...req.body,
// ...req.file,
// });
res.status(200).json({
status: 'success',
message: 'Upload success',
Expand Down

0 comments on commit 4c14f1a

Please sign in to comment.