services

package
v0.0.0-...-64fd395 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 21, 2026 License: MIT, MIT Imports: 40 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsRetryableError

func IsRetryableError(err error) bool

func NewEventBus

func NewEventBus(cfg config.Config, redis *redisclient.Client) interfaces.EventBus

func NewIdentityProvider

func NewIdentityProvider(cfg config.AuthConfig, repos *Repositories) interfaces.IdentityProvider

func NewJobQueue

func NewJobQueue(logger *slog.Logger, cfg config.Config, client *redisclient.Client, metrics *WorkerMetrics) interfaces.JobQueue

func NewWebRTCProvider

func NewWebRTCProvider(cfg config.Config) interfaces.WebRTCProvider

func Permanent

func Permanent(err error) error

func RegisterWorkerHandlers

func RegisterWorkerHandlers(registry *JobRegistry, notifications map[string]interfaces.JobHandler, presence *PresenceService, integrations *IntegrationService, meetings *MeetingService, auth *AuthService)

func Retryable

func Retryable(err error) error

Types

type AuditService

type AuditService struct {
	// contains filtered or unexported fields
}

func NewAuditService

func NewAuditService(audits interfaces.AuditLogRepository, workspaces *WorkspaceService) *AuditService

func (*AuditService) List

func (s *AuditService) List(ctx context.Context, principal interfaces.Principal, workspaceID string, limit int) ([]models.AuditLog, error)

type AuthRateLimiter

type AuthRateLimiter struct {
	// contains filtered or unexported fields
}

func NewAuthRateLimiter

func NewAuthRateLimiter(redis *redisclient.Client) *AuthRateLimiter

func (*AuthRateLimiter) Allow

func (r *AuthRateLimiter) Allow(ctx context.Context, endpoint, ip, email string, limit int, window time.Duration) (bool, error)

type AuthResult

type AuthResult struct {
	User         AuthUserDTO `json:"user"`
	AccessToken  string      `json:"accessToken"`
	ExpiresIn    int64       `json:"expiresIn"`
	RefreshToken string      `json:"refreshToken,omitempty"`
	SessionID    string      `json:"sessionId"`
}

type AuthService

type AuthService struct {
	// contains filtered or unexported fields
}

func NewAuthService

func NewAuthService(cfg config.AuthConfig, db interfaces.Database, repos *Repositories, identity interfaces.IdentityProvider, outbox *OutboxService, limiter *AuthRateLimiter, workspaceSvc *WorkspaceService) *AuthService

func (*AuthService) ChangePassword

func (s *AuthService) ChangePassword(
	ctx context.Context,
	principal interfaces.Principal,
	currentPassword string,
	newPassword string,
	meta RequestMetadata,
) error

func (*AuthService) CleanupExpired

func (s *AuthService) CleanupExpired(ctx context.Context) error

func (*AuthService) ClearRefreshCookie

func (s *AuthService) ClearRefreshCookie(c *gin.Context)

func (*AuthService) CurrentUser

func (s *AuthService) CurrentUser(ctx context.Context, principal interfaces.Principal) (*AuthUserDTO, error)

func (*AuthService) ListSessions

func (s *AuthService) ListSessions(ctx context.Context, principal interfaces.Principal) ([]AuthSessionDTO, error)

func (*AuthService) Login

func (s *AuthService) Login(ctx context.Context, req LoginInput, meta RequestMetadata) (*AuthResult, error)

func (*AuthService) Logout

func (s *AuthService) Logout(ctx context.Context, sessionID string) error

func (*AuthService) LogoutAll

func (s *AuthService) LogoutAll(ctx context.Context, userID string, exceptCurrent bool, currentSessionID string) error

func (*AuthService) Refresh

func (s *AuthService) Refresh(ctx context.Context, refreshToken string, meta RequestMetadata) (*AuthResult, error)

func (*AuthService) Register

func (s *AuthService) Register(ctx context.Context, req RegisterInput, meta RequestMetadata) (*AuthResult, error)

func (*AuthService) RequestPasswordReset

func (s *AuthService) RequestPasswordReset(ctx context.Context, email string) error

func (*AuthService) RevokeSession

func (s *AuthService) RevokeSession(ctx context.Context, principal interfaces.Principal, sessionID string) error

func (*AuthService) SetRefreshCookie

func (s *AuthService) SetRefreshCookie(c *gin.Context, token string)

type AuthSessionDTO

type AuthSessionDTO struct {
	ID         string `json:"id"`
	UserAgent  string `json:"userAgent,omitempty"`
	IPAddress  string `json:"ipAddress,omitempty"`
	CreatedAt  string `json:"createdAt"`
	LastUsedAt string `json:"lastUsedAt"`
	ExpiresAt  string `json:"expiresAt"`
	Current    bool   `json:"current"`
}

type AuthUserDTO

type AuthUserDTO struct {
	ID             string   `json:"id"`
	Email          string   `json:"email"`
	DisplayName    string   `json:"displayName"`
	AvatarURL      *string  `json:"avatarUrl,omitempty"`
	Status         string   `json:"status"`
	PresenceStatus string   `json:"presenceStatus"`
	WorkspaceID    *string  `json:"workspaceId,omitempty"`
	Roles          []string `json:"roles"`
	Permissions    []string `json:"permissions"`
	CreatedAt      string   `json:"createdAt"`
	UpdatedAt      string   `json:"updatedAt"`
}

type ChannelService

type ChannelService struct {
	// contains filtered or unexported fields
}

func NewChannelService

func NewChannelService(db interfaces.Database, repos *Repositories, workspaces *WorkspaceService, conversations interfaces.ConversationRepository) *ChannelService

func (*ChannelService) Create

func (s *ChannelService) Create(ctx context.Context, principal interfaces.Principal, workspaceID string, teamID *string, name, slug, description, channelType, visibility string) (*models.Channel, error)

func (*ChannelService) Delete

func (s *ChannelService) Delete(ctx context.Context, principal interfaces.Principal, channelID string) error

func (*ChannelService) Get

