feat: reporting dashboard with charts (P1)

This commit is contained in:
m
2026-03-30 11:29:35 +02:00
15 changed files with 1798 additions and 160 deletions

View File

@@ -14,19 +14,6 @@ const (
userRoleKey contextKey = "user_role"
ipKey contextKey = "ip_address"
userAgentKey contextKey = "user_agent"
<<<<<<< HEAD
||||||| 8e65463
||||||| 82878df
userIDKey contextKey = "user_id"
tenantIDKey contextKey = "tenant_id"
=======
userIDKey contextKey = "user_id"
tenantIDKey contextKey = "tenant_id"
userRoleKey contextKey = "user_role"
>>>>>>> mai/pike/p0-role-based
=======
userRoleKey contextKey = "user_role"
>>>>>>> mai/ritchie/p1-document-templates
)
func ContextWithUserID(ctx context.Context, userID uuid.UUID) context.Context {
@@ -46,7 +33,6 @@ func TenantFromContext(ctx context.Context) (uuid.UUID, bool) {
id, ok := ctx.Value(tenantIDKey).(uuid.UUID)
return id, ok
}
<<<<<<< HEAD
func ContextWithUserRole(ctx context.Context, role string) context.Context {
return context.WithValue(ctx, userRoleKey, role)
@@ -56,10 +42,6 @@ func UserRoleFromContext(ctx context.Context) string {
role, _ := ctx.Value(userRoleKey).(string)
return role
}
||||||| 8e65463
<<<<<<< HEAD
=======
>>>>>>> mai/ritchie/p1-document-templates
func ContextWithRequestInfo(ctx context.Context, ip, userAgent string) context.Context {
ctx = context.WithValue(ctx, ipKey, ip)
@@ -80,28 +62,3 @@ func UserAgentFromContext(ctx context.Context) *string {
}
return nil
}
<<<<<<< HEAD
||||||| 8e65463
||||||| 82878df
=======
func ContextWithUserRole(ctx context.Context, role string) context.Context {
return context.WithValue(ctx, userRoleKey, role)
}
func UserRoleFromContext(ctx context.Context) string {
role, _ := ctx.Value(userRoleKey).(string)
return role
}
>>>>>>> mai/pike/p0-role-based
=======
func ContextWithUserRole(ctx context.Context, role string) context.Context {
return context.WithValue(ctx, userRoleKey, role)
}
func UserRoleFromContext(ctx context.Context) string {
role, _ := ctx.Value(userRoleKey).(string)
return role
}
>>>>>>> mai/ritchie/p1-document-templates

View File

@@ -35,6 +35,8 @@ func (m *Middleware) RequireAuth(next http.Handler) http.Handler {
}
ctx := ContextWithUserID(r.Context(), userID)
// Tenant resolution is handled by TenantResolver middleware for scoped routes.
// Tenant management routes handle their own access control.
// Capture IP and user-agent for audit logging
ip := r.Header.Get("X-Forwarded-For")
@@ -43,9 +45,6 @@ func (m *Middleware) RequireAuth(next http.Handler) http.Handler {
}
ctx = ContextWithRequestInfo(ctx, ip, r.UserAgent())
// Tenant resolution is handled by TenantResolver middleware for scoped routes.
// Tenant management routes handle their own access control.
next.ServeHTTP(w, r.WithContext(ctx))
})
}