forked from tryyang2001/CS3213-Frontend-Management-System
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request tryyang2001#80 from tryyang2001/tryyang/update_ass…
…ignment_integration_logic Update getAssignments endpoint and fix frontend bugs
- Loading branch information
Showing
16 changed files
with
348 additions
and
223 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
backend/assignment-service/src/libs/validators/assignments/get-assignments-validator.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { z } from "zod"; | ||
|
||
export const GetAssignmentsQueryValidator = z.object({ | ||
userId: z | ||
.string() | ||
.refine((id) => { | ||
const parsedId = parseInt(id); | ||
return !isNaN(parsedId) && parsedId > 0; | ||
}, "Invalid userId format") | ||
.transform((id) => parseInt(id)), | ||
includePast: z | ||
.string() | ||
.refine((value) => value === "true" || value === "false") | ||
.transform((value) => value === "true") | ||
.optional(), | ||
isPublished: z | ||
.string() | ||
.refine((value) => value === "true" || value === "false") | ||
.transform((value) => value === "true") | ||
.optional(), | ||
}); | ||
|
||
export type GetAssignmentsQuery = z.infer<typeof GetAssignmentsQueryValidator>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.