This commit is contained in:
I-Have-An-Issue 2023-02-17 20:55:17 -05:00
parent ded459f503
commit eaa234d129
No known key found for this signature in database
GPG Key ID: E55435DEA0825091
1 changed files with 19 additions and 19 deletions

View File

@ -1,32 +1,32 @@
const express = require("express"); const express = require("express")
const app = express.Router(); const app = express.Router()
const RenderJob = require("../../lib/classes/RenderJob.js"); const RenderJob = require("../../lib/classes/RenderJob.js")
app.get("/:id", async (request, response) => { app.get("/:id", async (request, response) => {
const { params, query } = request; const { params, query } = request
const job = new RenderJob(); const job = new RenderJob()
let body = {}; let body = {}
const aseet = await job.RenderAsset(params.id).catch((_) => _); const asset = await job.RenderAsset(params.id).catch((_) => _)
if (aseet?.message) { if (asset?.message) {
job.Stop(); job.Stop()
return response.status(500).json({ error: aseet.message }); return response.status(500).json({ error: asset.message })
} }
body.aseet = aseet; body.asset = asset
if (query.three_d) { if (query.three_d) {
const three_d = await job.RenderAsset(params.id, true).catch((_) => _); const three_d = await job.RenderAsset(params.id, true).catch((_) => _)
if (three_d?.message) { if (three_d?.message) {
job.Stop(); job.Stop()
return response.status(500).json({ error: three_d.message }); return response.status(500).json({ error: three_d.message })
} }
body.three_d = three_d; body.three_d = three_d
} }
job.Stop(); job.Stop()
return response.json(body); return response.json(body)
}); })
module.exports = app; module.exports = app