feat: add case + party CRUD with case events (Phase 1B)
- CaseService: list (paginated, filterable), get detail (with parties, events, deadline count), create, update, soft-delete (archive) - PartyService: list by case, create, update, delete - Auto-create case_events on case creation, status change, party add, and case archive - Auth middleware now resolves tenant_id from user_tenants table - All operations scoped to tenant_id from auth context
This commit is contained in:
16
backend/internal/handlers/helpers.go
Normal file
16
backend/internal/handlers/helpers.go
Normal file
@@ -0,0 +1,16 @@
|
||||
package handlers
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func writeJSON(w http.ResponseWriter, status int, v interface{}) {
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
w.WriteHeader(status)
|
||||
json.NewEncoder(w).Encode(v)
|
||||
}
|
||||
|
||||
func writeError(w http.ResponseWriter, status int, message string) {
|
||||
writeJSON(w, status, map[string]string{"error": message})
|
||||
}
|
||||
Reference in New Issue
Block a user