Skip to content

Commit

Permalink
Collapse row (#165)
Browse files Browse the repository at this point in the history
* Collapse row

* Fix test

* corrected error messages

---------

Co-authored-by: Johnny Tan <[email protected]>
  • Loading branch information
nickbar01234 and johnny-t06 authored Apr 16, 2024
1 parent 3a65d8f commit 476a3bf
Show file tree
Hide file tree
Showing 4 changed files with 170 additions and 134 deletions.
35 changes: 26 additions & 9 deletions src/app/api/chapter-request/route.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,38 @@ import { z } from "zod";
questions String
*/
export const ChapterRequest = z.object({
firstName: z.string().min(1, "Please provide a first name"),
lastName: z.string().min(1, "Please provide a last name"),
universityEmail: z.string().email("This is not a valid email"),
firstName: z
.string()
.min(1, "Please provide a first name")
.max(100, "You can provide at most 100 characters"),
lastName: z
.string()
.min(1, "Please provide a last name")
.max(100, "You can provide at most 100 characters"),
universityEmail: z.string().max(100).email("Please provide a valid email"),
phoneNumber: z.string().length(10, "Phone number must be 10 digits"),
university: z.string().min(1, "Please provide a university"),
universityAddress: z.string().min(1, "Please provide an address"),
university: z
.string()
.min(1, "Please provide a university")
.max(100, "You can provide at most 100 characters"),
universityAddress: z
.string()
.min(1, "Please provide an address")
.max(100, "You can provide at most 100 characters"),
leadershipExperience: z
.string()
.min(1, "Please state some leadership experience"),
.min(1, "Please state some leadership experience")
.max(250, "You can provide at most 250 characters"),
motivation: z
.string()
.min(1, "Please describe your motivation in joining the legacy project"),
.min(1, "Please describe your motivation in joining the Legacy Project")
.max(250, "You can provide at most 250 characters"),
// TODO: Figure out if availabilities should have a better type
availabilities: z.string().min(1, "Please provide some times"),
questions: z.string(),
availabilities: z
.string()
.min(1, "Please provide some availability")
.max(100, "You can provide at most 100 characters"),
questions: z.string().max(100, "You can provide at most 100 characters"),
}) satisfies z.ZodType<Prisma.ChapterRequestCreateInput>;

export const ChapterRequestResponse = z.discriminatedUnion("code", [
Expand Down
2 changes: 1 addition & 1 deletion src/app/api/chapter-request/route.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ describe("ChapterRequest", () => {
availabilities: "I am available",
questions: "I have a question",
})
).toThrowError("This is not a valid email");
).toThrowError("Please provide a valid email");
});
});
2 changes: 1 addition & 1 deletion src/app/public/start-chapter/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const StartChapter = () => {
<p className="py-3">
{" "}
For additional information, feel free to reach out at{" "}
<strong> [email protected] </strong>
<strong> [email protected].</strong>
</p>
</div>
<NewChapterForm />
Expand Down
Loading

0 comments on commit 476a3bf

Please sign in to comment.