Add endpoint for retrieving available project resources#645
Open
Add endpoint for retrieving available project resources#645
Conversation
2aae38f to
96ea320
Compare
41296bf to
f4f8e71
Compare
9ec95c9 to
0221bdd
Compare
0221bdd to
d5bcf2f
Compare
29da6e9 to
fd2b801
Compare
fd2b801 to
28ddbca
Compare
f6ae708 to
ce97876
Compare
There was a problem hiding this comment.
Pull request overview
Adds a new set of resource “limits / allocations / available” endpoints (system-, organization-, and project-scoped) backed by newly introduced helper dataclasses and computation helpers in the resource-limit utility layer.
Changes:
- Introduces
Limits/Resourcesdataclasses and newsystem_*/organization_*/project_*helper functions for resource computations. - Adds new REST endpoints under
/resources,/organizations/{org_id}/resources, and/organizations/{org_id}/projects/{project_id}/resources. - Adds a
Project.storage_enabledasync property to conditionally hidestorage_sizein some project resource responses.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 12 comments.
Show a summary per file
| File | Description |
|---|---|
| src/api/_util/resourcelimit.py | Adds Limits/Resources abstractions and new system/org/project limit/allocation/available helpers. |
| src/api/resources.py | Renames router to api and adds system-level /resources/{limits,allocations,available} endpoints. |
| src/api/organization/resources.py | Adds organization-scoped /resources/{limits,allocations,available} endpoints plus limit updates. |
| src/api/organization/project/resources.py | Adds project-scoped /resources/{limits,allocations,available} endpoints plus limit updates and conditional storage field exclusion. |
| src/api/organization/project/init.py | Wires the new project resources router and modifies project persistence during creation. |
| src/api/organization/init.py | Wires the new organization resources router. |
| src/api/init.py | Wires the (renamed) top-level resources router. |
| src/models/project.py | Adds an async storage_enabled property based on presence of storage limits. |
| src/_util/init.py | Adds empty() and single_or_none() helpers used by new resource computations. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
ce97876 to
86bafb2
Compare
86bafb2 to
b7b12e0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Introduce an endpoint to check a project's available resources. The endpoint is embedded in the regular endpoint hierarchy and uses newly introduced helpers for computation because the existing logic is convoluted and resists incremental change. The idea is to replace it eventually by the new approach that uses dedicated abstractions for handling resource computations.