models

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessRequest

type AccessRequest struct {
	bun.BaseModel `bun:"table:access_requests,alias:request"`
	ID            UUID `bun:"id,pk,type:uuid"`
	Kind          string
	Provider      string
	Subject       string
	Email         string
	EmailVerified bool
	DisplayName   string
	PersonID      *UUID `bun:"person_id,type:uuid"`
	AlbumID       *UUID `bun:"album_id,type:uuid"`
	Status        string
	SignInCount   int
	CreatedAt     time.Time
	UpdatedAt     time.Time
	ResolvedAt    *time.Time
	ResolvedBy    *UUID `bun:"resolved_by,type:uuid"`
}

AccessRequest records who asked, never whether two identities share a human.

type Album

type Album struct {
	bun.BaseModel   `bun:"table:albums,alias:album"`
	ID              UUID `bun:"id,pk,type:uuid"`
	SourceID        string
	Title           string
	Description     string
	PublishedAt     *time.Time
	ImportStatus    string
	ImportMessage   string
	ImportProcessed int
	ImportTotal     int
	ImportUpdatedAt time.Time
	CreatedAt       time.Time
}

Album includes its durable initial import intent and progress.

type AlbumAccessDecision

type AlbumAccessDecision struct {
	bun.BaseModel `bun:"table:album_access_decisions,alias:decision"`
	AlbumID       UUID `bun:"album_id,pk,type:uuid"`
	PersonID      UUID `bun:"person_id,pk,type:uuid"`
	Decision      string
	UpdatedAt     time.Time
}

type AlbumEntry

type AlbumEntry struct {
	bun.BaseModel `bun:"table:album_entries,alias:album_entry"`
	ID            UUID  `bun:"id,pk,type:uuid"`
	AlbumID       UUID  `bun:"type:uuid"`
	MediaItemID   UUID  `bun:"type:uuid"`
	MomentID      *UUID `bun:"type:uuid"`
	RemovedAt     *time.Time
	ExcludedAt    *time.Time
}

AlbumEntry retains identity when membership is removed, without keeping an empty Moment. ExcludedAt marks a removed entry the Curator keeps out of this Album while the asset stays in the source album.

type AnnouncedAlbum

type AnnouncedAlbum struct {
	bun.BaseModel `bun:"table:announced_albums,alias:announced_album"`
	PersonID      UUID `bun:"person_id,pk,type:uuid"`
	AlbumID       UUID `bun:"album_id,pk,type:uuid"`
	AnnouncedAt   time.Time
}

type AnnouncedEntry

type AnnouncedEntry struct {
	bun.BaseModel  `bun:"table:announced_entries,alias:announced_entry"`
	PersonID       UUID  `bun:"person_id,pk,type:uuid"`
	EntryID        UUID  `bun:"entry_id,pk,type:uuid"`
	NotificationID *UUID `bun:"notification_id,type:uuid"`
	AnnouncedAt    time.Time
}

AnnouncedEntry is the lifetime association between a Person and an Album Entry. NotificationID names the Update Notification that announced it, and is nil for content added at Onboarding or dismissed without a notification.

type Chapter

type Chapter struct {
	Title string  `json:"title"`
	Start float64 `json:"start"`
	End   float64 `json:"end"`
}

Chapter is a read-only navigation segment in seconds from the start.

type EntryAccessDecision

type EntryAccessDecision struct {
	bun.BaseModel `bun:"table:entry_access_decisions,alias:decision"`
	EntryID       UUID `bun:"entry_id,pk,type:uuid"`
	AlbumID       UUID `bun:"type:uuid"`
	PersonID      UUID `bun:"person_id,pk,type:uuid"`
	Decision      string
	UpdatedAt     time.Time
}

type Identity

type Identity struct {
	bun.BaseModel `bun:"table:identities"`
	ID            UUID `bun:"id,pk,type:uuid"`
	PersonID      UUID `bun:"person_id,type:uuid"`
	Provider      string
	Subject       string
	Email         string
	UnlinkedAt    *time.Time
	CreatedAt     time.Time
}

