Skip to content

Commit

Permalink
api: update the quota api so that it's more consistent with the other…
Browse files Browse the repository at this point in the history
… apis endpoints (PROJQUAY-2936) (#1221)

* api: update the quota api so that it's more consistent with the other apis (PROJQUAY-2936)

- Uodate the quota api to be more consistent with the rest of the
endpoints
- Handles some uncaught exceptions, such as division by zero
- Update some of the quota data models used by the api to take object
  references instead of names to make it easier to use
- Update table model naming conventions
- swagger operationid multiple nicknames
- Added more test cases for api
- Remove unused functions
- Update the UI for better UX, based on the api changes made

* quota: fix ui input form value

* quota: join quota type query

* Remove unused functions
  • Loading branch information
kleesc authored Apr 7, 2022
1 parent a79f7b6 commit 896a3aa
Show file tree
Hide file tree
Showing 27 changed files with 1,310 additions and 975 deletions.
11 changes: 8 additions & 3 deletions data/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -769,18 +769,23 @@ class RobotAccountToken(BaseModel):
fully_migrated = BooleanField(default=False)


class QuotaTypes(object):
WARNING = "Warning"
REJECT = "Reject"


class QuotaType(BaseModel):
name = CharField()


class UserOrganizationQuota(BaseModel):
namespace_id = QuayUserField(index=True, unique=True)
namespace = QuayUserField(index=True, unique=True)
limit_bytes = BigIntegerField()


class QuotaLimits(BaseModel):
quota_id = ForeignKeyField(UserOrganizationQuota)
quota_type_id = ForeignKeyField(QuotaType)
quota = ForeignKeyField(UserOrganizationQuota)
quota_type = ForeignKeyField(QuotaType)
percent_of_limit = IntegerField(default=0)


Expand Down
12 changes: 12 additions & 0 deletions data/model/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,18 @@ class QuotaExceededException(DataModelException):
pass


class InvalidNamespaceQuota(DataModelException):
pass


class InvalidNamespaceQuotaLimit(DataModelException):
pass


class InvalidNamespaceQuotaType(DataModelException):
pass


class TooManyLoginAttemptsException(Exception):
def __init__(self, message, retry_after):
super(TooManyLoginAttemptsException, self).__init__(message)
Expand Down
Loading

0 comments on commit 896a3aa

Please sign in to comment.