models

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 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
	Email         string
	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 addresses 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 AlbumJoin added in v0.5.0

type AlbumJoin struct {
	bun.BaseModel `bun:"table:album_joins,alias:album_join"`
	AlbumID       UUID `bun:"album_id,pk,type:uuid"`
	PersonID      UUID `bun:"person_id,pk,type:uuid"`
	CreatedAt     time.Time
}

AlbumJoin places an Album's offered media among one Person's own. It outlives the Offers it covers.

type AlbumOffer added in v0.5.0

type AlbumOffer struct {
	bun.BaseModel `bun:"table:album_offers,alias:offer"`
	AlbumID       UUID `bun:"album_id,pk,type:uuid"`
	CircleID      UUID `bun:"circle_id,pk,type:uuid"`
	CreatedAt     time.Time
}

AlbumOffer makes a whole Album available to one Circle while the Album is published. Person decisions still outrank it.

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 AnnouncedOfferedAlbum added in v0.5.0

type AnnouncedOfferedAlbum struct {
	bun.BaseModel `bun:"table:announced_offered_albums,alias:announced_offered_album"`
	PersonID      UUID `bun:"person_id,pk,type:uuid"`
	AlbumID       UUID `bun:"album_id,pk,type:uuid"`
	AnnouncedAt   time.Time
}

AnnouncedOfferedAlbum records that an Album was announced to a Person as new to view, so it is never announced that way again.

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 Circle added in v0.5.0

type Circle struct {
	bun.BaseModel `bun:"table:circles,alias:circle"`
	ID            UUID `bun:"id,pk,type:uuid"`
	Name          string
	CreatedAt     time.Time
}

Circle is a Curator-named set of People. Names are Curator-only.

type CircleMember added in v0.5.0

type CircleMember struct {
	bun.BaseModel `bun:"table:circle_members,alias:member"`
	CircleID      UUID `bun:"circle_id,pk,type:uuid"`
	PersonID      UUID `bun:"person_id,pk,type:uuid"`
}

CircleMember places one Person in one Circle.

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 HandoffCode added in v0.4.0

type HandoffCode struct {
	bun.BaseModel `bun:"table:handoff_codes"`
	CodeHash      []byte `bun:"code_hash,pk"`
	LinkedEmailID UUID   `bun:"linked_email_id,type:uuid"`
	ExpiresAt     time.Time
}

HandoffCode is exchanged once by the Mobile App for a session of its own.

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 LinkedEmail added in v0.4.0

type LinkedEmail struct {
	bun.BaseModel `bun:"table:linked_emails,alias:linked_email"`
	ID            UUID `bun:"id,pk,type:uuid"`
	PersonID      UUID `bun:"person_id,type:uuid"`
	Email         string
	UnlinkedAt    *time.Time
	CreatedAt     time.Time
}

LinkedEmail is a verified, lowercased address that signs its Person in. Unlinking keeps the row so the address stays known.

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
	HTML          string `bun:"html"`
	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
	// Edited is whether Immich reports non-destructive edits. Nil means the
	// row predates Memento reading it.
	Edited               *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 MomentOffer added in v0.5.0

type MomentOffer struct {
	bun.BaseModel `bun:"table:moment_offers,alias:moment_offer"`
	MomentID      UUID `bun:"moment_id,pk,type:uuid"`
	AlbumID       UUID `bun:"type:uuid"`
	CircleID      UUID `bun:"circle_id,pk,type:uuid"`
	Decision      string
	UpdatedAt     time.Time
}

MomentOffer offers one Moment to a Circle or withholds it from the Album Offer. A missing row inherits the Album Offer.

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
	UpdateEmailID         *UUID  `bun:"update_email_id,type:uuid"`
	UpdateEmail           string `bun:",scanonly"`
	EmailUpdates          bool
	// OfferedAlbumUpdates inserts as the column default, on, because false is
	// Go's zero value. Updates write it as given.
	OfferedAlbumUpdates bool `bun:",default:true"`
	AvatarFaceID        *string
	AvatarVersion       string `bun:",scanonly"`
	// RetiredTips inserts as the column default, empty, because nil is Go's
	// zero value.
	RetiredTips []string `bun:",array,default:'{}'"`
	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"`
	LinkedEmailID UUID   `bun:"linked_email_id,type:uuid"`
	CreatedAt     time.Time
	RenewedAt     time.Time
	ExpiresAt     time.Time
}

type SignInCode added in v0.4.0

type SignInCode struct {
	bun.BaseModel `bun:"table:sign_in_codes,alias:code"`
	ID            UUID `bun:"id,pk,type:uuid"`
	Email         string
	CodeHash      []byte
	Known         bool
	Decoy         bool
	Attempts      int
	CreatedAt     time.Time
	ExpiresAt     time.Time
	UsedAt        *time.Time
}

SignInCode is one emailed Sign-in Code. Only the newest code for an address can be verified; older rows stay for an hour so the send limits can count them. Known records whether the address would sign in when the code was sent. A decoy stands in for a code the unknown-address cap kept from being sent, so it was never emailed and nothing can match it.

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 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