implement server mvp: fastapi app, org formatter, sqlite store, tests, dockerfile
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
45
server/app/models.py
Normal file
45
server/app/models.py
Normal file
@@ -0,0 +1,45 @@
|
||||
from pydantic import BaseModel, field_validator
|
||||
from typing import Literal
|
||||
|
||||
|
||||
class CaptureRequest(BaseModel):
|
||||
id: str
|
||||
created_at: str
|
||||
kind: Literal["note", "todo"]
|
||||
body: str
|
||||
tags: list[str]
|
||||
device: str
|
||||
|
||||
@field_validator("body")
|
||||
@classmethod
|
||||
def body_must_not_be_empty(cls, v: str) -> str:
|
||||
stripped = v.strip()
|
||||
if not stripped:
|
||||
raise ValueError("body must not be empty")
|
||||
return stripped
|
||||
|
||||
@field_validator("id")
|
||||
@classmethod
|
||||
def id_must_not_be_empty(cls, v: str) -> str:
|
||||
if not v.strip():
|
||||
raise ValueError("id must not be empty")
|
||||
return v
|
||||
|
||||
@field_validator("device")
|
||||
@classmethod
|
||||
def device_must_not_be_empty(cls, v: str) -> str:
|
||||
if not v.strip():
|
||||
raise ValueError("device must not be empty")
|
||||
return v
|
||||
|
||||
|
||||
class CaptureResponse(BaseModel):
|
||||
ok: bool
|
||||
status: str
|
||||
id: str
|
||||
|
||||
|
||||
class HealthResponse(BaseModel):
|
||||
ok: bool
|
||||
service: str
|
||||
version: str
|
||||
Reference in New Issue
Block a user