Skip to content
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

Limit TEC Requests - BE Validation #617

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

patriciaahuang
Copy link
Contributor

Check in the backend that

  • the maximum credits cannot be greater than the team event credit
  • the maximum credits is a multiple of the team event credit

@patriciaahuang patriciaahuang requested a review from a team as a code owner May 6, 2024 15:51
@dti-github-bot
Copy link
Member

[diff-counting] Significant lines: 12.

Copy link
Collaborator

@henry-li-06 henry-li-06 left a comment

Choose a reason for hiding this comment

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

I think requestTeamEventCredit also needs this check right?

Comment on lines +51 to +56
if (Number(teamEventInfo.numCredits) > Number(teamEventInfo.maxCredits))
throw new BadRequestError('The maximum credits cannot be greater than the team event credit!');
if (Number(teamEventInfo.maxCredits) % Number(teamEventInfo.numCredits) !== 0)
throw new BadRequestError(
'The maximum credits needs to be a multiple of the team event credit!'
);
Copy link
Collaborator

Choose a reason for hiding this comment

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

could be nice to pull out a shared helper for this between this func and updateTeamEvent

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.

None yet

3 participants