Part 1 - Database (kanzlai schema in Supabase): - Tenant-scoped tables: tenants, user_tenants, cases, parties, deadlines, appointments, documents, case_events - Global reference tables: proceeding_types, deadline_rules, holidays - RLS policies on all tenant-scoped tables - Seed: UPC proceeding types, 32 deadline rules (INF/CCR/REV/PI/APP), ZPO civil rules (Berufung, Revision, Einspruch), 2026 holidays Part 2 - Backend skeleton: - config: env var loading (DATABASE_URL, SUPABASE_*, ANTHROPIC_API_KEY) - db: sqlx connection pool with kanzlai search_path - auth: JWT verification middleware adapted from youpc.org, context helpers - models: Go structs for all tables with sqlx/json tags - router: route registration with auth middleware, /health + placeholder API routes - Updated main.go to wire everything together
24 lines
857 B
Go
24 lines
857 B
Go
package models
|
|
|
|
import (
|
|
"encoding/json"
|
|
"time"
|
|
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
type Case struct {
|
|
ID uuid.UUID `db:"id" json:"id"`
|
|
TenantID uuid.UUID `db:"tenant_id" json:"tenant_id"`
|
|
CaseNumber string `db:"case_number" json:"case_number"`
|
|
Title string `db:"title" json:"title"`
|
|
CaseType *string `db:"case_type" json:"case_type,omitempty"`
|
|
Court *string `db:"court" json:"court,omitempty"`
|
|
CourtRef *string `db:"court_ref" json:"court_ref,omitempty"`
|
|
Status string `db:"status" json:"status"`
|
|
AISummary *string `db:"ai_summary" json:"ai_summary,omitempty"`
|
|
Metadata json.RawMessage `db:"metadata" json:"metadata"`
|
|
CreatedAt time.Time `db:"created_at" json:"created_at"`
|
|
UpdatedAt time.Time `db:"updated_at" json:"updated_at"`
|
|
}
|