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

fix: Check the amount of TP items to be published #482

Merged
merged 3 commits into from
Apr 6, 2022

Conversation

juanmahidalgo
Copy link
Contributor

Closes #480

image

@coveralls
Copy link

coveralls commented Apr 6, 2022

Pull Request Test Coverage Report for Build 2102601502

  • 12 of 12 (100.0%) changed or added relevant lines in 3 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.1%) to 69.048%

Totals Coverage Status
Change from base Build 2090091168: 0.1%
Covered Lines: 2412
Relevant Lines: 3349

💛 - Coveralls

Comment on lines 317 to 326
const availableSlots = await this.tpService.getThirdPartyAvailableSlots(
dbCollection.third_party_id
)
if (itemIds.length > availableSlots) {
throw new HTTPError(
'The amount of items to publish exceeds the available slots',
null,
STATUS_CODES.badRequest
)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Would you mind putting this into the publishTPCollection method?
We'll need to create a custom Error and catch it as well.

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, what if we use a 409 for this error?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Absolutely! updated :)

@juanmahidalgo juanmahidalgo merged commit f8821dc into master Apr 6, 2022
@juanmahidalgo juanmahidalgo deleted the fix/check-tp-available-slots branch April 6, 2022 13:16
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.

A set of TP items greater than the amount of slots available can be published
3 participants