func (s *ChannelService) Get(ctx context.Context, principal interfaces.Principal, channelID string) (*models.Channel, error)

func (*ChannelService) List

func (s *ChannelService) List(ctx context.Context, principal interfaces.Principal, workspaceID string) ([]models.Channel, error)

func (*ChannelService) Update

func (s *ChannelService) Update(ctx context.Context, principal interfaces.Principal, channelID, name, description, visibility string) (*models.Channel, error)

type ConsumerConfig

type ConsumerConfig struct {
	Queue string
	Group string
}

type ConversationDTO

type ConversationDTO struct {
	models.Conversation
	MemberIDs    []string                     `json:"memberIds,omitempty"`
	Participants []ConversationParticipantDTO `json:"participants,omitempty"`
}

type ConversationParticipantDTO

type ConversationParticipantDTO struct {
	UserID         string `json:"userId"`
	DisplayName    string `json:"displayName"`
	Email          string `json:"email"`
	Role           string `json:"role"`
	Status         string `json:"status"`
	PresenceStatus string `json:"presenceStatus"`
}

type ConversationService

type ConversationService struct {
	// contains filtered or unexported fields
}

func (*ConversationService) Create

func (s *ConversationService) Create(ctx context.Context, principal interfaces.Principal, workspaceID, conversationType, name string, memberIDs []string) (*models.Conversation, error)

func (*ConversationService) CreateWithMembers

func (s *ConversationService) CreateWithMembers(ctx context.Context, principal interfaces.Principal, workspaceID, conversationType, name string, memberIDs []string) (*ConversationDTO, error)

func (*ConversationService) Delete

func (s *ConversationService) Delete(ctx context.Context, principal interfaces.Principal, conversationID string) error

func (*ConversationService) Get

func (s *ConversationService) Get(ctx context.Context, principal interfaces.Principal, conversationID string) (*models.Conversation, error)

func (*ConversationService) GetWithMembers

func (s *ConversationService) GetWithMembers(ctx context.Context, principal interfaces.Principal, conversationID string) (*ConversationDTO, error)

func (*ConversationService) List

func (s *ConversationService) List(ctx context.Context, principal interfaces.Principal, workspaceID string) ([]models.Conversation, error)

func (*ConversationService) ListWithMembers

func (s *ConversationService) ListWithMembers(ctx context.Context, principal interfaces.Principal, workspaceID string) ([]ConversationDTO, error)

func (*ConversationService) Update

func (s *ConversationService) Update(ctx context.Context, principal interfaces.Principal, conversationID, name string) (*models.Conversation, error)

func (*ConversationService) UpdateWithMembers

func (s *ConversationService) UpdateWithMembers(ctx context.Context, principal interfaces.Principal, conversationID, name string) (*ConversationDTO, error)

type DatabaseService

type DatabaseService struct {
	// contains filtered or unexported fields
}

func NewDatabaseService

func NewDatabaseService(dsn string) (*DatabaseService, error)

func (*DatabaseService) AutoMigrate

func (s *DatabaseService) AutoMigrate() error

func (*DatabaseService) Close

func (s *DatabaseService) Close() error

func (*DatabaseService) Gorm

func (s *DatabaseService) Gorm() *gorm.DB

func (*DatabaseService) Ping

func (s *DatabaseService) Ping(ctx context.Context) error

func (*DatabaseService) Transaction

func (s *DatabaseService) Transaction(ctx context.Context, fn func(tx *gorm.DB) error) error

type DisabledWebRTCProvider

type DisabledWebRTCProvider struct{}

func (*DisabledWebRTCProvider) CreateJoinToken

func (*DisabledWebRTCProvider) CreateRoom

func (*DisabledWebRTCProvider) DeleteRoom

func (*DisabledWebRTCProvider) GetRoom

func (*DisabledWebRTCProvider) Healthy

func (*DisabledWebRTCProvider) InternalURL

func (p *DisabledWebRTCProvider) InternalURL() string

func (*DisabledWebRTCProvider) ListParticipants

func (*DisabledWebRTCProvider) ListRooms

func (*DisabledWebRTCProvider) MuteParticipantTrack

func (*DisabledWebRTCProvider) ProviderName

func (p *DisabledWebRTCProvider) ProviderName() string

func (*DisabledWebRTCProvider) PublicURL

func (p *DisabledWebRTCProvider) PublicURL() string

func (*DisabledWebRTCProvider) RemoveParticipant

func (p *DisabledWebRTCProvider) RemoveParticipant(context.Context, string, string) error

type GenericWebhookProvider

type GenericWebhookProvider struct{}

func (*GenericWebhookProvider) HandleWebhook

func (p *GenericWebhookProvider) HandleWebhook(_ context.Context, integration models.Integration, payload []byte, _ http.Header) ([]interfaces.Event, error)

func (*GenericWebhookProvider) Name

func (p *GenericWebhookProvider) Name() string

func (*GenericWebhookProvider) ValidateConfiguration

func (p *GenericWebhookProvider) ValidateConfiguration(_ context.Context, _ map[string]any) error

type Hub

type Hub struct {
	// contains filtered or unexported fields
}

func NewHub

func NewHub(ctx context.Context, logger *slog.Logger, cfg config.RealtimeConfig, origins []string, bus interfaces.EventBus, presence *PresenceService, workspaces *WorkspaceService, conversations *ConversationService) *Hub

func (*Hub) Close

func (h *Hub) Close() error

func (*Hub) Handle

func (h *Hub) Handle(c *gin.Context, principal interfaces.Principal)

func (*Hub) Healthy

func (h *Hub) Healthy(context.Context) error

type InMemoryEventBus

type InMemoryEventBus struct {
	// contains filtered or unexported fields
}

func NewInMemoryEventBus

func NewInMemoryEventBus() *InMemoryEventBus

func (*InMemoryEventBus) Close

func (b *InMemoryEventBus) Close() error

func (*InMemoryEventBus) Healthy

func (b *InMemoryEventBus) Healthy(context.Context) error

func (*InMemoryEventBus) Publish

