Merge pull request 'Added validation to the Completed Work field to prevent negative values.' (#72) from Ashutosh_Bug#192_Negative_Completed_Work into Issue_May_2W

Reviewed-on: #72
This commit is contained in:
Gitea Admin 2025-05-07 11:11:26 +00:00
commit a8ba185bb8
2 changed files with 2 additions and 3 deletions

View File

@ -19,7 +19,7 @@ const taskSchema = z
.object({ .object({
activityID: z.string().min(1, "Activity is required"), activityID: z.string().min(1, "Activity is required"),
plannedWork: z.number().min(1, "Planned Work must be greater than 0"), plannedWork: z.number().min(1, "Planned Work must be greater than 0"),
completedWork: z.number().optional(), completedWork: z.number().min(0, "Completed Work must be greater than 0"),
}) })
.refine( .refine(
(data) => (data) =>
@ -84,7 +84,6 @@ const EditActivityModal = ({
floorId: floor?.id, floorId: floor?.id,
workAreaId: workArea?.id, workAreaId: workArea?.id,
}; };
console.log(finalData);
ProjectRepository.manageProjectTasks([finalData]) ProjectRepository.manageProjectTasks([finalData])
.then((response) => { .then((response) => {

View File

@ -10,7 +10,7 @@ const taskSchema = z.object({
workAreaId: z.string().min(1, "Work Area is required"), workAreaId: z.string().min(1, "Work Area is required"),
activityID: z.string().min(1, "Activity is required"), activityID: z.string().min(1, "Activity is required"),
plannedWork: z.number().min(1, "Planned Work must be greater than 0"), plannedWork: z.number().min(1, "Planned Work must be greater than 0"),
completedWork: z.number().optional(), completedWork: z.number().min(0, "Completed Work must be greater than 0"),
}); });
const defaultModel = { const defaultModel = {