Compare commits
7 Commits
mai/brunel
...
mai/knuth/
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
68d48100b9 | ||
|
|
5e401d2eac | ||
|
|
3f90904e0c | ||
|
|
f285d4451d | ||
|
|
bf1b1cdd82 | ||
|
|
9d89b97ad5 | ||
|
|
2f572fafc9 |
@@ -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
|
- **Frontend:** Next.js 15 with TypeScript, Tailwind CSS v4, App Router, Bun
|
||||||
- **Backend:** Go (standard library HTTP server)
|
- **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
|
- **Deploy:** Dokploy on mLake, domain: kanzlai.msbls.de
|
||||||
|
|
||||||
## Development
|
## Development
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/jmoiron/sqlx"
|
|
||||||
_ "github.com/lib/pq"
|
_ "github.com/lib/pq"
|
||||||
|
|
||||||
"mgit.msbls.de/m/KanzlAI-mGMT/internal/auth"
|
"mgit.msbls.de/m/KanzlAI-mGMT/internal/auth"
|
||||||
@@ -34,21 +33,6 @@ func main() {
|
|||||||
|
|
||||||
authMW := auth.NewMiddleware(cfg.SupabaseJWTSecret, database)
|
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
|
// Start CalDAV sync service
|
||||||
calDAVSvc := services.NewCalDAVService(database)
|
calDAVSvc := services.NewCalDAVService(database)
|
||||||
calDAVSvc.Start()
|
calDAVSvc.Start()
|
||||||
@@ -59,7 +43,7 @@ func main() {
|
|||||||
notifSvc.Start()
|
notifSvc.Start()
|
||||||
defer notifSvc.Stop()
|
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)
|
slog.Info("starting KanzlAI API server", "port", cfg.Port)
|
||||||
if err := http.ListenAndServe(":"+cfg.Port, handler); err != nil {
|
if err := http.ListenAndServe(":"+cfg.Port, handler); err != nil {
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ type Config struct {
|
|||||||
SupabaseJWTSecret string
|
SupabaseJWTSecret string
|
||||||
AnthropicAPIKey string
|
AnthropicAPIKey string
|
||||||
FrontendOrigin string
|
FrontendOrigin string
|
||||||
YouPCDatabaseURL string // read-only connection to youpc.org Supabase for similar case finder
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func Load() (*Config, error) {
|
func Load() (*Config, error) {
|
||||||
@@ -27,7 +26,6 @@ func Load() (*Config, error) {
|
|||||||
SupabaseJWTSecret: os.Getenv("SUPABASE_JWT_SECRET"),
|
SupabaseJWTSecret: os.Getenv("SUPABASE_JWT_SECRET"),
|
||||||
AnthropicAPIKey: os.Getenv("ANTHROPIC_API_KEY"),
|
AnthropicAPIKey: os.Getenv("ANTHROPIC_API_KEY"),
|
||||||
FrontendOrigin: getEnv("FRONTEND_ORIGIN", "https://kanzlai.msbls.de"),
|
FrontendOrigin: getEnv("FRONTEND_ORIGIN", "https://kanzlai.msbls.de"),
|
||||||
YouPCDatabaseURL: os.Getenv("YOUPC_DATABASE_URL"),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if cfg.DatabaseURL == "" {
|
if cfg.DatabaseURL == "" {
|
||||||
|
|||||||
@@ -13,8 +13,8 @@ func Connect(databaseURL string) (*sqlx.DB, error) {
|
|||||||
return nil, fmt.Errorf("connecting to database: %w", err)
|
return nil, fmt.Errorf("connecting to database: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set search_path so queries use kanzlai schema by default
|
// Set search_path so queries use mgmt schema by default
|
||||||
if _, err := db.Exec("SET search_path TO kanzlai, public"); err != nil {
|
if _, err := db.Exec("SET search_path TO mgmt, public"); err != nil {
|
||||||
db.Close()
|
db.Close()
|
||||||
return nil, fmt.Errorf("setting search_path: %w", err)
|
return nil, fmt.Errorf("setting search_path: %w", err)
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -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)
|
scoped.HandleFunc("GET /api/caldav/status", calDAVH.GetStatus)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reports — billing permission (partners + owners)
|
// Reports — cases/deadlines/workload open to all, billing restricted
|
||||||
scoped.HandleFunc("GET /api/reports/cases", perm(auth.PermManageBilling, reportH.Cases))
|
scoped.HandleFunc("GET /api/reports/cases", reportH.Cases)
|
||||||
scoped.HandleFunc("GET /api/reports/deadlines", perm(auth.PermManageBilling, reportH.Deadlines))
|
scoped.HandleFunc("GET /api/reports/deadlines", reportH.Deadlines)
|
||||||
scoped.HandleFunc("GET /api/reports/workload", perm(auth.PermManageBilling, reportH.Workload))
|
scoped.HandleFunc("GET /api/reports/workload", reportH.Workload)
|
||||||
scoped.HandleFunc("GET /api/reports/billing", perm(auth.PermManageBilling, reportH.Billing))
|
scoped.HandleFunc("GET /api/reports/billing", perm(auth.PermManageBilling, reportH.Billing))
|
||||||
|
|
||||||
// Time entries — all can view/create, tied to cases
|
// Time entries — all can view/create, tied to cases
|
||||||
|
|||||||
@@ -35,7 +35,9 @@ const inputClass =
|
|||||||
|
|
||||||
export function DeadlineCalculator() {
|
export function DeadlineCalculator() {
|
||||||
const [proceedingType, setProceedingType] = useState("");
|
const [proceedingType, setProceedingType] = useState("");
|
||||||
const [triggerDate, setTriggerDate] = useState("");
|
const [triggerDate, setTriggerDate] = useState(
|
||||||
|
new Date().toISOString().split("T")[0],
|
||||||
|
);
|
||||||
|
|
||||||
const { data: proceedingTypes, isLoading: typesLoading } = useQuery({
|
const { data: proceedingTypes, isLoading: typesLoading } = useQuery({
|
||||||
queryKey: ["proceeding-types"],
|
queryKey: ["proceeding-types"],
|
||||||
|
|||||||
Reference in New Issue
Block a user