Commit e2e52f84 by ramdayalmunda

initialized

parents
node_modules/
\ No newline at end of file
const { STATUS_CODE } = require("../helper/constants")
module.exports.generateVideo = async function(req, res){
console.log('generate Video', req.body)
try{
res.status(STATUS_CODE.OK).json()
}catch(err){
console.log(err)
res.status(STATUS_CODE.ERROR).json()
}
}
\ No newline at end of file
module.exports.STATUS_CODE = {
OK: 200,
NOT_FOUND: 400,
ERROR: 500
}
\ No newline at end of file
const express = require('express')
const PORT = process.env.PORT || 5000;
const app = express()
app.use( require("./routes/tutor-shot") )
app.listen( PORT, ()=>{
console.log(`BeGenieUs jobs running on http://localhost:${PORT}`)
} )
\ No newline at end of file
const fs = require('fs');
const path = require('path');
const basename = path.basename(__filename);
const mongoose = require('mongoose');
const models = {};
fs
.readdirSync(__dirname)
.filter(file => {
return (file.indexOf('.') !== 0) && (file !== basename) && (file.slice(-3) === '.js');
})
.forEach(async file => {
const schema = require(path.join(__dirname, file));
const model = mongoose.model(schema.collectionName, schema.collectionSchema)
models[schema.collectionName] = model
});
module.exports = models;
\ No newline at end of file
const mongoose = require("mongoose");
let segmentSchema = {
"tutorShotOid": mongoose.Schema.Types.ObjectId,
"title": String,
"action": { type: String, default: "SSCaptured" },
"imageUrl": String,
"thumbnailUrl": String,
"imageNumber": Number,
"url": String,
"origin": String,
"object": [
{
"dimension": {
"width": { type: Number, default: 400 },
"height": { type: Number, default: 197 }
},
"position": {
"top": { type: Number, default: 90 },
"left": { type: Number, default: 768 }
},
"font": {
"size": { type: Number, default: 37 },
"family": { type: String, default: "Arial" },
"color": { type: String, default: "#ff1245" }
},
"type": { type: String, default: "block" },
"text": { type: String, default: "" },
"transform": {
"xFlip": { type: Boolean, default: false },
"yFlip": { type: Boolean, default: false },
"angle": { type: Number, default: 0 }
},
"format": {
"backgroundColor": { type: String, default: "#0000007f" },
"borderRadius": { type: Number, default: 7 },
"borderWidth": { type: Number, default: 10 },
"borderColor": { type: String, default: "#af7f1c" }
},
"image": {
"src": String
},
"id": String
}
],
"duration": { type: Number, default: 2 }, // in seconds
"manualDuration": { type: Boolean, default: false },
"dimension": Object,
"deleteStatus": Boolean,
}
let audioSchema = {
uploadId: mongoose.Types.ObjectId,
originalName: String,
fileName: String,
remotePath: String,
segmentId: mongoose.Types.ObjectId, // ref to the segment object in the segment field
objectId: mongoose.Types.ObjectId, // ref to the object inside each segment inside segment field
trackNumber: { type: Number, default: 1 },
startTime: { type: Number, default: 0 },
endTime: { type: Number, default: 0 },
skip: { type: Boolean, default: false }, // to use the audio or not while generating video
trim: { type: Number } // sometime we would need only a part of a video. This stores the length of the video required
}
let collectionSchema = new mongoose.Schema(
{
uid: { type: String }, // id of the user
// fullName: { type: String }, // name of the user
// email: { type: String }, // email of the user
segments: [segmentSchema],
audio: [audioSchema],
title: { type: String }, // this is constant
deleteStatus: { type: Boolean, default: false },
videoUrl: String,
thumbnailUrl: String,
},
{ timestamps: true }
)
module.exports = { collectionSchema, collectionName: "tutorShot" }
{
"name": "begenieus-jobs",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "node index.js"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"express": "^4.18.3",
"mongoose": "^8.2.0"
}
}
const tutorShotController = require("../controller/tutor-shot")
const router = new require('express').Router()
router.post("/generate", tutorShotController.generateVideo)
module.exports = router
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment