first commit
All checks were successful
CI / backend (push) Successful in 13m19s
CI / frontend (push) Successful in 11m3s
CI / docker (push) Successful in 1m58s

This commit is contained in:
Cauê Faleiros
2026-06-03 16:31:42 -03:00
commit 8c7e5fbbe4
92 changed files with 18226 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
package calendar
import (
"context"
"encoding/json"
)
func (s Store) RecordAudit(ctx context.Context, actorUserID string, action string, entityType string, entityID string, metadata map[string]any) error {
payload := "{}"
if metadata != nil {
bytes, err := json.Marshal(metadata)
if err != nil {
return err
}
payload = string(bytes)
}
_, err := s.db.Exec(ctx, `
INSERT INTO audit_logs (actor_user_id, action, entity_type, entity_id, metadata)
VALUES (NULLIF($1, '')::uuid, $2, $3, NULLIF($4, '')::uuid, $5::jsonb)
`, actorUserID, action, entityType, entityID, payload)
return err
}