-
Notifications
You must be signed in to change notification settings - Fork 12
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
PUT / Update Community-Event API #107
PUT / Update Community-Event API #107
Conversation
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.
Looks great! I love the validation system 👍
I left some suggestions below, so let me know what you think.
server/src/modules/community-event/validations/updateCommunityEventReqVal.ts
Outdated
Show resolved
Hide resolved
When we create a new event can we set the POST to have nobody? We should create a new empty event and then immediately load it into an event edit page to fill in the details. So we would need only to return the id on the creation of an event. What does everyone think? |
just looked further at the code. Looks like what I just posted would work based on the validation schema |
So should we make the requirement of a community event needing a user(organizer) optional for now? |
@igMike-V That is a good point 👍 I'll merge this PR and have the following issue for the fixes. |
Created the update API following the structure created by @1234tgk and also added validation to the to the update api to prevent invalid user requests
Example of Request:
Post request created by @1234tgk on the left and put request created by me on the right
Additions
src/middleware/errorHandler.ts
src/utils/errors
that can be used to throw Custom Errors within the application with already configured status codes. e.g BadRequestError, InternalServerError, ConflictError, UnauthorizedError, and NotFoundError.src/utils/validation/validationParser.ts
)Before:
After: