forked from VallariAg/teuthology-api
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add PresetArgs schema, update Presets cmd column type
Added a schema for /add endpoint request body for validating cmd attribute. Updated the cmd column datatype from string to JSON for the Presets model. Signed-off-by: Devansh Singh <[email protected]>
- Loading branch information
1 parent
bd3b11d
commit 955c1dc
Showing
5 changed files
with
38 additions
and
13 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,14 @@ | ||
from sqlmodel import Field, SQLModel, UniqueConstraint | ||
from pydantic import ConfigDict | ||
from sqlmodel import Column, Field, JSON, SQLModel, UniqueConstraint | ||
|
||
|
||
class Presets(SQLModel, table=True): | ||
model_config = ConfigDict(arbitrary_types_allowed=True) | ||
|
||
id: int = Field(primary_key=True) | ||
username: str = Field(index=True) | ||
name: str | ||
suite: str | ||
cmd: str | ||
cmd: JSON = Field(sa_column=Column(JSON)) | ||
|
||
__table_args__ = (UniqueConstraint("username", "name"),) |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
from pydantic import BaseModel | ||
|
||
from teuthology_api.schemas.suite import SuiteArgs | ||
|
||
|
||
class PresetArgs(BaseModel): | ||
name: str | ||
suite: str | ||
cmd: SuiteArgs | ||
|
||
def model_post_init(self, __context): | ||
self.cmd = self.cmd.model_dump() |
This file contains 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