func (b *InMemoryEventBus) Publish(ctx context.Context, event interfaces.Event) error

func (*InMemoryEventBus) Subscribe

func (b *InMemoryEventBus) Subscribe(ctx context.Context, topic string, handler interfaces.EventHandler) error

type InMemoryJobQueue

type InMemoryJobQueue struct {
	// contains filtered or unexported fields
}

func NewInMemoryJobQueue

func NewInMemoryJobQueue(logger *slog.Logger, metrics *WorkerMetrics) *InMemoryJobQueue

func (*InMemoryJobQueue) Close

func (q *InMemoryJobQueue) Close() error

func (*InMemoryJobQueue) Consume

func (q *InMemoryJobQueue) Consume(ctx context.Context, queue string, _ string, _ string, handler interfaces.JobHandler) error

func (*InMemoryJobQueue) DeadLetter

func (q *InMemoryJobQueue) DeadLetter(_ context.Context, queue string, job models.Job, cause error) error

func (*InMemoryJobQueue) Enqueue

func (q *InMemoryJobQueue) Enqueue(_ context.Context, queue string, job models.Job) error

func (*InMemoryJobQueue) Healthy

func (q *InMemoryJobQueue) Healthy(context.Context) error

func (*InMemoryJobQueue) ListDeadLetters

func (q *InMemoryJobQueue) ListDeadLetters(_ context.Context, queue string, limit int) ([]models.Job, error)

func (*InMemoryJobQueue) Retry

func (q *InMemoryJobQueue) Retry(ctx context.Context, queue string, job models.Job, delay time.Duration, cause error) error

type IntegrationService

type IntegrationService struct {
	// contains filtered or unexported fields
}

func (*IntegrationService) Create

func (s *IntegrationService) Create(ctx context.Context, principal interfaces.Principal, workspaceID, provider, name string, config map[string]any) (*models.Integration, error)

func (*IntegrationService) Delete

func (s *IntegrationService) Delete(ctx context.Context, principal interfaces.Principal, id string) error

func (*IntegrationService) Get

func (*IntegrationService) HandleWebhook

func (s *IntegrationService) HandleWebhook(ctx context.Context, provider, integrationID string, payload []byte, headers http.Header) error

func (*IntegrationService) List

func (s *IntegrationService) List(ctx context.Context, principal interfaces.Principal, workspaceID string) ([]models.Integration, error)

func (*IntegrationService) ProcessWebhook

func (s *IntegrationService) ProcessWebhook(ctx context.Context, provider, integrationID string, payload []byte, headers http.Header) error

func (*IntegrationService) Update

func (s *IntegrationService) Update(ctx context.Context, principal interfaces.Principal, id, name, status string) (*models.Integration, error)

type JWTIdentityProvider

type JWTIdentityProvider struct {
	// contains filtered or unexported fields
}

func (*JWTIdentityProvider) Authenticate

func (p *JWTIdentityProvider) Authenticate(_ context.Context, token string) (*interfaces.Principal, error)

func (*JWTIdentityProvider) IssueToken

func (p *JWTIdentityProvider) IssueToken(_ context.Context, principal interfaces.Principal) (string, error)

type JobRegistry

type JobRegistry struct {
	// contains filtered or unexported fields
}

func NewJobRegistry

func NewJobRegistry() *JobRegistry

func (*JobRegistry) Handle

func (r *JobRegistry) Handle(ctx context.Context, job models.Job) error

func (*JobRegistry) Register

func (r *JobRegistry) Register(jobType string, handler interfaces.JobHandler)

type LiveKitProvider

type LiveKitProvider struct {
	// contains filtered or unexported fields
}

func (*LiveKitProvider) CreateJoinToken

func (*LiveKitProvider) CreateRoom

func (*LiveKitProvider) DeleteRoom

func (p *LiveKitProvider) DeleteRoom(ctx context.Context, roomName string) error

func (*LiveKitProvider) GetRoom

func (p *LiveKitProvider) GetRoom(ctx context.Context, roomName string) (*interfaces.ProviderRoom, error)

func (*LiveKitProvider) Healthy

func (p *LiveKitProvider) Healthy(ctx context.Context) error

func (*LiveKitProvider) InternalURL

func (p *LiveKitProvider) InternalURL() string

func (*LiveKitProvider) ListParticipants

func (p *LiveKitProvider) ListParticipants(ctx context.Context, roomName string) ([]interfaces.ProviderParticipant, error)

func (*LiveKitProvider) ListRooms

func (*LiveKitProvider) MuteParticipantTrack

func (p *LiveKitProvider) MuteParticipantTrack(ctx context.Context, input interfaces.MuteTrackInput) error

func (*LiveKitProvider) ProviderName

func (p *LiveKitProvider) ProviderName() string

func (*LiveKitProvider) PublicURL

func (p *LiveKitProvider) PublicURL() string

func (*LiveKitProvider) RemoveParticipant

func (p *LiveKitProvider) RemoveParticipant(ctx context.Context, roomName string, identity string) error

type LocalStorage

type LocalStorage struct {
	// contains filtered or unexported fields
}

func (*LocalStorage) Delete

func (s *LocalStorage) Delete(_ context.Context, key string) error

func (*LocalStorage) Get

func (s *LocalStorage) Get(_ context.Context, key string) (io.ReadCloser, error)

func (*LocalStorage) Put

func (s *LocalStorage) Put(ctx context.Context, object interfaces.Object) error

func (*LocalStorage) SignedURL

func (s *LocalStorage) SignedURL(_ context.Context, key string, _ time.Duration) (string, error)

type LoginInput

type LoginInput struct {
	Email    string `json:"email"`
	Password string `json:"password"`
}

type MeetingService

type MeetingService struct {
	// contains filtered or unexported fields
}

func (*MeetingService) AddParticipant

func (s *MeetingService) AddParticipant(ctx context.Context, principal interfaces.Principal, meetingID, userID, role string) (*models.MeetingParticipant, error)

func (*MeetingService) AutoEndAbandoned

func (s *MeetingService) AutoEndAbandoned(ctx context.Context) error

func (*MeetingService) Cancel

func (s *MeetingService) Cancel(ctx context.Context, principal interfaces.Principal, meetingID string) (*models.Meeting, error)

func (*MeetingService) Create

func (s *MeetingService) Create(ctx context.Context, principal interfaces.Principal, workspaceID, title string, conversationID *string) (*models.Meeting, error)

func (*MeetingService) End

func (s *MeetingService) End(ctx context.Context, principal interfaces.Principal, meetingID string) (*MeetingStartResponse, error)

func (*MeetingService) EnqueueDueReminders

func (s *MeetingService) EnqueueDueReminders(ctx context.Context) error

func (*MeetingService) ExpireStale

func (s *MeetingService) ExpireStale(ctx context.Context) error

func (*MeetingService) Get

func (s *MeetingService) Get(ctx context.Context, principal interfaces.Principal, meetingID string) (*models.Meeting, error)

func (*MeetingService) JoinToken

func (s *MeetingService) JoinToken(ctx context.Context, principal interfaces.Principal, meetingID string) (*interfaces.JoinToken, error)

func (*MeetingService) List

func (s *MeetingService) List(ctx context.Context, principal interfaces.Principal, workspaceID string) ([]models.Meeting, error)

func (*MeetingService) ListParticipants

func (s *MeetingService) ListParticipants(ctx context.Context, principal interfaces.Principal, meetingID string) ([]models.MeetingSessionParticipant, error)

func (*MeetingService) Start

func (s *MeetingService) Start(ctx context.Context, principal interfaces.Principal, meetingID string) (*MeetingStartResponse, error)

type MeetingStartResponse

type MeetingStartResponse struct {
	Meeting *models.Meeting        `json:"meeting"`
	Session *models.MeetingSession `json:"session"`
}

type MessageService

type MessageService struct {
	// contains filtered or unexported fields
}

func NewMessageService

func NewMessageService(db interfaces.Database, repos *Repositories, conversations *ConversationService, workspaces *WorkspaceService, bus interfaces.EventBus, outbox *OutboxService) *MessageService

func (*MessageService) AddReaction

func (s *MessageService) AddReaction(ctx context.Context, principal interfaces.Principal, messageID, emoji string) (*models.Reaction, error)

func (*MessageService) Create

func (s *MessageService) Create(ctx context.Context, principal interfaces.Principal, conversationID, messageType, content, idempotencyKey string, metadata map[string]any) (*models.Message, error)

func (*MessageService) Delete

func (s *MessageService) Delete(ctx context.Context, principal interfaces.Principal, messageID string) error

func (*MessageService) Get

func (s *MessageService) Get(ctx context.Context, principal interfaces.Principal, messageID string) (*models.Message, error)

func (*MessageService) List

func (s *MessageService) List(ctx context.Context, principal interfaces.Principal, conversationID, cursor string, limit int) ([]models.Message, string, bool, error)

func (*MessageService) MarkRead

func (s *MessageService) MarkRead(ctx context.Context, principal interfaces.Principal, conversationID, messageID string) error

func (*MessageService) RemoveReaction

func (s *MessageService) RemoveReaction(ctx context.Context, principal interfaces.Principal, messageID, emoji string) error

func (*MessageService) Update

func (s *MessageService) Update(ctx context.Context, principal interfaces.Principal, messageID, content string) (*models.Message, error)

type NotificationDTO

type NotificationDTO struct {
	ID             string         `json:"id"`
	WorkspaceID    string         `json:"workspaceId"`
	UserID         string         `json:"userId"`
	Type           string         `json:"type"`
	Title          string         `json:"title"`
	Body           string         `json:"body"`
	ResourceType   string         `json:"resourceType,omitempty"`
	ResourceID     string         `json:"resourceId,omitempty"`
	Metadata       map[string]any `json:"metadata,omitempty"`
	ReadAt         *time.Time     `json:"readAt,omitempty"`
	IdempotencyKey string         `json:"idempotencyKey,omitempty"`
	CreatedAt      time.Time      `json:"createdAt"`
	UpdatedAt      time.Time      `json:"updatedAt"`
}

type NotificationPreferencesDTO

type NotificationPreferencesDTO struct {
	DirectMessages       bool `json:"directMessages"`
	Mentions             bool `json:"mentions"`
	ChannelMessages      bool `json:"channelMessages"`
	MeetingReminders     bool `json:"meetingReminders"`
	IncomingCalls        bool `json:"incomingCalls"`
	EmailNotifications   bool `json:"emailNotifications"`
	Sounds               bool `json:"sounds"`
	DesktopNotifications bool `json:"desktopNotifications"`
}

type NotificationService

type NotificationService struct {
	// contains filtered or unexported fields
}

func (*NotificationService) Create

func (s *NotificationService) Create(ctx context.Context, notification *models.Notification) error

func (*NotificationService) List

func (s *NotificationService) List(ctx context.Context, principal interfaces.Principal, cursor string, limit int) ([]NotificationDTO, string, bool, error)

func (*NotificationService) MarkAllRead

func (s *NotificationService) MarkAllRead(ctx context.Context, principal interfaces.Principal) (bool, error)

func (*NotificationService) MarkRead

func (s *NotificationService) MarkRead(ctx context.Context, principal interfaces.Principal, notificationID string) (bool, error)

func (*NotificationService) UnreadCount

func (s *NotificationService) UnreadCount(ctx context.Context, principal interfaces.Principal) (int64, error)

type OutboxService

type OutboxService struct {
	// contains filtered or unexported fields
}

func (*OutboxService) Add

func (s *OutboxService) Add(ctx context.Context, repo interfaces.OutboxRepository, eventType string, aggregateType string, aggregateID string, workspaceID string, payload any) error

func (*OutboxService) Run

func (s *OutboxService) Run(ctx context.Context, workerID string) error

type PasswordHasher

type PasswordHasher struct {
	// contains filtered or unexported fields
}

func NewPasswordHasher

func NewPasswordHasher(cfg config.AuthConfig) *PasswordHasher

func (*PasswordHasher) Hash

func (h *PasswordHasher) Hash(password string) (string, error)

func (*PasswordHasher) NeedsRehash

func (h *PasswordHasher) NeedsRehash(encodedHash string) bool

func (*PasswordHasher) Verify

func (h *PasswordHasher) Verify(password, encodedHash string) (bool, error)

type PresenceRecord

type PresenceRecord struct {
	UserID      string    `json:"userId"`
	WorkspaceID string    `json:"workspaceId"`
	State       string    `json:"state"`
	LastSeenAt  time.Time `json:"lastSeenAt"`
	DeviceCount int       `json:"deviceCount"`
}

type PresenceService

type PresenceService struct {
	// contains filtered or unexported fields
}

func NewPresenceService

func NewPresenceService(logger *slog.Logger, redis *redisclient.Client, bus interfaces.EventBus, users interfaces.UserRepository, ttl time.Duration) *PresenceService

func (*PresenceService) Close

func (s *PresenceService) Close() error

func (*PresenceService) ExpireStale

func (s *PresenceService) ExpireStale(ctx context.Context, limit int) error

func (*PresenceService) Get

func (s *PresenceService) Get(ctx context.Context, workspaceID, userID string) (PresenceRecord, bool)

func (*PresenceService) PersistLastSeen

func (s *PresenceService) PersistLastSeen(ctx context.Context) error

func (*PresenceService) RefreshUserState

func (s *PresenceService) RefreshUserState(ctx context.Context, userID string) error

func (*PresenceService) Set

func (s *PresenceService) Set(ctx context.Context, workspaceID, userID, state string, deviceCount int) error

func (*PresenceService) SetSessionState

func (s *PresenceService) SetSessionState(ctx context.Context, workspaceID, userID string, connected bool, deviceCount int) error

type ProjectDTO

type ProjectDTO struct {
	ID          string  `json:"id"`
	WorkspaceID string  `json:"workspaceId"`
	Name        string  `json:"name"`
	Summary     string  `json:"summary,omitempty"`
	Status      string  `json:"status"`
	Progress    int     `json:"progress"`
	Cadence     string  `json:"cadence,omitempty"`
	OwnerUserID *string `json:"ownerUserId,omitempty"`
	OwnerName   string  `json:"ownerName,omitempty"`
	CreatedBy   string  `json:"createdBy"`
}

type ProjectService

type ProjectService struct {
	// contains filtered or unexported fields
}

func NewProjectService

func NewProjectService(projects interfaces.ProjectRepository, users interfaces.UserRepository, workspaces *WorkspaceService) *ProjectService

func (*ProjectService) List

func (s *ProjectService) List(ctx context.Context, principal interfaces.Principal, workspaceID string) ([]ProjectDTO, error)

type ProvisionWorkspaceUserInput

type ProvisionWorkspaceUserInput struct {
	Email             string
	DisplayName       string
	Role              string
	TemporaryPassword string
}

type QueueProducer

type QueueProducer struct {
	// contains filtered or unexported fields
}

func NewQueueProducer

func NewQueueProducer(logger *slog.Logger, queue interfaces.JobQueue, maxAttempts int, metrics *WorkerMetrics) *QueueProducer

func (*QueueProducer) EnqueueJob

func (p *QueueProducer) EnqueueJob(ctx context.Context, queueName string, jobType string, payload any, options interfaces.JobOptions) (models.Job, error)

type RealtimeCommand

type RealtimeCommand struct {
	Type           string         `json:"type"`
	WorkspaceID    string         `json:"workspaceId,omitempty"`
	ConversationID string         `json:"conversationId,omitempty"`
	Data           map[string]any `json:"data,omitempty"`
}

type RedisEventBus

type RedisEventBus struct {
	// contains filtered or unexported fields
}

func NewRedisEventBus

func NewRedisEventBus(redis *redisclient.Client, prefix string) *RedisEventBus

func (*RedisEventBus) Close

func (b *RedisEventBus) Close() error

func (*RedisEventBus) Healthy

func (b *RedisEventBus) Healthy(ctx context.Context) error

func (*RedisEventBus) Publish

func (b *RedisEventBus) Publish(ctx context.Context, event interfaces.Event) error

func (*RedisEventBus) Subscribe

func (b *RedisEventBus) Subscribe(ctx context.Context, topic string, handler interfaces.EventHandler) error

type RedisStreamJobQueue

type RedisStreamJobQueue struct {
	// contains filtered or unexported fields
}

func (*RedisStreamJobQueue) Close

func (q *RedisStreamJobQueue) Close() error

func (*RedisStreamJobQueue) Consume

func (q *RedisStreamJobQueue) Consume(ctx context.Context, queue string, consumerGroup string, consumerName string, handler interfaces.JobHandler) error

func (*RedisStreamJobQueue) DeadLetter

func (q *RedisStreamJobQueue) DeadLetter(ctx context.Context, queue string, job models.Job, cause error) error

func (*RedisStreamJobQueue) Enqueue

func (q *RedisStreamJobQueue) Enqueue(ctx context.Context, queue string, job models.Job) error

func (*RedisStreamJobQueue) Healthy

func (q *RedisStreamJobQueue) Healthy(ctx context.Context) error

func (*RedisStreamJobQueue) ListDeadLetters

func (q *RedisStreamJobQueue) ListDeadLetters(ctx context.Context, queue string, limit int) ([]models.Job, error)

func (*RedisStreamJobQueue) Retry

func (q *RedisStreamJobQueue) Retry(ctx context.Context, queue string, job models.Job, delay time.Duration, cause error) error

type RegisterInput

type RegisterInput struct {
	Email         string `json:"email"`
	Password      string `json:"password"`
	DisplayName   string `json:"displayName"`
	WorkspaceName string `json:"workspaceName"`
}

type Repositories

type Repositories struct {
	// contains filtered or unexported fields
}

func NewRepositories

func NewRepositories(db *gorm.DB) *Repositories

