W n8n
This commit is contained in:
parent
bb73f26292
commit
36faf6c818
@ -180,8 +180,27 @@ export async function POST(request: Request) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (existingMission) {
|
if (existingMission) {
|
||||||
console.error('Mission with same name already exists:', name);
|
console.log('Mission exists, updating integration IDs:', {
|
||||||
return NextResponse.json({ error: 'A mission with this name already exists' }, { status: 400 });
|
missionId: existingMission.id,
|
||||||
|
name: existingMission.name,
|
||||||
|
rocketchatChannelId: body.rocketchatChannelId
|
||||||
|
});
|
||||||
|
|
||||||
|
// Update the existing mission with new integration IDs
|
||||||
|
const updateData: Prisma.MissionUncheckedUpdateInput = {
|
||||||
|
rocketChatChannelId: body.rocketchatChannelId || existingMission.rocketChatChannelId,
|
||||||
|
leantimeProjectId: body.leantimeProjectId || existingMission.leantimeProjectId,
|
||||||
|
outlineCollectionId: body.documentationCollectionId || existingMission.outlineCollectionId,
|
||||||
|
giteaRepositoryUrl: body.gitRepoUrl || existingMission.giteaRepositoryUrl
|
||||||
|
};
|
||||||
|
|
||||||
|
const updatedMission = await prisma.mission.update({
|
||||||
|
where: { id: existingMission.id },
|
||||||
|
data: updateData
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log('Updated existing mission:', JSON.stringify(updatedMission, null, 2));
|
||||||
|
return NextResponse.json(updatedMission);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Trigger n8n workflow first
|
// Trigger n8n workflow first
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user