first commit
This commit is contained in:
commit
d416fe4cce
69 changed files with 8269 additions and 0 deletions
47
backend/app/schemas/records.py
Normal file
47
backend/app/schemas/records.py
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
from datetime import datetime
|
||||
|
||||
from pydantic import BaseModel, Field, field_validator
|
||||
|
||||
|
||||
class ParentBlobBase(BaseModel):
|
||||
iv: str = Field(min_length=1)
|
||||
ciphertext: str = Field(min_length=1)
|
||||
|
||||
|
||||
class ParentCreateRequest(ParentBlobBase):
|
||||
pass
|
||||
|
||||
|
||||
class ParentUpdateRequest(ParentBlobBase):
|
||||
pass
|
||||
|
||||
|
||||
class ChildCreateRequest(ParentBlobBase):
|
||||
parentId: str = Field(min_length=1)
|
||||
|
||||
@field_validator("parentId")
|
||||
@classmethod
|
||||
def strip_parent_id(cls, value: str) -> str:
|
||||
normalized = value.strip()
|
||||
if not normalized:
|
||||
raise ValueError("parentId cannot be empty")
|
||||
return normalized
|
||||
|
||||
|
||||
class ChildUpdateRequest(ParentBlobBase):
|
||||
pass
|
||||
|
||||
|
||||
class ParentRecordResponse(ParentBlobBase):
|
||||
id: str
|
||||
ownerId: str
|
||||
createdAt: datetime
|
||||
updatedAt: datetime
|
||||
|
||||
|
||||
class ChildRecordResponse(ParentBlobBase):
|
||||
id: str
|
||||
parentId: str
|
||||
ownerId: str
|
||||
createdAt: datetime
|
||||
updatedAt: datetime
|
||||
Loading…
Add table
Add a link
Reference in a new issue