func (*Repositories) AuditLogs

func (*Repositories) AuthAuditEvents

func (r *Repositories) AuthAuditEvents() interfaces.AuthAuditEventRepository

func (*Repositories) AuthRefreshTokens

func (r *Repositories) AuthRefreshTokens() interfaces.AuthRefreshTokenRepository

func (*Repositories) AuthSessions

func (r *Repositories) AuthSessions() interfaces.AuthSessionRepository

func (*Repositories) Channels

func (*Repositories) ConversationMembers

func (r *Repositories) ConversationMembers() interfaces.ConversationMemberRepository

func (*Repositories) Conversations

func (r *Repositories) Conversations() interfaces.ConversationRepository

func (*Repositories) EmailVerificationTokens

func (r *Repositories) EmailVerificationTokens() interfaces.EmailVerificationTokenRepository

func (*Repositories) Integrations

func (r *Repositories) Integrations() interfaces.IntegrationRepository

func (*Repositories) LocalCredentials

func (r *Repositories) LocalCredentials() interfaces.LocalCredentialRepository

func (*Repositories) MeetingParticipants

func (r *Repositories) MeetingParticipants() interfaces.MeetingParticipantRepository

func (*Repositories) MeetingSessionParticipants

func (r *Repositories) MeetingSessionParticipants() interfaces.MeetingSessionParticipantRepository

func (*Repositories) MeetingSessions

func (r *Repositories) MeetingSessions() interfaces.MeetingSessionRepository

func (*Repositories) Meetings

func (*Repositories) Messages

func (*Repositories) NotificationPreferences

func (r *Repositories) NotificationPreferences() interfaces.NotificationPreferenceRepository

func (*Repositories) Notifications

func (r *Repositories) Notifications() interfaces.NotificationRepository

func (*Repositories) OutboxEvents

func (r *Repositories) OutboxEvents() interfaces.OutboxRepository

func (*Repositories) PasswordResetTokens

func (r *Repositories) PasswordResetTokens() interfaces.PasswordResetTokenRepository

func (*Repositories) Projects

func (*Repositories) Reactions

func (*Repositories) ReadReceipts

func (r *Repositories) ReadReceipts() interfaces.ReadReceiptRepository

func (*Repositories) Tasks

func (*Repositories) Teams

func (*Repositories) UserSettings

func (*Repositories) Users

func (*Repositories) WebRTCNodes

func (r *Repositories) WebRTCNodes() interfaces.WebRTCNodeRepository

func (*Repositories) WebRTCWebhookEvents

func (r *Repositories) WebRTCWebhookEvents() interfaces.WebRTCWebhookEventRepository

func (*Repositories) WithDB

func (r *Repositories) WithDB(db *gorm.DB) *Repositories

func (*Repositories) WorkspaceMembers

func (r *Repositories) WorkspaceMembers() interfaces.WorkspaceMemberRepository

func (*Repositories) WorkspaceSSOConfigs

func (r *Repositories) WorkspaceSSOConfigs() interfaces.WorkspaceSSOConfigRepository

func (*Repositories) Workspaces

type RequestMetadata

type RequestMetadata struct {
	UserAgent string
	IPAddress string
}

type RetryableError

type RetryableError interface {
	error
	Retryable() bool
}

type ScheduledJob

type ScheduledJob struct {
	Queue    string
	Type     string
	Every    time.Duration
	LockName string
}

type Scheduler

type Scheduler struct {
	// contains filtered or unexported fields
}

func NewScheduler

func NewScheduler(redis *redisclient.Client, producer interfaces.JobProducer) *Scheduler

func (*Scheduler) Run

func (s *Scheduler) Run(ctx context.Context) error

type StaticNodeSelector

type StaticNodeSelector struct {
	// contains filtered or unexported fields
}

func (*StaticNodeSelector) SelectNode

func (s *StaticNodeSelector) SelectNode(ctx context.Context, workspaceID string, region string) (*models.WebRTCNode, error)

type TaskDTO

type TaskDTO struct {
	ID             string     `json:"id"`
	WorkspaceID    string     `json:"workspaceId"`
	Title          string     `json:"title"`
	Description    string     `json:"description,omitempty"`
	Status         string     `json:"status"`
	Priority       string     `json:"priority"`
	Project        string     `json:"project,omitempty"`
	AssigneeUserID *string    `json:"assigneeUserId,omitempty"`
	AssigneeName   string     `json:"assigneeName,omitempty"`
	CreatedBy      string     `json:"createdBy"`
	DueAt          *time.Time `json:"dueAt,omitempty"`
	CompletedAt    *time.Time `json:"completedAt,omitempty"`
	CreatedAt      time.Time  `json:"createdAt"`
	UpdatedAt      time.Time  `json:"updatedAt"`
}

type TaskService

type TaskService struct {
	// contains filtered or unexported fields
}

func NewTaskService

func NewTaskService(tasks interfaces.TaskRepository, users interfaces.UserRepository, workspaces *WorkspaceService) *TaskService

func (*TaskService) Create

func (s *TaskService) Create(
	ctx context.Context,
	principal interfaces.Principal,
	workspaceID, title, description, status, priority, project string,
	dueAt *time.Time,
) (*TaskDTO, error)

func (*TaskService) List

func (s *TaskService) List(ctx context.Context, principal interfaces.Principal, workspaceID string) ([]TaskDTO, error)

type TeamService

type TeamService struct {
	// contains filtered or unexported fields
}

func NewTeamService

func NewTeamService(teams interfaces.TeamRepository, workspaces *WorkspaceService) *TeamService

func (*TeamService) Create

func (s *TeamService) Create(ctx context.Context, principal interfaces.Principal, workspaceID, name, description string) (*models.Team, error)

func (*TeamService) Delete

func (s *TeamService) Delete(ctx context.Context, principal interfaces.Principal, teamID string) error

func (*TeamService) Get

func (s *TeamService) Get(ctx context.Context, principal interfaces.Principal, teamID string) (*models.Team, error)

func (*TeamService) List

