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

SubscriptionId should not be null #36

Closed
2 tasks
gothub opened this issue Jun 25, 2020 · 2 comments
Closed
2 tasks

SubscriptionId should not be null #36

gothub opened this issue Jun 25, 2020 · 2 comments
Assignees
Milestone

Comments

@gothub
Copy link
Collaborator

gothub commented Jun 25, 2020

It's possible to create a quota db entry with a null subscription, if the subscription attribute is omitted from the JSON object sent via the POST /quotas (QuotasResource.create()) REST endpoint.

SInce quotas.subscriptionId in the quotas table is a foreign key to the subscriptions table, this field should not be null.

So,

  • update the Java annotations in Quota.java so that valid quota objects have a subscription id
  • add a 'NOT NULL' clause to the quotas table creation clause for subscriptionId
@csjx
Copy link
Member

csjx commented Jun 27, 2020

Hi @gothub - I made the subscriptionId nullable because we use the quotas table to satisfy two use cases: 1) Provide a list of generic quotas associated with a given product, and then 2) associate a specific quota with a specific subscription. Since quotas are only created or modified by bookkeeper admin subjects, we can control scenario (2) above in the controller logic. So, unless I'm missing something, I think we need to back out your changes in commit c4e9581. Otherwise our SQL script that populates the standard quotas will fail.

gothub added a commit that referenced this issue Jun 29, 2020
@gothub
Copy link
Collaborator Author

gothub commented Jun 29, 2020

OK, the commit has been reverted in commit fd7628f

@gothub gothub closed this as completed Jun 29, 2020
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

No branches or pull requests

2 participants