Files
Primora/apps/backend/internal/models/actor.go
T
2026-04-10 12:03:31 +02:00

33 lines
612 B
Go

package models
import "github.com/google/uuid"
type ActorType string
const (
ActorTypeUser ActorType = "user"
ActorTypeAPIKey ActorType = "api_key"
)
type Actor struct {
Type ActorType
UserID *uuid.UUID
AuthSubject string
Email string
EmailVerified bool
Name string
SessionID string
ProjectID *uuid.UUID
OrganizationID *uuid.UUID
APIKeyID *uuid.UUID
APIKeyPrefix string
}
func (a *Actor) IsUser() bool {
return a != nil && a.Type == ActorTypeUser
}
func (a *Actor) IsAPIKey() bool {
return a != nil && a.Type == ActorTypeAPIKey
}