type IgnoredSource added in v0.2.0

type IgnoredSource struct {
	bun.BaseModel `bun:"table:ignored_sources,alias:ignored_source"`
	SourceID      string `bun:"source_id,pk"`
	CreatedAt     time.Time
}

IgnoredSource is an Immich album a Curator keeps off the import list.

type ImmichFaceLink struct {
	bun.BaseModel `bun:"table:immich_face_links,alias:face_link"`
	SourceID      string `bun:"source_id,pk"`
	PersonID      *UUID  `bun:"type:uuid"`
	Ignored       bool
	UpdatedAt     time.Time
}

type Invitation

type Invitation struct {
	bun.BaseModel      `bun:"table:invitations,alias:invitation"`
	ID                 UUID `bun:"id,pk,type:uuid"`
	PersonID           UUID `bun:"person_id,type:uuid"`
	PreauthorizationID UUID `bun:"preauthorization_id,type:uuid"`
	DeliveryID         UUID `bun:"delivery_id,type:uuid"`
	SentBy             UUID `bun:"sent_by,type:uuid"`
	CreatedAt          time.Time
}

type MailDelivery

type MailDelivery struct {
	bun.BaseModel `bun:"table:mail_deliveries,alias:delivery"`
	ID            UUID `bun:"id,pk,type:uuid"`
	Kind          string
	Recipient     string
	Subject       string
	Body          string
	Status        string
	Attempts      int
	Message       string
	CreatedAt     time.Time
	UpdatedAt     time.Time
	DeliveredAt   *time.Time
}

MailDelivery is Memento's authoritative delivery state; River rows are never exposed.

type MediaChapterResult

type MediaChapterResult struct {
	bun.BaseModel `bun:"table:media_chapter_results,alias:chapter_result"`
	MediaItemID   UUID `bun:"media_item_id,pk,type:uuid"`
	Checksum      string
	Status        string
	Message       string
	Chapters      []Chapter `bun:"chapters,type:jsonb"`
	UpdatedAt     time.Time
}

MediaChapterResult caches one Media Item's ffprobe outcome for the checksum it was probed at. A changed checksum replaces the row and requeues work.

type MediaFaceAssociation

type MediaFaceAssociation struct {
	bun.BaseModel `bun:"table:media_face_associations,alias:face"`
	MediaItemID   UUID   `bun:"media_item_id,pk,type:uuid"`
	SourceFaceID  string `bun:"source_face_id,pk"`
	SourceName    string
	SourceVersion string
}

type MediaFaceRefresh

type MediaFaceRefresh struct {
	bun.BaseModel `bun:"table:media_face_refreshes,alias:refresh"`
	MediaItemID   UUID `bun:"media_item_id,pk,type:uuid"`
	RefreshedAt   time.Time
}

type MediaItem

type MediaItem struct {
	bun.BaseModel        `bun:"table:media_items,alias:media_item"`
	ID                   UUID `bun:"id,pk,type:uuid"`
	SourceID             string
	Checksum             string
	Filename             string
	Kind                 string
	CapturedAt           time.Time `bun:"type:timestamp without time zone"`
	SourceCreatedAt      time.Time
	SourceUpdatedAt      time.Time
	Offline              bool
	Trashed              bool
	Width                *int
	Height               *int
	Duration             *int
	Thumbhash            *string
	LivePhotoVideoID     *string
	SourceStackID        *string
	SourceStackPrimaryID *string
	SourceStackCount     *int
	EXIF                 map[string]any `bun:"exif,type:jsonb"`
	ContentVersion       string
	// VideoTitle is the Curator's optional presentation title. Nil means the
	// filename without its extension is shown.
	VideoTitle *string
}

MediaItem holds shared source facts, never media bytes.

type Moment

