Compare commits
6 Commits
2f572fafc9
...
mai/brunel
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cf3711b2e4 | ||
|
|
5e401d2eac | ||
|
|
3f90904e0c | ||
|
|
f285d4451d | ||
|
|
bf1b1cdd82 | ||
|
|
9d89b97ad5 |
@@ -18,7 +18,7 @@ frontend/ Next.js 15 (TypeScript, Tailwind CSS, App Router)
|
||||
|
||||
- **Frontend:** Next.js 15 with TypeScript, Tailwind CSS v4, App Router, Bun
|
||||
- **Backend:** Go (standard library HTTP server)
|
||||
- **Database:** Supabase (PostgreSQL) — `kanzlai` schema in flexsiebels instance
|
||||
- **Database:** Supabase (PostgreSQL) — `mgmt` schema in youpc.org instance
|
||||
- **Deploy:** Dokploy on mLake, domain: kanzlai.msbls.de
|
||||
|
||||
## Development
|
||||
|
||||
@@ -5,7 +5,6 @@ import (
|
||||
"net/http"
|
||||
"os"
|
||||
|
||||
"github.com/jmoiron/sqlx"
|
||||
_ "github.com/lib/pq"
|
||||
|
||||
"mgit.msbls.de/m/KanzlAI-mGMT/internal/auth"
|
||||
@@ -34,21 +33,6 @@ func main() {
|
||||
|
||||
authMW := auth.NewMiddleware(cfg.SupabaseJWTSecret, database)
|
||||
|
||||
// Optional: connect to youpc.org database for similar case finder
|
||||
var youpcDB *sqlx.DB
|
||||
if cfg.YouPCDatabaseURL != "" {
|
||||
youpcDB, err = sqlx.Connect("postgres", cfg.YouPCDatabaseURL)
|
||||
if err != nil {
|
||||
slog.Warn("failed to connect to youpc.org database — similar case finder disabled", "error", err)
|
||||
youpcDB = nil
|
||||
} else {
|
||||
youpcDB.SetMaxOpenConns(5)
|
||||
youpcDB.SetMaxIdleConns(2)
|
||||
defer youpcDB.Close()
|
||||
slog.Info("connected to youpc.org database for similar case finder")
|
||||
}
|
||||
}
|
||||
|
||||
// Start CalDAV sync service
|
||||
calDAVSvc := services.NewCalDAVService(database)
|
||||
calDAVSvc.Start()
|
||||
@@ -59,7 +43,7 @@ func main() {
|
||||
notifSvc.Start()
|
||||
defer notifSvc.Stop()
|
||||
|
||||
handler := router.New(database, authMW, cfg, calDAVSvc, notifSvc, youpcDB)
|
||||
handler := router.New(database, authMW, cfg, calDAVSvc, notifSvc, database)
|
||||
|
||||
slog.Info("starting KanzlAI API server", "port", cfg.Port)
|
||||
if err := http.ListenAndServe(":"+cfg.Port, handler); err != nil {
|
||||
|
||||
@@ -14,7 +14,6 @@ type Config struct {
|
||||
SupabaseJWTSecret string
|
||||
AnthropicAPIKey string
|
||||
FrontendOrigin string
|
||||
YouPCDatabaseURL string // read-only connection to youpc.org Supabase for similar case finder
|
||||
}
|
||||
|
||||
func Load() (*Config, error) {
|
||||
@@ -27,7 +26,6 @@ func Load() (*Config, error) {
|
||||
SupabaseJWTSecret: os.Getenv("SUPABASE_JWT_SECRET"),
|
||||
AnthropicAPIKey: os.Getenv("ANTHROPIC_API_KEY"),
|
||||
FrontendOrigin: getEnv("FRONTEND_ORIGIN", "https://kanzlai.msbls.de"),
|
||||
YouPCDatabaseURL: os.Getenv("YOUPC_DATABASE_URL"),
|
||||
}
|
||||
|
||||
if cfg.DatabaseURL == "" {
|
||||
|
||||
@@ -13,8 +13,8 @@ func Connect(databaseURL string) (*sqlx.DB, error) {
|
||||
return nil, fmt.Errorf("connecting to database: %w", err)
|
||||
}
|
||||
|
||||
// Set search_path so queries use kanzlai schema by default
|
||||
if _, err := db.Exec("SET search_path TO kanzlai, public"); err != nil {
|
||||
// Set search_path so queries use mgmt schema by default
|
||||
if _, err := db.Exec("SET search_path TO mgmt, public"); err != nil {
|
||||
db.Close()
|
||||
return nil, fmt.Errorf("setting search_path: %w", err)
|
||||
}
|
||||
|
||||
@@ -215,10 +215,10 @@ func New(db *sqlx.DB, authMW *auth.Middleware, cfg *config.Config, calDAVSvc *se
|
||||
scoped.HandleFunc("GET /api/caldav/status", calDAVH.GetStatus)
|
||||
}
|
||||
|
||||
// Reports — billing permission (partners + owners)
|
||||
scoped.HandleFunc("GET /api/reports/cases", perm(auth.PermManageBilling, reportH.Cases))
|
||||
scoped.HandleFunc("GET /api/reports/deadlines", perm(auth.PermManageBilling, reportH.Deadlines))
|
||||
scoped.HandleFunc("GET /api/reports/workload", perm(auth.PermManageBilling, reportH.Workload))
|
||||
// Reports — cases/deadlines/workload open to all, billing restricted
|
||||
scoped.HandleFunc("GET /api/reports/cases", reportH.Cases)
|
||||
scoped.HandleFunc("GET /api/reports/deadlines", reportH.Deadlines)
|
||||
scoped.HandleFunc("GET /api/reports/workload", reportH.Workload)
|
||||
scoped.HandleFunc("GET /api/reports/billing", perm(auth.PermManageBilling, reportH.Billing))
|
||||
|
||||
// Time entries — all can view/create, tied to cases
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
-- Creates 1 test tenant, 5 cases with deadlines and appointments
|
||||
-- Run with: psql $DATABASE_URL -f demo_data.sql
|
||||
|
||||
SET search_path TO kanzlai, public;
|
||||
SET search_path TO mgmt, public;
|
||||
|
||||
-- Demo tenant
|
||||
INSERT INTO tenants (id, name, slug, settings) VALUES
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
-- UPC Proceeding Timeline: Full event tree with conditional deadlines
|
||||
-- Ported from youpc.org migrations 039 + 040
|
||||
-- Run against kanzlai schema in flexsiebels Supabase instance
|
||||
-- Run against mgmt schema in youpc.org Supabase instance
|
||||
|
||||
-- ========================================
|
||||
-- 1. Add is_spawn + spawn_label columns
|
||||
|
||||
@@ -35,7 +35,9 @@ const inputClass =
|
||||
|
||||
export function DeadlineCalculator() {
|
||||
const [proceedingType, setProceedingType] = useState("");
|
||||
const [triggerDate, setTriggerDate] = useState("");
|
||||
const [triggerDate, setTriggerDate] = useState(
|
||||
new Date().toISOString().split("T")[0],
|
||||
);
|
||||
|
||||
const { data: proceedingTypes, isLoading: typesLoading } = useQuery({
|
||||
queryKey: ["proceeding-types"],
|
||||
|
||||
Reference in New Issue
Block a user