Skip to content

Conversation

@yesyash
Copy link
Collaborator

@yesyash yesyash commented Apr 6, 2023

For #51

Changes made:

  • Create an API endpoint to update attendee acknowledgment for an event.
  • Add zod validation to the API.

Note

  • There are four types of acknowledgments an attendee can have:

    1. Awaiting (default when a user is added to an event, waiting for the user to take an action)
    2. Accepted
    3. Declined
    4. Tentative (User may attend the event)
  • The API endpoint will only accept Accepted, Declined & Tentative as the new status to update because we wouldn't want an acknowledgment to be set back to Awaiting after the user has taken action to mark their acknowledgment.

Todo:

  • Add authentication middleware.
  • Write tests for the API endpoint.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can ignore this file as it is to fix the typescript eslint issue and got caught in this PR.

Copy link

@DeRaowl DeRaowl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good PR :)

});

if (updatedData && updatedData.acknowledgement === status) {
return res.json({ message: 'Acknowledgement status updated' });
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we move messages to constant files.

Copy link
Collaborator Author

@yesyash yesyash Apr 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As the message is specifically used for this controller will this change be required?

attendeeId: z.preprocess((a) => Number(a), z.number().positive()),
}),
body: z.object({
status: z.enum(['ACCEPTED', 'DECLINED', 'TENTATIVE']),
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here too. Let us keep it in constants

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants