veza/veza-backend-api/internal/models/user_presence.go
senke 8f4f445dcb feat(presence): P2.1 rich presence, P2.2 invisible mode
Backend:
- UserPresence: track_id, track_title, invisible
- UpdatePresenceFull, GetPresenceForViewer (invisible hides for others)
- PUT /users/me/presence
- Migration 094 rich presence columns

Frontend:
- presenceService.updatePresence
- usePresenceSync: sync currentTrack to presence
- PresenceBadge: statusMessage tooltip
- PresenceInvisibleToggle in PrivacySettings
- MSW: PUT /users/me/presence
2026-02-21 16:47:09 +01:00

24 lines
877 B
Go

package models
import (
"time"
"github.com/google/uuid"
)
// UserPresence represents a user's online status (v0.301 Lot P1, v0.302 P2)
type UserPresence struct {
UserID uuid.UUID `gorm:"type:uuid;primaryKey" json:"user_id"`
Status string `gorm:"type:varchar(20);not null;default:'offline'" json:"status"` // online, away, busy, offline
LastSeenAt time.Time `gorm:"not null" json:"last_seen_at"`
StatusMsg string `gorm:"type:text" json:"status_message,omitempty"`
TrackID *uuid.UUID `gorm:"type:uuid" json:"track_id,omitempty"`
TrackTitle string `gorm:"type:text" json:"track_title,omitempty"`
Invisible bool `gorm:"not null;default:false" json:"invisible"`
UpdatedAt time.Time `gorm:"not null" json:"updated_at"`
}
// TableName overrides the table name
func (UserPresence) TableName() string {
return "user_presence"
}