W n8n attention vm
This commit is contained in:
parent
03eafa5588
commit
ea96b1d416
@ -231,10 +231,22 @@ export async function POST(request: Request) {
|
||||
|
||||
// Only create mission in database after n8n succeeds
|
||||
try {
|
||||
// Log the entire workflow result
|
||||
console.log('N8N Workflow Result:', JSON.stringify(workflowResult, null, 2));
|
||||
|
||||
// Extract logo path from workflow result
|
||||
let logoPath = null;
|
||||
if (workflowResult.data && Array.isArray(workflowResult.data)) {
|
||||
const firstResult = workflowResult.data[0];
|
||||
if (firstResult && firstResult.logoPath) {
|
||||
logoPath = firstResult.logoPath;
|
||||
}
|
||||
}
|
||||
|
||||
console.log('Creating mission with data:', {
|
||||
name: body.name,
|
||||
logoPath: body.logoPath,
|
||||
logo: body.logo
|
||||
logoPath,
|
||||
workflowResult: workflowResult
|
||||
});
|
||||
|
||||
const missionData = {
|
||||
@ -249,7 +261,7 @@ export async function POST(request: Request) {
|
||||
profils: body.profils,
|
||||
participation: body.participation,
|
||||
creatorId: userId,
|
||||
logo: body.logoPath ? `missions/${body.logoPath}` : null // Ensure proper path format
|
||||
logo: logoPath ? `missions/${logoPath}` : null
|
||||
};
|
||||
|
||||
console.log('Mission data to be saved:', missionData);
|
||||
@ -260,7 +272,8 @@ export async function POST(request: Request) {
|
||||
|
||||
console.log('Mission created with logo:', {
|
||||
missionId: mission.id,
|
||||
logo: mission.logo
|
||||
logo: mission.logo,
|
||||
fullMission: mission
|
||||
});
|
||||
|
||||
return NextResponse.json({
|
||||
|
||||
Loading…
Reference in New Issue
Block a user