type Moment struct {
	bun.BaseModel `bun:"table:moments,alias:moment"`
	ID            UUID `bun:"id,pk,type:uuid"`
	AlbumID       UUID `bun:"type:uuid"`
	CaptureDate   string
	Title         *string
	SortOrder     int64
	CoverEntryID  UUID `bun:"type:uuid"`
	// CoverPosition is the Moment's place in the Album's Cover Order; nil
	// leaves it to capture order.
	CoverPosition *int64
}

type MomentAccessDecision

type MomentAccessDecision struct {
	bun.BaseModel `bun:"table:moment_access_decisions,alias:decision"`
	MomentID      UUID `bun:"moment_id,pk,type:uuid"`
	AlbumID       UUID `bun:"type:uuid"`
	PersonID      UUID `bun:"person_id,pk,type:uuid"`
	Decision      string
	UpdatedAt     time.Time
}

type Person

type Person struct {
	bun.BaseModel         `bun:"table:persons"`
	ID                    UUID `bun:"id,pk,type:uuid"`
	DisplayName           string
	IsCurator             bool
	OnboardingCompletedAt *time.Time
	DeactivatedAt         *time.Time
	UpdateIdentityID      *UUID  `bun:"update_identity_id,type:uuid"`
	UpdateEmail           string `bun:",scanonly"`
	EmailUpdates          bool
	AvatarFaceID          *string
	AvatarVersion         string `bun:",scanonly"`
	CreatedAt             time.Time
}

type Preauthorization

type Preauthorization struct {
	bun.BaseModel `bun:"table:preauthorizations"`
	ID            UUID `bun:"id,pk,type:uuid"`
	PersonID      UUID `bun:"person_id,type:uuid"`
	Email         string
	CreatedAt     time.Time
	ConsumedAt    *time.Time
	RevokedAt     *time.Time
}

type Session

type Session struct {
	bun.BaseModel `bun:"table:sessions"`
	ID            UUID `bun:"id,type:uuid"`
	Device        string
	TokenHash     []byte `bun:"token_hash,pk"`
	IdentityID    UUID   `bun:"identity_id,type:uuid"`
	CreatedAt     time.Time
	RenewedAt     time.Time
	ExpiresAt     time.Time
}

type UUID

type UUID uuid.UUID

UUID adds database support to the standard library UUID type.

func NewUUIDv7

func NewUUIDv7() UUID

func (UUID) MarshalText

func (u UUID) MarshalText() ([]byte, error)

func (*UUID) Scan

func (u *UUID) Scan(src any) error

func (UUID) String

func (u UUID) String() string

func (*UUID) UnmarshalText

func (u *UUID) UnmarshalText(text []byte) error

func (UUID) Value

func (u UUID) Value() (driver.Value, error)

type UnsubscribeToken

type UnsubscribeToken struct {
	bun.BaseModel `bun:"table:unsubscribe_tokens,alias:unsubscribe"`
	PersonID      UUID `bun:"person_id,pk,type:uuid"`
	Token         string
	CreatedAt     time.Time
}

UnsubscribeToken is a Person's private link secret for stopping update email without signing in. The token itself is stored so every later email can carry the same link.

type UpdateNotification

type UpdateNotification struct {
	bun.BaseModel `bun:"table:update_notifications,alias:notification"`
	ID            UUID `bun:"id,pk,type:uuid"`
	PersonID      UUID `bun:"person_id,type:uuid"`
	Version       int
	Payload       json.RawMessage `bun:"payload,type:jsonb"`
	CreatedAt     time.Time
	ReadAt        *time.Time
	DeliveryID    *UUID `bun:"delivery_id,type:uuid"`
}

UpdateNotification is one approved, immutable in-app summary. Version names the payload shape so later readers can still render old rows; ReadAt is the only column that changes after creation. DeliveryID names the optional email for the same summary and is nil when the Person gets it in app only.

Jump to

Keyboard shortcuts

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