Compare commits
8 Commits
mai/ritchi
...
d38719db2f
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d38719db2f | ||
|
|
b21efccfb5 | ||
|
|
f51d189a3b | ||
|
|
481b299e03 | ||
|
|
68d48100b9 | ||
|
|
40a11a4c49 | ||
|
|
eca0cde5e7 | ||
|
|
cf3711b2e4 |
File diff suppressed because it is too large
Load Diff
@@ -20,6 +20,7 @@ type UserTenant struct {
|
||||
UserID uuid.UUID `db:"user_id" json:"user_id"`
|
||||
TenantID uuid.UUID `db:"tenant_id" json:"tenant_id"`
|
||||
Role string `db:"role" json:"role"`
|
||||
Email string `db:"email" json:"email"`
|
||||
CreatedAt time.Time `db:"created_at" json:"created_at"`
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log/slog"
|
||||
"os"
|
||||
"os/exec"
|
||||
"strings"
|
||||
"sync"
|
||||
@@ -458,17 +459,25 @@ type UpdatePreferencesInput struct {
|
||||
}
|
||||
|
||||
// SendEmail sends an email using the `m mail send` CLI command.
|
||||
// In Docker, this will fail gracefully (m CLI not available).
|
||||
// TODO: Replace with direct SMTP for production.
|
||||
func SendEmail(to, subject, body string) error {
|
||||
from := os.Getenv("MAIL_FROM")
|
||||
if from == "" {
|
||||
from = "mgmt@msbls.de"
|
||||
}
|
||||
cmd := exec.Command("m", "mail", "send",
|
||||
"--from", from,
|
||||
"--to", to,
|
||||
"--subject", subject,
|
||||
"--body", body,
|
||||
"--yes")
|
||||
output, err := cmd.CombinedOutput()
|
||||
if err != nil {
|
||||
return fmt.Errorf("m mail send failed: %w (output: %s)", err, string(output))
|
||||
slog.Warn("email send failed (m CLI may not be available in Docker)", "to", to, "error", err, "output", string(output))
|
||||
return fmt.Errorf("m mail send failed: %w", err)
|
||||
}
|
||||
slog.Info("email sent", "to", to, "subject", subject)
|
||||
slog.Info("email sent", "from", from, "to", to, "subject", subject)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@@ -139,7 +139,11 @@ func (s *TenantService) FirstTenantForUser(ctx context.Context, userID uuid.UUID
|
||||
func (s *TenantService) ListMembers(ctx context.Context, tenantID uuid.UUID) ([]models.UserTenant, error) {
|
||||
var members []models.UserTenant
|
||||
err := s.db.SelectContext(ctx, &members,
|
||||
`SELECT user_id, tenant_id, role, created_at FROM user_tenants WHERE tenant_id = $1 ORDER BY created_at`,
|
||||
`SELECT ut.user_id, ut.tenant_id, ut.role, ut.created_at, COALESCE(au.email, '') as email
|
||||
FROM user_tenants ut
|
||||
LEFT JOIN auth.users au ON au.id = ut.user_id
|
||||
WHERE ut.tenant_id = $1
|
||||
ORDER BY ut.created_at`,
|
||||
tenantID,
|
||||
)
|
||||
if err != nil {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -164,7 +164,7 @@ export function TeamSettings() {
|
||||
</div>
|
||||
<div>
|
||||
<p className="text-sm font-medium text-neutral-900">
|
||||
{member.user_id.slice(0, 8)}...
|
||||
{member.email || member.user_id.slice(0, 8) + "..."}
|
||||
</p>
|
||||
<p className="text-xs text-neutral-500">{roleInfo.label}</p>
|
||||
</div>
|
||||
|
||||
@@ -15,6 +15,7 @@ export interface UserTenant {
|
||||
user_id: string;
|
||||
tenant_id: string;
|
||||
role: string;
|
||||
email: string;
|
||||
created_at: string;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user