-
Notifications
You must be signed in to change notification settings - Fork 2
Config Management: Updates #42
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
Changes from all commits
fb5474f
d2cf70a
06875d1
36b0b56
318ace7
58cf156
fc7b8f8
4a65ab5
e305d6a
a9d4546
d58827f
8f53460
ccceca1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,4 +1,5 @@ | ||||||||||
| from typing import Optional | ||||||||||
| import logging | ||||||||||
| from typing import List, Optional | ||||||||||
| from uuid import UUID | ||||||||||
|
|
||||||||||
| from fastapi import HTTPException | ||||||||||
|
|
@@ -10,6 +11,8 @@ | |||||||||
| from app.schemas.validator_config import ValidatorCreate | ||||||||||
| from app.utils import now, split_validator_payload | ||||||||||
|
|
||||||||||
| logger = logging.getLogger(__name__) | ||||||||||
|
|
||||||||||
|
|
||||||||||
| class ValidatorConfigCrud: | ||||||||||
| def create( | ||||||||||
|
|
@@ -48,14 +51,18 @@ def list( | |||||||||
| session: Session, | ||||||||||
| organization_id: int, | ||||||||||
| project_id: int, | ||||||||||
| ids: Optional[list[UUID]] = None, | ||||||||||
| stage: Optional[Stage] = None, | ||||||||||
| type: Optional[ValidatorType] = None, | ||||||||||
| ) -> list[dict]: | ||||||||||
| ) -> List[dict]: | ||||||||||
| query = select(ValidatorConfig).where( | ||||||||||
| ValidatorConfig.organization_id == organization_id, | ||||||||||
| ValidatorConfig.project_id == project_id, | ||||||||||
| ) | ||||||||||
|
|
||||||||||
| if ids: | ||||||||||
| query = query.where(ValidatorConfig.id.in_(ids)) | ||||||||||
|
Comment on lines
+63
to
+64
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Proposed fix- if ids:
+ if ids is not None:
query = query.where(ValidatorConfig.id.in_(ids))📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||
|
|
||||||||||
| if stage: | ||||||||||
| query = query.where(ValidatorConfig.stage == stage) | ||||||||||
|
|
||||||||||
|
|
@@ -118,7 +125,8 @@ def delete(self, session: Session, obj: ValidatorConfig): | |||||||||
|
|
||||||||||
| def flatten(self, row: ValidatorConfig) -> dict: | ||||||||||
| base = row.model_dump(exclude={"config"}) | ||||||||||
| return {**base, **(row.config or {})} | ||||||||||
| config = row.config or {} | ||||||||||
| return {**base, **config} | ||||||||||
|
|
||||||||||
|
|
||||||||||
| validator_config_crud = ValidatorConfigCrud() | ||||||||||
Uh oh!
There was an error while loading. Please reload this page.