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:
2026-05-17 16:16:30 -04:00
parent 5f387dfb4a
commit e873a0055f
10 changed files with 499 additions and 0 deletions

45
server/app/models.py Normal file
View 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