Skip to content

Commit f12220a

Browse files
authored
Merge pull request #143 from uwblueprint/karthik-pranav/schedule-page
Karthik pranav/schedule page
2 parents ba85125 + 846f6a0 commit f12220a

25 files changed

+15642
-1071
lines changed

backend/graphql/resolvers/assignedtaskResolver.ts

Whitespace-only changes.

backend/graphql/resolvers/participantResolver.ts

Lines changed: 80 additions & 128 deletions
Original file line numberDiff line numberDiff line change
@@ -4,136 +4,88 @@ import IParticipantService from "../../services/interface/participantInterface";
44

55
const participantService: IParticipantService = new ParticipantService();
66
const participantResolvers = {
7-
Query: {
8-
getPastParticipants: async (): Promise<Participant[]> => {
9-
return participantService.getPastParticipants();
7+
Query: {
8+
getPastParticipants: async (): Promise<Participant[]> => {
9+
return participantService.getPastParticipants();
10+
},
11+
getCurrentParticipants: async (): Promise<Participant[]> => {
12+
return participantService.getCurrentParticipants();
13+
},
14+
getParticipantById: async (
15+
_parent: undefined,
16+
{ participantId }: { participantId: string },
17+
): Promise<Participant | null> => {
18+
return participantService.getParticipantById(participantId);
19+
},
20+
getParticipantByRoom: async (
21+
_parent: undefined,
22+
{ roomNumber }: { roomNumber: number },
23+
): Promise<Participant | null> => {
24+
return participantService.getParticipantByRoom(roomNumber);
25+
}
1026
},
11-
getCurrentParticipants: async (): Promise<Participant[]> => {
12-
return participantService.getCurrentParticipants();
27+
Mutation: {
28+
createParticipant: async (
29+
_parent: undefined,
30+
{
31+
participantId,
32+
roomNumber,
33+
arrival,
34+
password,
35+
}: {
36+
participantId: string;
37+
roomNumber: number;
38+
arrival: string;
39+
password: string;
40+
},
41+
): Promise<boolean> => {
42+
return participantService.createParticipant(
43+
participantId,
44+
roomNumber,
45+
arrival,
46+
password,
47+
);
48+
},
49+
updateParticipantById: async (
50+
_parent: undefined,
51+
{
52+
participantId,
53+
roomNumber,
54+
arrival,
55+
departure,
56+
password,
57+
}: {
58+
participantId: string;
59+
roomNumber?: number;
60+
arrival?: string;
61+
departure?: string;
62+
password?: string;
63+
},
64+
): Promise<boolean> => {
65+
return participantService.updateParticipantById(
66+
participantId,
67+
roomNumber,
68+
arrival,
69+
departure,
70+
password,
71+
);
72+
},
73+
editMarillacBucks: async (
74+
_parent: undefined,
75+
{
76+
participantId,
77+
credit
78+
}: {
79+
participantId: string;
80+
credit: number;
81+
},
82+
): Promise<boolean> => {
83+
return participantService.updateParticipantCredit(
84+
participantId,
85+
credit
86+
);
87+
},
1388
},
14-
getParticipantById: async (
15-
_parent: undefined,
16-
{ participantId }: { participantId: string },
17-
): Promise<Participant | null> => {
18-
return participantService.getParticipantById(participantId);
19-
},
20-
},
21-
Mutation: {
22-
createParticipant: async (
23-
_parent: undefined,
24-
{
25-
participantId,
26-
roomNumber,
27-
arrival,
28-
password,
29-
}: {
30-
participantId: string;
31-
roomNumber: number;
32-
arrival: string;
33-
password: string;
34-
},
35-
): Promise<boolean> => {
36-
return participantService.createParticipant(
37-
participantId,
38-
roomNumber,
39-
arrival,
40-
password,
41-
);
42-
},
43-
updateParticipantById: async (
44-
_parent: undefined,
45-
{
46-
participantId,
47-
roomNumber,
48-
arrival,
49-
departure,
50-
password,
51-
}: {
52-
participantId: string;
53-
roomNumber?: number;
54-
arrival?: string;
55-
departure?: string;
56-
password?: string;
57-
},
58-
): Promise<boolean> => {
59-
return participantService.updateParticipantById(
60-
participantId,
61-
roomNumber,
62-
arrival,
63-
departure,
64-
password,
65-
);
66-
},
67-
},
6889
};
6990

7091
export default participantResolvers;
71-
72-
// import IResidentService, {
73-
// ResidentDTO,
74-
// CreateResidentDTO,
75-
// UpdateResidentDTO,
76-
// RedeemCreditsResponse,
77-
// } from "../../services/interface/residentService";
78-
79-
// const residentResolvers = {
80-
// Query: {
81-
// getResidentsByIds: async (
82-
// _parent: undefined,
83-
// { userIds }: { userIds: string[] },
84-
// ): Promise<Array<ResidentDTO>> => {
85-
// return residentService.getResidentsByIds(userIds.map(Number));
86-
// },
87-
// getAllResidents: async (): Promise<Array<ResidentDTO>> => {
88-
// return residentService.getAllResidents();
89-
// },
90-
// getActiveResidents: async (): Promise<ResidentDTO[]> => {
91-
// const activeResidents = await residentService.getActiveResidents();
92-
// return activeResidents;
93-
// },
94-
// },
95-
// Mutation: {
96-
// addResident: async (
97-
// _parent: undefined,
98-
// {
99-
// resident,
100-
// }: {
101-
// resident: CreateResidentDTO;
102-
// },
103-
// ): Promise<ResidentDTO> => {
104-
// const newResident = await residentService.addResident(resident);
105-
// return newResident;
106-
// },
107-
// updateResident: async (
108-
// _parent: undefined,
109-
// {
110-
// userId,
111-
// resident,
112-
// }: {
113-
// userId: string;
114-
// resident: UpdateResidentDTO;
115-
// },
116-
// ): Promise<ResidentDTO> => {
117-
// const newResident = await residentService.updateResident(
118-
// parseInt(userId, 10),
119-
// resident,
120-
// );
121-
// return newResident;
122-
// },
123-
// deleteResident: async (
124-
// _parent: undefined,
125-
// { userId }: { userId: string },
126-
// ): Promise<ResidentDTO> => {
127-
// const deletedResident = await residentService.deleteResident(
128-
// parseInt(userId, 10),
129-
// );
130-
// return deletedResident;
131-
// },
132-
// redeemCredits: async (
133-
// _parent: undefined,
134-
// { userId, credits }: { userId: string; credits: number },
135-
// ): Promise<RedeemCreditsResponse> => {
136-
// return residentService.redeemCredits(parseInt(userId, 10), credits);
137-
// },
138-
// },
139-
// };

backend/graphql/types/models.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,20 @@ const dataModels = gql`
4343
type: String!
4444
accessToken: String!
4545
}
46+
type AssignedTask {
47+
assignedTaskId: Int!
48+
userID: Int!
49+
type: TaskType!
50+
name: String!
51+
recurrencePreference: RecurrenceFrequency!
52+
repeatDays: [String]!
53+
timePreference: TimeOption!
54+
start: String
55+
end: String
56+
credit: Int!
57+
deduction: Int!
58+
comment: String
59+
}
4660
`;
4761

4862
export default dataModels;

backend/graphql/types/resolvers.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ const resolverTypes = gql`
55
getPastParticipants: [Participant]
66
getCurrentParticipants: [Participant]
77
getParticipantById(participantId: String!): Participant
8+
getParticipantByRoom(roomNumber: Int): Participant
89
getNotes: [Note]
910
getTaskById(taskId: Int!): Task!
1011
getTasksByType(type: TaskType!): [Task!]
@@ -56,6 +57,24 @@ const resolverTypes = gql`
5657
comment: String
5758
): Task!
5859
deleteTask(taskId: Int!): Task!
60+
createAssignedTask(
61+
assignedTaskId: Int
62+
userID: Int
63+
type: TaskType!
64+
name: String!
65+
recurrencePreference: RecurrenceFrequency
66+
repeatDays: [String]
67+
timePreference: TimeOption!
68+
start: String
69+
end: String
70+
credit: Int!
71+
deduction: Int
72+
comment: String
73+
): AssignedTask
74+
editMarillacBucks(
75+
participantId: String
76+
credit: Int
77+
): Boolean
5978
}
6079
`;
6180

0 commit comments

Comments
 (0)