fix: create permission endpoint
Verifies service exists before attaching permission. Response built manually because calculated properties are not handled by .__dict()__ Request model uses Service ID mixin. Service ID mixin verifies ID > 0
This commit is contained in:
parent
5d1606aa9d
commit
ae0181c3ff
3 changed files with 13 additions and 9 deletions
|
|
@ -6,12 +6,12 @@ Models follow the nomenclature of:
|
|||
- Mixins: "<Attribute>Mixin"
|
||||
- Models: "<Module><Method><Resource><Opt:Resource><Direction>" ie "ServiceGetServiceResponse"
|
||||
"""
|
||||
from pydantic import ConfigDict
|
||||
from pydantic import ConfigDict, Field
|
||||
|
||||
from src.schemas import CustomBaseModel
|
||||
|
||||
class ServiceIDMixin(CustomBaseModel):
|
||||
service_id: int
|
||||
service_id: int = Field(gt=0)
|
||||
|
||||
class ServiceSchema(CustomBaseModel):
|
||||
model_config = ConfigDict(from_attributes=True, extra="ignore")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue