Skip to content

Commit

Permalink
removed task locations from types
Browse files Browse the repository at this point in the history
  • Loading branch information
jeessh committed Dec 6, 2024
1 parent 16e8272 commit 04d474c
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 15 deletions.
4 changes: 2 additions & 2 deletions backend/services/interfaces/taskService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
12 changes: 2 additions & 10 deletions frontend/src/APIClients/Types/TaskType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
7 changes: 6 additions & 1 deletion frontend/src/components/pages/home/RoomGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<any[]>([]);
const { data: residentData } = useQuery(GET_ACTIVE_RESIDENTS);

const { data: pending } = useQuery(GET_TASKS_BY_STATUS, {
Expand All @@ -28,6 +29,10 @@ const RoomGrid = () => {
return { assignedTasks, pendingTasks, loading: false, error: null };
};

useEffect(() => {
setResidents(residentData?.getActiveResidents || []);
}, [pending, assigned, residentData]);

return (
<Flex justifyContent="center" alignItems="center" width="100%">
<Grid
Expand All @@ -39,7 +44,7 @@ const RoomGrid = () => {
gap="20px"
width="100%"
>
{residentData?.getAllResidents?.map(
{residents.map(
(room: {
roomNumber: string;
residentId: number;
Expand Down
1 change: 0 additions & 1 deletion frontend/src/components/pages/tasks/TaskModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 0 additions & 1 deletion frontend/src/components/pages/tasks/TasksPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ import {
RecurrenceFrequency,
DaysOfWeek,
TaskTypeEnum,
TaskLocation,
TaskResponse,
TaskRequest,
TaskAssignedRequest,
Expand Down

0 comments on commit 04d474c

Please sign in to comment.