func (s *TeamService) List(ctx context.Context, principal interfaces.Principal, workspaceID string) ([]models.Team, error)

func (*TeamService) Update

func (s *TeamService) Update(ctx context.Context, principal interfaces.Principal, teamID, name, description string) (*models.Team, error)

type UpdateWorkspaceSSOInput

type UpdateWorkspaceSSOInput struct {
	Provider           string
	Enabled            bool
	EnforceSSO         bool
	AllowPasswordAuth  bool
	AllowAutoProvision bool
	AllowIDPInitiated  bool
	DomainHint         string
	IssuerURL          string
	SSOURL             string
	EntityID           string
	ClientID           string
	ClientSecret       *string
	ClearClientSecret  bool
	Certificate        string
	AllowedDomains     []string
	DefaultRole        string
	AttributeMapping   map[string]string
}

type UserPreferencesDTO

type UserPreferencesDTO struct {
	Theme         string `json:"theme"`
	Language      string `json:"language"`
	Locale        string `json:"locale"`
	Timezone      string `json:"timezone"`
	StatusMessage string `json:"statusMessage,omitempty"`
	Density       string `json:"density"`
	Contrast      string `json:"contrast"`
	SoundEnabled  bool   `json:"soundEnabled"`
	SecureSession bool   `json:"secureSession"`
}

type UserService

type UserService struct {
	// contains filtered or unexported fields
}

func (*UserService) EnsureUser

func (s *UserService) EnsureUser(ctx context.Context, principal interfaces.Principal) (*models.User, error)

func (*UserService) GetMe

func (s *UserService) GetMe(ctx context.Context, principal interfaces.Principal) (*models.User, error)

func (*UserService) GetNotificationPreferences

func (s *UserService) GetNotificationPreferences(ctx context.Context, principal interfaces.Principal) (*NotificationPreferencesDTO, error)

func (*UserService) GetPreferences

func (s *UserService) GetPreferences(ctx context.Context, principal interfaces.Principal) (*UserPreferencesDTO, error)

func (*UserService) UpdateMe

func (s *UserService) UpdateMe(ctx context.Context, principal interfaces.Principal, displayName, avatarURL, status string) (*models.User, error)

func (*UserService) UpdateNotificationPreferences

func (s *UserService) UpdateNotificationPreferences(
	ctx context.Context,
	principal interfaces.Principal,
	input NotificationPreferencesDTO,
) (*NotificationPreferencesDTO, error)

func (*UserService) UpdatePreferences

func (s *UserService) UpdatePreferences(ctx context.Context, principal interfaces.Principal, input UserPreferencesDTO) (*UserPreferencesDTO, error)

type WebRTCMetrics

type WebRTCMetrics struct {
	// contains filtered or unexported fields
}

func (*WebRTCMetrics) IncJoinTokenFailures

func (m *WebRTCMetrics) IncJoinTokenFailures()

func (*WebRTCMetrics) IncJoinTokensIssued

func (m *WebRTCMetrics) IncJoinTokensIssued()

func (*WebRTCMetrics) IncProviderErrors

func (m *WebRTCMetrics) IncProviderErrors()

func (*WebRTCMetrics) IncWebhookEvents

func (m *WebRTCMetrics) IncWebhookEvents()

func (*WebRTCMetrics) IncWebhookFailures

func (m *WebRTCMetrics) IncWebhookFailures()

func (*WebRTCMetrics) ObserveRoomCreateDuration

func (m *WebRTCMetrics) ObserveRoomCreateDuration(d time.Duration)

func (*WebRTCMetrics) RenderPrometheus

func (m *WebRTCMetrics) RenderPrometheus() string

func (*WebRTCMetrics) SetActiveParticipants

func (m *WebRTCMetrics) SetActiveParticipants(v int64)

func (*WebRTCMetrics) SetActiveRooms

func (m *WebRTCMetrics) SetActiveRooms(v int64)

func (*WebRTCMetrics) SetNodes

func (m *WebRTCMetrics) SetNodes(v int64)

type WebRTCService

type WebRTCService struct {
	// contains filtered or unexported fields
}

func NewWebRTCService

func NewWebRTCService(logger *slog.Logger, cfg config.Config, db interfaces.Database, repos *Repositories, workspaces *WorkspaceService, provider interfaces.WebRTCProvider, selector interfaces.NodeSelector, outbox *OutboxService, producer interfaces.JobProducer, bus interfaces.EventBus, metrics *WebRTCMetrics) *WebRTCService

func (*WebRTCService) CleanupParticipants

func (s *WebRTCService) CleanupParticipants(ctx context.Context, sessionID string) error

func (*WebRTCService) CleanupStaleParticipants

func (s *WebRTCService) CleanupStaleParticipants(ctx context.Context) error

func (*WebRTCService) CloseRoom

func (s *WebRTCService) CloseRoom(ctx context.Context, sessionID string, roomName string) error

func (*WebRTCService) EndMeeting

func (s *WebRTCService) EndMeeting(ctx context.Context, principal interfaces.Principal, meetingID string) (*MeetingStartResponse, error)

func (*WebRTCService) ExpireAbandonedSessions

func (s *WebRTCService) ExpireAbandonedSessions(ctx context.Context) error

func (*WebRTCService) HandleLiveKitWebhook

func (s *WebRTCService) HandleLiveKitWebhook(ctx context.Context, request *http.Request) error

func (*WebRTCService) JoinToken

func (s *WebRTCService) JoinToken(ctx context.Context, principal interfaces.Principal, meetingID string) (*interfaces.JoinToken, error)

func (*WebRTCService) ListParticipants

func (s *WebRTCService) ListParticipants(ctx context.Context, principal interfaces.Principal, meetingID string) ([]models.MeetingSessionParticipant, error)

func (*WebRTCService) Ready

func (s *WebRTCService) Ready(ctx context.Context) error

func (*WebRTCService) ReconcileRooms

func (s *WebRTCService) ReconcileRooms(ctx context.Context) error

func (*WebRTCService) Run

