-
Notifications
You must be signed in to change notification settings - Fork 0
feat: added get form and get all form service (NOT READY FOR REVIEW) #10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Lindsay-X
commented
Jan 15, 2026
- added form route test
- added get all form route and get specific form route
- get all form logic: returns an array of (formId, seasonCode, openTime, closeTime, and tags)
- get specific form logic: returns formId, seasonCode, openTime, closeTime, tags, and responses based on formId in param
- added test for service logic
src/resources/form/forms.service.ts
Outdated
| .from(form) | ||
| .where(and(eq(form.seasonCode, seasonCode), eq(form.formId, formId))) | ||
| .limit(1); | ||
| const responses = await getFormResponses(seasonCode, formId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this was meant to get the questions right? not responses?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OH, ur right 💀 woops
src/resources/form/forms.service.ts
Outdated
| const responses = await getFormResponses(seasonCode, formId); | ||
| return formResult[0] | ||
| ? { | ||
| formId: formResult[0].formId, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you want you can do ...formResult[0] to just put in all the fields. the only other fields are formName (which should also be returned btw) and eventId (which im gonna remove in #12)
src/resources/form/forms.service.ts
Outdated
| questions?: CreateFormQuestionInput[]; | ||
| } | ||
|
|
||
| export const getForms = async (seasonCode: string, formId?: string) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: IMO this should be separated into 2 functions since it returns different types based on whether formId is provided (and since theres no shared logic).