feat(store): let regions and agents belong to the platform or one organization

Regions are identified by id so organizations can reuse keys. Triggers
keep agents in regions of the same owner and monitors in platform or own
regions. Platform admins are a user flag.

Refs #52

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
This commit is contained in:
Sebastian UnterschützandClaude Opus 5.5 committed 2026-11-22 01:36:02 +01:00
1 parent 7bb4afa04a
commit 607798d742
10 files changed
+442 -99

No files matched your search

+5 -2
View File
@@ -15,12 +15,12 @@ type Agent struct {
OrgID *uuid.UUID
Kind string
Name string
Region *string
TokenHash []byte
Prefix string
LastSeenAt *time.Time
Release *string
CreatedAt time.Time
RegionID *uuid.UUID
}
type ApiToken struct {
@@ -116,7 +116,7 @@ type Monitor struct {
type MonitorRegion struct {
MonitorID uuid.UUID
OrgID uuid.UUID
Region string
RegionID uuid.UUID
}
type Notification struct {
@@ -166,6 +166,8 @@ type Region struct {
Key string
Name string
CreatedAt time.Time
ID uuid.UUID
OrgID *uuid.UUID
}
type Role struct {
@@ -215,6 +217,7 @@ type User struct {
TotpSecret []byte
TotpEnabledAt *time.Time
Locale *string
IsAdmin bool
}
type UserIdentity struct {