W n8n attention vm
This commit is contained in:
parent
5f99667b79
commit
67d79233ad
@ -247,7 +247,42 @@ export async function POST(request: Request) {
|
||||
|
||||
console.log('Mission created successfully:', JSON.stringify(mission, null, 2));
|
||||
|
||||
// Step 2: Upload logo to Minio if present
|
||||
// Step 2: Create mission users (guardians and volunteers)
|
||||
const missionUsers = [];
|
||||
|
||||
// Add guardians
|
||||
if (body.guardians) {
|
||||
for (const [role, guardianId] of Object.entries(body.guardians)) {
|
||||
if (guardianId) {
|
||||
missionUsers.push({
|
||||
missionId: mission.id,
|
||||
userId: guardianId,
|
||||
role: role
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Add volunteers
|
||||
if (body.volunteers && body.volunteers.length > 0) {
|
||||
for (const volunteerId of body.volunteers) {
|
||||
missionUsers.push({
|
||||
missionId: mission.id,
|
||||
userId: volunteerId,
|
||||
role: 'volontaire'
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Create all mission users
|
||||
if (missionUsers.length > 0) {
|
||||
await prisma.missionUser.createMany({
|
||||
data: missionUsers
|
||||
});
|
||||
console.log('Mission users created:', missionUsers);
|
||||
}
|
||||
|
||||
// Step 3: Upload logo to Minio if present
|
||||
let logoPath = null;
|
||||
if (body.logo?.data) {
|
||||
try {
|
||||
@ -274,7 +309,7 @@ export async function POST(request: Request) {
|
||||
}
|
||||
}
|
||||
|
||||
// Step 3: Handle attachments if present
|
||||
// Step 4: Handle attachments if present
|
||||
if (body.attachments && body.attachments.length > 0) {
|
||||
try {
|
||||
const attachmentPromises = body.attachments.map(async (attachment: any) => {
|
||||
@ -307,7 +342,7 @@ export async function POST(request: Request) {
|
||||
}
|
||||
}
|
||||
|
||||
// Step 4: Verify all files are in Minio before triggering n8n
|
||||
// Step 5: Verify all files are in Minio before triggering n8n
|
||||
try {
|
||||
// Verify logo if present
|
||||
if (logoPath) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user