fix: supply mandatory fields to prevent 422 error on contact creation
All checks were successful
Build & Push Friends Image to Gitea Registry / build-and-push (push) Successful in 9s
All checks were successful
Build & Push Friends Image to Gitea Registry / build-and-push (push) Successful in 9s
This commit is contained in:
@@ -135,6 +135,9 @@ app.post("/api/contacts/create", async (req, res) => {
|
|||||||
first_name,
|
first_name,
|
||||||
last_name: last_name || "",
|
last_name: last_name || "",
|
||||||
description: description || "",
|
description: description || "",
|
||||||
|
is_birthdate_known: "false",
|
||||||
|
is_deceased: false,
|
||||||
|
is_deceased_date_known: false
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
const contact = contactPayload.data || {};
|
const contact = contactPayload.data || {};
|
||||||
@@ -278,6 +281,9 @@ export async function writeToMonica(entry) {
|
|||||||
first_name: entry.contact.first_name,
|
first_name: entry.contact.first_name,
|
||||||
last_name: entry.contact.last_name || "",
|
last_name: entry.contact.last_name || "",
|
||||||
description: "Automatisch angelegter Kontakt via Friends",
|
description: "Automatisch angelegter Kontakt via Friends",
|
||||||
|
is_birthdate_known: entry.contact.birthdate ? (entry.contact.birthdate.startsWith("0000") ? "unknown" : "true") : "false",
|
||||||
|
is_deceased: false,
|
||||||
|
is_deceased_date_known: false
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
const newContact = newContactPayload.data || {};
|
const newContact = newContactPayload.data || {};
|
||||||
@@ -313,6 +319,8 @@ export async function writeToMonica(entry) {
|
|||||||
last_name: existingData.last_name || entry.contact.last_name || "",
|
last_name: existingData.last_name || entry.contact.last_name || "",
|
||||||
birthdate: entry.contact.birthdate,
|
birthdate: entry.contact.birthdate,
|
||||||
is_birthdate_known: entry.contact.birthdate.startsWith("0000") ? "unknown" : "true",
|
is_birthdate_known: entry.contact.birthdate.startsWith("0000") ? "unknown" : "true",
|
||||||
|
is_deceased: existingData.is_deceased ?? false,
|
||||||
|
is_deceased_date_known: existingData.is_deceased_date_known ?? false
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
results.push({ type: "contact_birthdate", ok: true, id: contactId });
|
results.push({ type: "contact_birthdate", ok: true, id: contactId });
|
||||||
|
|||||||
Reference in New Issue
Block a user