func (s *WebRTCService) Run(ctx context.Context) error

func (*WebRTCService) StartMeeting

func (s *WebRTCService) StartMeeting(ctx context.Context, principal interfaces.Principal, meetingID string) (*MeetingStartResponse, error)

type Worker

type Worker struct {
	// contains filtered or unexported fields
}

func NewWorker

func NewWorker(logger *slog.Logger, cfg config.Config, redis *redisclient.Client, queue interfaces.JobQueue, producer interfaces.JobProducer, registry *JobRegistry, outbox *OutboxService, scheduler *Scheduler, presence *PresenceService, integrations *IntegrationService, meetings *MeetingService, metrics *WorkerMetrics) *Worker

func (*Worker) Run

func (w *Worker) Run(ctx context.Context) error

func (*Worker) RunAll

func (w *Worker) RunAll(ctx context.Context) error

func (*Worker) RunConsumers

func (w *Worker) RunConsumers(ctx context.Context) error

func (*Worker) RunScheduler

func (w *Worker) RunScheduler(ctx context.Context) error

type WorkerMetrics

type WorkerMetrics struct {
	// contains filtered or unexported fields
}

func (*WorkerMetrics) Snapshot

func (m *WorkerMetrics) Snapshot() map[string]int64

type WorkspaceMemberDTO

type WorkspaceMemberDTO struct {
	ID             string     `json:"id"`
	WorkspaceID    string     `json:"workspaceId"`
	UserID         string     `json:"userId"`
	Role           string     `json:"role"`
	JoinedAt       time.Time  `json:"joinedAt"`
	LastSeenAt     *time.Time `json:"lastSeenAt,omitempty"`
	CreatedAt      time.Time  `json:"createdAt"`
	UpdatedAt      time.Time  `json:"updatedAt"`
	DisplayName    string     `json:"displayName"`
	Email          string     `json:"email"`
	AvatarURL      *string    `json:"avatarUrl,omitempty"`
	Status         string     `json:"status"`
	PresenceStatus string     `json:"presenceStatus"`
}

type WorkspaceSSOConfigDTO

type WorkspaceSSOConfigDTO struct {
	ID                     string            `json:"id"`
	WorkspaceID            string            `json:"workspaceId"`
	Provider               string            `json:"provider"`
	Enabled                bool              `json:"enabled"`
	EnforceSSO             bool              `json:"enforceSso"`
	AllowPasswordAuth      bool              `json:"allowPasswordAuth"`
	AllowAutoProvision     bool              `json:"allowAutoProvision"`
	AllowIDPInitiated      bool              `json:"allowIdpInitiated"`
	DomainHint             string            `json:"domainHint,omitempty"`
	IssuerURL              string            `json:"issuerUrl,omitempty"`
	SSOURL                 string            `json:"ssoUrl,omitempty"`
	EntityID               string            `json:"entityId,omitempty"`
	ClientID               string            `json:"clientId,omitempty"`
	ClientSecretConfigured bool              `json:"clientSecretConfigured"`
	Certificate            string            `json:"certificate,omitempty"`
	AllowedDomains         []string          `json:"allowedDomains"`
	DefaultRole            string            `json:"defaultRole"`
	AttributeMapping       map[string]string `json:"attributeMapping"`
	CreatedAt              time.Time         `json:"createdAt"`
	UpdatedAt              time.Time         `json:"updatedAt"`
}

type WorkspaceService

type WorkspaceService struct {
	// contains filtered or unexported fields
}

func (*WorkspaceService) AddMember

func (s *WorkspaceService) AddMember(ctx context.Context, principal interfaces.Principal, workspaceID, userID, email, role string) (*WorkspaceMemberDTO, error)

func (*WorkspaceService) Archive

func (s *WorkspaceService) Archive(ctx context.Context, principal interfaces.Principal, workspaceID string) error

func (*WorkspaceService) AuthorizeWorkspace

func (s *WorkspaceService) AuthorizeWorkspace(ctx context.Context, principal interfaces.Principal, workspaceID string) (*models.WorkspaceMember, error)

func (*WorkspaceService) Create

func (s *WorkspaceService) Create(ctx context.Context, principal interfaces.Principal, name, slug, description string) (*models.Workspace, error)

func (*WorkspaceService) Get

func (s *WorkspaceService) Get(ctx context.Context, principal interfaces.Principal, workspaceID string) (*models.Workspace, error)

func (*WorkspaceService) GetSSOConfig

func (s *WorkspaceService) GetSSOConfig(ctx context.Context, principal interfaces.Principal, workspaceID string) (*WorkspaceSSOConfigDTO, error)

func (*WorkspaceService) List

func (*WorkspaceService) ListMembers

func (s *WorkspaceService) ListMembers(ctx context.Context, principal interfaces.Principal, workspaceID string) ([]WorkspaceMemberDTO, error)

func (*WorkspaceService) ProvisionWorkspaceUser

func (s *WorkspaceService) ProvisionWorkspaceUser(
	ctx context.Context,
	principal interfaces.Principal,
	workspaceID string,
	input ProvisionWorkspaceUserInput,
	meta RequestMetadata,
) (*WorkspaceMemberDTO, error)

func (*WorkspaceService) RemoveMember

func (s *WorkspaceService) RemoveMember(ctx context.Context, principal interfaces.Principal, workspaceID, userID string) error

func (*WorkspaceService) Update

func (s *WorkspaceService) Update(ctx context.Context, principal interfaces.Principal, workspaceID, name, description string) (*models.Workspace, error)

func (*WorkspaceService) UpdateMember

func (s *WorkspaceService) UpdateMember(ctx context.Context, principal interfaces.Principal, workspaceID, userID, role string) (*WorkspaceMemberDTO, error)

func (*WorkspaceService) UpdateSSOConfig

func (s *WorkspaceService) UpdateSSOConfig(ctx context.Context, principal interfaces.Principal, workspaceID string, input UpdateWorkspaceSSOInput, meta RequestMetadata) (*WorkspaceSSOConfigDTO, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL