167 lines
4.3 KiB
Go
167 lines
4.3 KiB
Go
package db
|
|
|
|
import "time"
|
|
|
|
// User represents a user in the system
|
|
type User struct {
|
|
DID string
|
|
Handle string
|
|
PDSEndpoint string
|
|
Avatar string
|
|
LastSeen time.Time
|
|
}
|
|
|
|
// Manifest represents an OCI manifest stored in the cache
|
|
type Manifest struct {
|
|
ID int64
|
|
DID string
|
|
Repository string
|
|
Digest string
|
|
HoldEndpoint string
|
|
SchemaVersion int
|
|
MediaType string
|
|
ConfigDigest string
|
|
ConfigSize int64
|
|
CreatedAt time.Time
|
|
// Annotations removed - now stored in repository_annotations table
|
|
}
|
|
|
|
// Layer represents a layer in a manifest
|
|
type Layer struct {
|
|
ManifestID int64
|
|
Digest string
|
|
Size int64
|
|
MediaType string
|
|
LayerIndex int
|
|
}
|
|
|
|
// ManifestReference represents a reference to a manifest in a manifest list/index
|
|
type ManifestReference struct {
|
|
ManifestID int64
|
|
Digest string
|
|
Size int64
|
|
MediaType string
|
|
PlatformArchitecture string
|
|
PlatformOS string
|
|
PlatformVariant string
|
|
PlatformOSVersion string
|
|
IsAttestation bool // true if vnd.docker.reference.type = "attestation-manifest"
|
|
ReferenceIndex int
|
|
}
|
|
|
|
// Tag represents a tag pointing to a manifest
|
|
type Tag struct {
|
|
ID int64
|
|
DID string
|
|
Repository string
|
|
Tag string
|
|
Digest string
|
|
CreatedAt time.Time
|
|
}
|
|
|
|
// Push represents a combined tag and manifest for the recent pushes view
|
|
type Push struct {
|
|
DID string
|
|
Handle string
|
|
Repository string
|
|
Tag string
|
|
Digest string
|
|
Title string
|
|
Description string
|
|
IconURL string
|
|
StarCount int
|
|
PullCount int
|
|
IsStarred bool // Whether the current user has starred this repository
|
|
CreatedAt time.Time
|
|
HoldEndpoint string // Hold endpoint for health checking
|
|
Reachable bool // Whether the hold endpoint is reachable
|
|
}
|
|
|
|
// Repository represents an aggregated view of a user's repository
|
|
type Repository struct {
|
|
Name string
|
|
TagCount int
|
|
ManifestCount int
|
|
LastPush time.Time
|
|
Tags []Tag
|
|
Manifests []Manifest
|
|
Title string
|
|
Description string
|
|
SourceURL string
|
|
DocumentationURL string
|
|
Licenses string
|
|
IconURL string
|
|
ReadmeURL string
|
|
Version string
|
|
}
|
|
|
|
// RepositoryStats represents statistics for a repository
|
|
type RepositoryStats struct {
|
|
DID string `json:"did"`
|
|
Repository string `json:"repository"`
|
|
StarCount int `json:"star_count"` // Calculated from stars table, not stored
|
|
PullCount int `json:"pull_count"`
|
|
LastPull *time.Time `json:"last_pull,omitempty"`
|
|
PushCount int `json:"push_count"`
|
|
LastPush *time.Time `json:"last_push,omitempty"`
|
|
}
|
|
|
|
// FeaturedRepository represents a repository in the featured section
|
|
type FeaturedRepository struct {
|
|
OwnerDID string
|
|
OwnerHandle string
|
|
Repository string
|
|
Title string
|
|
Description string
|
|
IconURL string
|
|
StarCount int
|
|
PullCount int
|
|
IsStarred bool // Whether the current user has starred this repository
|
|
}
|
|
|
|
// RepositoryWithStats combines repository data with statistics
|
|
type RepositoryWithStats struct {
|
|
Repository
|
|
Stats RepositoryStats
|
|
}
|
|
|
|
// RepoCardData contains all data needed to render a repository card
|
|
type RepoCardData struct {
|
|
OwnerHandle string
|
|
Repository string
|
|
Title string
|
|
Description string
|
|
IconURL string
|
|
StarCount int
|
|
PullCount int
|
|
IsStarred bool // Whether the current user has starred this repository
|
|
}
|
|
|
|
// PlatformInfo represents platform information (OS/Architecture)
|
|
type PlatformInfo struct {
|
|
OS string
|
|
Architecture string
|
|
Variant string
|
|
OSVersion string
|
|
}
|
|
|
|
// TagWithPlatforms extends Tag with platform information
|
|
type TagWithPlatforms struct {
|
|
Tag
|
|
Platforms []PlatformInfo
|
|
IsMultiArch bool
|
|
HasAttestations bool // true if manifest list contains attestation references
|
|
}
|
|
|
|
// ManifestWithMetadata extends Manifest with tags and platform information
|
|
type ManifestWithMetadata struct {
|
|
Manifest
|
|
Tags []string
|
|
Platforms []PlatformInfo
|
|
PlatformCount int
|
|
IsManifestList bool
|
|
HasAttestations bool // true if manifest list contains attestation references
|
|
Reachable bool // Whether the hold endpoint is reachable
|
|
Pending bool // Whether health check is still in progress
|
|
}
|