Skip to content

Commit

Permalink
fix: solved merge-conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
malmen237 committed Nov 12, 2024
1 parent 65cbd1d commit 68b3c89
Show file tree
Hide file tree
Showing 8 changed files with 61 additions and 368 deletions.
46 changes: 23 additions & 23 deletions src/api/mongoClient/defaults/preset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,79 +211,79 @@ export const defaultMultiview = [
y: 540,
height: 270,
width: 384,
label: 'Input 1'
label: ''
},
{
input_slot: 2,
x: 384,
y: 540,
height: 270,
width: 384,
label: 'Input 2'
label: ''
},
{
input_slot: 3,
x: 768,
y: 540,
height: 270,
width: 384,
label: 'Input 3'
label: ''
},
{
input_slot: 4,
x: 1152,
y: 540,
height: 270,
width: 384,
label: 'Input 4'
label: ''
},
{
input_slot: 5,
x: 1536,
y: 540,
height: 270,
width: 384,
label: 'Input 5'
label: ''
},
{
input_slot: 6,
x: 0,
y: 810,
height: 270,
width: 384,
label: 'Input 6'
label: ''
},
{
input_slot: 7,
x: 384,
y: 810,
height: 270,
width: 384,
label: 'Input 7'
label: ''
},
{
input_slot: 8,
x: 768,
y: 810,
height: 270,
width: 384,
label: 'Input 8'
label: ''
},
{
input_slot: 9,
x: 1152,
y: 810,
height: 270,
width: 384,
label: 'Input 9'
label: ''
},
{
input_slot: 10,
x: 1536,
y: 810,
height: 270,
width: 384,
label: 'Input 10'
label: ''
}
]
},
Expand Down Expand Up @@ -333,103 +333,103 @@ export const defaultMultiview = [
y: 540,
height: 270,
width: 384,
label: 'Input 1'
label: ''
},
{
input_slot: 2,
x: 384,
y: 540,
height: 270,
width: 384,
label: 'Input 2'
label: ''
},
{
input_slot: 3,
x: 768,
y: 540,
height: 270,
width: 384,
label: 'Input 3'
label: ''
},
{
input_slot: 4,
x: 1152,
y: 540,
height: 270,
width: 384,
label: 'Input 4'
label: ''
},
{
input_slot: 5,
x: 1536,
y: 540,
height: 270,
width: 384,
label: 'Input 5'
label: ''
},
{
input_slot: 6,
x: 0,
y: 810,
height: 270,
width: 384,
label: 'Input 6'
label: ''
},
{
input_slot: 7,
x: 384,
y: 810,
height: 270,
width: 384,
label: 'Input 7'
label: ''
},
{
input_slot: 8,
x: 768,
y: 810,
height: 270,
width: 384,
label: 'Input 8'
label: ''
},
{
input_slot: 9,
x: 1152,
y: 810,
height: 270,
width: 384,
label: 'Input 9'
label: ''
},
{
input_slot: 10,
x: 1536,
y: 810,
height: 135,
width: 192,
label: 'VS'
label: ''
},
{
input_slot: 11,
x: 1728,
y: 810,
height: 135,
width: 192,
label: 'UR'
label: ''
},
{
input_slot: 12,
x: 1536,
y: 945,
height: 135,
width: 192,
label: 'OV'
label: ''
},
{
input_slot: 13,
x: 1728,
y: 945,
height: 135,
width: 192,
label: 'CG'
label: ''
}
]
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { NextRequest, NextResponse } from 'next/server';
import { isAuthenticated } from '../../../../../../../../../api/manager/auth';
import { deleteHtmlFromPipeline } from '../../../../../../../../../api/ateliereLive/pipelines/renderingengine/renderingengine';
import { MultiviewSettings } from '../../../../../../../../../interfaces/multiview';
import { updateMultiviewForPipeline } from '../../../../../../../../../api/ateliereLive/pipelines/multiviews/multiviews';
import { DeleteRenderingEngineSourceStep } from '../../../../../../../../../interfaces/Source';
import { Result } from '../../../../../../../../../interfaces/result';
import { Log } from '../../../../../../../../../api/logger';
Expand All @@ -23,90 +21,21 @@ export async function DELETE(
});
}

const body = await request.json();
const multiview = body.multiview as MultiviewSettings[];

try {
await deleteHtmlFromPipeline(params.id, params.input_slot).catch((e) => {
Log().error(`Failed to delete html: ${params.id}: ${e.message}`);
throw `Failed to delete html: ${params.id}: ${e.message}`;
});
if (!multiview || multiview.length === 0) {
return new NextResponse(
JSON.stringify({
ok: true,
value: [
{
step: 'delete_html',
success: true
}
]
})
);
}
} catch (e) {
if (typeof e !== 'string') {
return new NextResponse(
JSON.stringify({
ok: false,
value: [
{
step: 'delete_html',
success: false,
message: `Failed to delete html`
}
],
error: 'Delete html failed'
} satisfies Result<DeleteRenderingEngineSourceStep[]>)
);
}
return new NextResponse(
JSON.stringify({
ok: false,
value: [
{
step: 'delete_html',
success: false,
message: `Failed to delete html: ${params.id}: ${e}`
}
],
error: e
} satisfies Result<DeleteRenderingEngineSourceStep[]>)
);
}

try {
const multiviewUpdates = multiview.map(async (singleMultiview) => {
if (!singleMultiview.multiview_id) {
throw `The provided multiview settings did not contain any multiview id`;
}
if (params.id === params.ld_pipeline_id) {
return updateMultiviewForPipeline(
params.id,
singleMultiview.multiview_id,
singleMultiview.layout.views
).catch((e) => {
throw `Error when updating multiview: ${e.message}`;
});
}
});

await Promise.all(multiviewUpdates);

return new NextResponse(
JSON.stringify({
ok: true,
value: [
{
step: 'delete_html',
success: true
},
{
step: 'update_multiview',
success: true
}
]
} satisfies Result<DeleteRenderingEngineSourceStep[]>)
})
);
} catch (e) {
if (typeof e !== 'string') {
Expand All @@ -116,15 +45,11 @@ export async function DELETE(
value: [
{
step: 'delete_html',
success: true
},
{
step: 'update_multiview',
success: false,
message: `Failed to update multiview`
message: `Failed to delete html`
}
],
error: 'Failed to update multiview'
error: 'Delete html failed'
} satisfies Result<DeleteRenderingEngineSourceStep[]>)
);
}
Expand All @@ -134,12 +59,8 @@ export async function DELETE(
value: [
{
step: 'delete_html',
success: true
},
{
step: 'update_multiview',
success: false,
message: `Failed to update multiview: ${e}`
message: `Failed to delete html: ${params.id}: ${e}`
}
],
error: e
Expand Down
Loading

0 comments on commit 68b3c89

Please sign in to comment.