diff --git a/backend/services/interfaces/taskService.ts b/backend/services/interfaces/taskService.ts index 8c6f8e3..b406686 100644 --- a/backend/services/interfaces/taskService.ts +++ b/backend/services/interfaces/taskService.ts @@ -9,7 +9,7 @@ export interface TaskDTO { id: number; type: TaskType; title: string; - description?: string; + description: string | null; creditValue: number; // location: TaskLocationDTO; endDate: Date | null; @@ -27,7 +27,7 @@ export interface TaskDTO { export interface InputTaskDTO { type: TaskType; title: string; - description?: string; + description: string | null; creditValue: number; // locationId: number; endDate: Date | null; diff --git a/frontend/src/APIClients/Types/TaskType.ts b/frontend/src/APIClients/Types/TaskType.ts index bd4c193..1ba62ba 100644 --- a/frontend/src/APIClients/Types/TaskType.ts +++ b/frontend/src/APIClients/Types/TaskType.ts @@ -29,19 +29,12 @@ export enum TaskTypeEnum { ACHIEVEMENT = "ACHIEVEMENT", } -export type TaskLocation = { - id: number; - title: string; - description: string; -}; - export type TaskResponse = { id: number; type: TaskTypeEnum; title: string; - description: string; + description?: string; creditValue: number; - location: TaskLocation; tasksAssigned: TaskResponse[]; endDate?: Date; recurrenceFrequency: RecurrenceFrequency; @@ -52,9 +45,8 @@ export type TaskResponse = { export type TaskRequest = { type: TaskTypeEnum; title: string; - description: string; + description?: string; creditValue: number; - locationId: number; endDate?: Date; recurrenceFrequency: RecurrenceFrequency; specificDay?: DaysOfWeek; diff --git a/frontend/src/components/pages/home/RoomGrid.tsx b/frontend/src/components/pages/home/RoomGrid.tsx index 6423ff5..a3a6ce1 100644 --- a/frontend/src/components/pages/home/RoomGrid.tsx +++ b/frontend/src/components/pages/home/RoomGrid.tsx @@ -6,6 +6,7 @@ import { GET_ACTIVE_RESIDENTS } from "../../../APIClients/Queries/ResidentsQueri import { GET_TASKS_BY_STATUS } from "../../../APIClients/Queries/TaskQueries"; const RoomGrid = () => { + const [residents, setResidents] = useState([]); const { data: residentData } = useQuery(GET_ACTIVE_RESIDENTS); const { data: pending } = useQuery(GET_TASKS_BY_STATUS, { @@ -28,6 +29,10 @@ const RoomGrid = () => { return { assignedTasks, pendingTasks, loading: false, error: null }; }; + useEffect(() => { + setResidents(residentData?.getActiveResidents || []); + }, [pending, assigned, residentData]); + return ( { gap="20px" width="100%" > - {residentData?.getAllResidents?.map( + {residents.map( (room: { roomNumber: string; residentId: number; diff --git a/frontend/src/components/pages/tasks/TaskModal.tsx b/frontend/src/components/pages/tasks/TaskModal.tsx index afa777f..e7cd8aa 100644 --- a/frontend/src/components/pages/tasks/TaskModal.tsx +++ b/frontend/src/components/pages/tasks/TaskModal.tsx @@ -162,7 +162,6 @@ const TaskModal = ({ title, description: task?.description || "No field in modal", creditValue: marillacBucks || 0, - locationId: task?.locationId || 1234, // no field in modal endDate: endsOn === "never" ? undefined : new Date(endsOnDate), recurrenceFrequency: recurrenceFrequency as RecurrenceFrequency, repeatDays: diff --git a/frontend/src/components/pages/tasks/TasksPage.tsx b/frontend/src/components/pages/tasks/TasksPage.tsx index e19719d..cd80dce 100644 --- a/frontend/src/components/pages/tasks/TasksPage.tsx +++ b/frontend/src/components/pages/tasks/TasksPage.tsx @@ -35,7 +35,6 @@ import { RecurrenceFrequency, DaysOfWeek, TaskTypeEnum, - TaskLocation, TaskResponse, TaskRequest, TaskAssignedRequest,