weight edit fixes
Deploy / deploy-dev (push) Successful in 3m1s
Deploy / deploy-prod (push) Has been skipped

This commit is contained in:
Corey Blais
2026-06-16 15:28:01 -04:00
parent 4d3ab0b143
commit 1140be8f32
3 changed files with 17 additions and 31 deletions
-14
View File
@@ -318,15 +318,6 @@ const weightSchema = z.object({
recordedOn: dateStringSchema,
notes: z.string().trim().max(280).optional().or(z.literal('')),
});
const weightEditWindowDays = 3;
const getWeightEditEarliestDate = () => {
const earliestDate = new Date();
earliestDate.setDate(earliestDate.getDate() - (weightEditWindowDays - 1));
return earliestDate.toISOString().slice(0, 10);
};
const isWeightDateEditable = (recordedOn: string) => recordedOn >= getWeightEditEarliestDate();
const vetVisitSchema = z.object({
visitedOn: dateStringSchema,
@@ -4185,11 +4176,6 @@ app.put(
return;
}
if (!isWeightDateEditable(parsed.data.recordedOn)) {
res.status(409).json({ error: 'Weight entries can only be edited for the last 3 days.' });
return;
}
const weight = await updateWeightForBird(
req.params.weightId,
req.params.birdId,