feat: add database schema and backend foundation
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
This commit is contained in:
23
backend/internal/models/document.go
Normal file
23
backend/internal/models/document.go
Normal file
@@ -0,0 +1,23 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"time"
|
||||
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
type Document struct {
|
||||
ID uuid.UUID `db:"id" json:"id"`
|
||||
TenantID uuid.UUID `db:"tenant_id" json:"tenant_id"`
|
||||
CaseID uuid.UUID `db:"case_id" json:"case_id"`
|
||||
Title string `db:"title" json:"title"`
|
||||
DocType *string `db:"doc_type" json:"doc_type,omitempty"`
|
||||
FilePath *string `db:"file_path" json:"file_path,omitempty"`
|
||||
FileSize *int `db:"file_size" json:"file_size,omitempty"`
|
||||
MimeType *string `db:"mime_type" json:"mime_type,omitempty"`
|
||||
AIExtracted *json.RawMessage `db:"ai_extracted" json:"ai_extracted,omitempty"`
|
||||
UploadedBy *uuid.UUID `db:"uploaded_by" json:"uploaded_by,omitempty"`
|
||||
CreatedAt time.Time `db:"created_at" json:"created_at"`
|
||||
UpdatedAt time.Time `db:"updated_at" json:"updated_at"`
|
||||
}
|
||||
Reference in New Issue
Block a user