model

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIToken

type APIToken struct {
	ID         uuid.UUID  `gorm:"column:id;type:text;primaryKey" json:"id"`
	UserID     uuid.UUID  `gorm:"column:user_id;type:text;not null;index" json:"userId"`
	Label      *string    `gorm:"column:label;type:varchar(256)" json:"label,omitempty"`
	Prefix     string     `gorm:"column:prefix;type:varchar(20);not null;index" json:"prefix"`
	TokenHash  string     `gorm:"column:token_hash;type:varchar(128);uniqueIndex;not null" json:"-"`
	LastUsedAt *time.Time `gorm:"column:last_used_at" json:"lastUsedAt,omitempty"`
	ExpiresAt  *time.Time `gorm:"column:expires_at" json:"expiresAt,omitempty"`
	CreatedAt  time.Time  `gorm:"column:created_at;autoCreateTime" json:"createdAt"`
	RevokedAt  *time.Time `gorm:"column:revoked_at" json:"revokedAt,omitempty"`
}

func (APIToken) TableName

func (APIToken) TableName() string

type AuditLog

type AuditLog struct {
	ID           uuid.UUID  `gorm:"column:id;type:text;primaryKey" json:"id"`
	ActorID      *uuid.UUID `gorm:"column:actor_id;type:text;index" json:"actorId,omitempty"`
	Action       string     `gorm:"column:action;type:varchar(64);not null" json:"action"`
	ResourceType string     `gorm:"column:resource_type;type:varchar(64);not null" json:"resourceType"`
	ResourceID   *uuid.UUID `gorm:"column:resource_id;type:text" json:"resourceId,omitempty"`
	Details      *string    `gorm:"column:details;type:text" json:"details,omitempty"`
	IPAddress    *string    `gorm:"column:ip_address;type:text" json:"ipAddress,omitempty"`
	CreatedAt    time.Time  `gorm:"column:created_at;autoCreateTime;index" json:"createdAt"`
}

AuditLog records actions for auditing.

func (AuditLog) TableName

func (AuditLog) TableName() string

type Comment

type Comment struct {
	ID            uuid.UUID  `gorm:"column:id;type:text;primaryKey" json:"id"`
	SkillID       uuid.UUID  `gorm:"column:skill_id;type:text;not null;index" json:"skillId"`
	UserID        uuid.UUID  `gorm:"column:user_id;type:text;not null" json:"userId"`
	Body          string     `gorm:"column:body;type:text;not null" json:"body"`
	CreatedAt     time.Time  `gorm:"column:created_at;autoCreateTime" json:"createdAt"`
	UpdatedAt     time.Time  `gorm:"column:updated_at;autoUpdateTime" json:"updatedAt"`
	SoftDeletedAt *time.Time `gorm:"column:soft_deleted_at" json:"softDeletedAt,omitempty"`
}

Comment represents a user comment on a skill.

func (Comment) TableName

func (Comment) TableName() string

type DownloadDedup

type DownloadDedup struct {
	ID           uuid.UUID `gorm:"column:id;type:text;primaryKey" json:"id"`
	SkillID      uuid.UUID `gorm:"column:skill_id;type:text;not null;uniqueIndex:idx_dedup_skill_ver_identity" json:"skillId"`
	VersionID    uuid.UUID `gorm:"column:version_id;type:text;not null;uniqueIndex:idx_dedup_skill_ver_identity" json:"versionId"`
	IdentityHash string    `gorm:"column:identity_hash;type:varchar(128);not null;uniqueIndex:idx_dedup_skill_ver_identity" json:"identityHash"`
	DownloadedAt time.Time `gorm:"column:downloaded_at;not null" json:"downloadedAt"`
}

DownloadDedup tracks unique downloads per skill+version+identity.

func (DownloadDedup) TableName

func (DownloadDedup) TableName() string

type ReservedSlug

type ReservedSlug struct {
	Slug      string    `gorm:"column:slug;type:varchar(128);primaryKey" json:"slug"`
	Reason    *string   `gorm:"column:reason;type:text" json:"reason,omitempty"`
	CreatedAt time.Time `gorm:"column:created_at;autoCreateTime" json:"createdAt"`
}

ReservedSlug prevents certain slugs from being used.

func (ReservedSlug) TableName

func (ReservedSlug) TableName() string

type Skill

type Skill struct {
	ID               uuid.UUID   `gorm:"column:id;type:text;primaryKey" json:"id"`
	Slug             string      `gorm:"column:slug;type:varchar(128);uniqueIndex;not null" json:"slug"`
	DisplayName      *string     `gorm:"column:display_name;type:varchar(256)" json:"displayName,omitempty"`
	Summary          *string     `gorm:"column:summary;type:text" json:"summary,omitempty"`
	OwnerID          uuid.UUID   `gorm:"column:owner_id;type:text;not null;index" json:"ownerId"`
	LatestVersionID  *uuid.UUID  `gorm:"column:latest_version_id;type:text" json:"latestVersionId,omitempty"`
	ModerationStatus string      `gorm:"column:moderation_status;type:varchar(20);not null;default:'approved'" json:"moderationStatus"`
	IsSuspicious     bool        `gorm:"column:is_suspicious;not null;default:false" json:"isSuspicious"`
	Tags             StringArray `gorm:"column:tags;type:text;not null;default:'[]'" json:"tags"`
	Downloads        int64       `gorm:"column:downloads;not null;default:0" json:"downloads"`
	Installs         int64       `gorm:"column:installs;not null;default:0" json:"installs"`
	StarsCount       int         `gorm:"column:stars_count;not null;default:0" json:"starsCount"`
	VersionsCount    int         `gorm:"column:versions_count;not null;default:0" json:"versionsCount"`
	CommentsCount    int         `gorm:"column:comments_count;not null;default:0" json:"commentsCount"`
	CreatedAt        time.Time   `gorm:"column:created_at;autoCreateTime" json:"createdAt"`
	UpdatedAt        time.Time   `gorm:"column:updated_at;autoUpdateTime" json:"updatedAt"`
	SoftDeletedAt    *time.Time  `gorm:"column:soft_deleted_at;index" json:"softDeletedAt,omitempty"`
}

func (Skill) TableName

func (Skill) TableName() string

type SkillDailyStats

type SkillDailyStats struct {
	ID         uuid.UUID `gorm:"column:id;type:text;primaryKey" json:"id"`
	SkillID    uuid.UUID `gorm:"column:skill_id;type:text;not null;uniqueIndex:idx_daily_stats_skill_date" json:"skillId"`
	Date       string    `gorm:"column:date;type:varchar(10);not null;uniqueIndex:idx_daily_stats_skill_date" json:"date"`
	Downloads  int       `gorm:"column:downloads;not null;default:0" json:"downloads"`
	Installs   int       `gorm:"column:installs;not null;default:0" json:"installs"`
	StarsDelta int       `gorm:"column:stars_delta;not null;default:0" json:"starsDelta"`
}

SkillDailyStats tracks daily skill metrics.

func (SkillDailyStats) TableName

func (SkillDailyStats) TableName() string

type SkillOwnershipTransfer

type SkillOwnershipTransfer struct {
	ID         uuid.UUID  `gorm:"column:id;type:text;primaryKey" json:"id"`
	SkillID    uuid.UUID  `gorm:"column:skill_id;type:text;not null" json:"skillId"`
	FromUserID uuid.UUID  `gorm:"column:from_user_id;type:text;not null" json:"fromUserId"`
	ToUserID   uuid.UUID  `gorm:"column:to_user_id;type:text;not null" json:"toUserId"`
	Status     string     `gorm:"column:status;type:varchar(20);not null;default:'pending'" json:"status"`
	CreatedAt  time.Time  `gorm:"column:created_at;autoCreateTime" json:"createdAt"`
	ResolvedAt *time.Time `gorm:"column:resolved_at" json:"resolvedAt,omitempty"`
}

SkillOwnershipTransfer tracks skill ownership transfers.

func (SkillOwnershipTransfer) TableName

func (SkillOwnershipTransfer) TableName() string

type SkillSlugAlias

type SkillSlugAlias struct {
	ID        uuid.UUID `gorm:"column:id;type:text;primaryKey" json:"id"`
	SkillID   uuid.UUID `gorm:"column:skill_id;type:text;not null;index" json:"skillId"`
	OldSlug   string    `gorm:"column:old_slug;type:varchar(128);uniqueIndex;not null" json:"oldSlug"`
	CreatedAt time.Time `gorm:"column:created_at;autoCreateTime" json:"createdAt"`
}

SkillSlugAlias for slug rename redirects.

func (SkillSlugAlias) TableName

func (SkillSlugAlias) TableName() string

type SkillVersion

type SkillVersion struct {
	ID              uuid.UUID       `gorm:"column:id;type:text;primaryKey" json:"id"`
	SkillID         uuid.UUID       `gorm:"column:skill_id;type:text;not null;index" json:"skillId"`
	Version         string          `gorm:"column:version;type:varchar(64);not null" json:"version"`
	Fingerprint     string          `gorm:"column:fingerprint;type:varchar(128);not null;index" json:"fingerprint"`
	GitCommitHash   *string         `gorm:"column:git_commit_hash;type:varchar(64)" json:"gitCommitHash,omitempty"`
	Changelog       *string         `gorm:"column:changelog;type:text" json:"changelog,omitempty"`
	ChangelogSource *string         `gorm:"column:changelog_source;type:varchar(20)" json:"changelogSource,omitempty"`
	Files           json.RawMessage `gorm:"column:files;type:text;not null;default:'[]'" json:"files"`
	Parsed          json.RawMessage `gorm:"column:parsed;type:text;not null;default:'{}'" json:"parsed"`
	CreatedBy       uuid.UUID       `gorm:"column:created_by;type:text;not null" json:"createdBy"`
	SHA256Hash      string          `gorm:"column:sha256_hash;type:varchar(128);not null;index" json:"sha256Hash"`
	CreatedAt       time.Time       `gorm:"column:created_at;autoCreateTime" json:"createdAt"`
	SoftDeletedAt   *time.Time      `gorm:"column:soft_deleted_at" json:"softDeletedAt,omitempty"`
}

func (SkillVersion) TableName

func (SkillVersion) TableName() string

type SkillWithOwner

type SkillWithOwner struct {
	Skill
	OwnerHandle      string  `gorm:"column:owner_handle" json:"ownerHandle"`
	OwnerDisplayName *string `gorm:"column:owner_display_name" json:"ownerDisplayName,omitempty"`
	OwnerAvatarURL   *string `gorm:"column:owner_avatar_url" json:"ownerAvatarUrl,omitempty"`
}

SkillWithOwner adds owner info for API responses (not a DB table).

type Star

type Star struct {
	ID        uuid.UUID `gorm:"column:id;type:text;primaryKey" json:"id"`
	UserID    uuid.UUID `gorm:"column:user_id;type:text;not null;uniqueIndex:idx_stars_user_skill" json:"userId"`
	SkillID   uuid.UUID `gorm:"column:skill_id;type:text;not null;uniqueIndex:idx_stars_user_skill;index" json:"skillId"`
	CreatedAt time.Time `gorm:"column:created_at;autoCreateTime" json:"createdAt"`
}

Star represents a user starring a skill.

func (Star) TableName

func (Star) TableName() string

type StringArray

type StringArray []string

StringArray is stored as JSON in the database (compatible with both SQLite and PostgreSQL).

func (*StringArray) Scan

func (a *StringArray) Scan(src interface{}) error

func (StringArray) Value

func (a StringArray) Value() (driver.Value, error)

type User

type User struct {
	ID           uuid.UUID `gorm:"column:id;type:text;primaryKey" json:"id"`
	Handle       string    `gorm:"column:handle;type:varchar(64);uniqueIndex;not null" json:"handle"`
	DisplayName  *string   `gorm:"column:display_name;type:varchar(256)" json:"displayName,omitempty"`
	AvatarURL    *string   `gorm:"column:avatar_url;type:text" json:"avatarUrl,omitempty"`
	Email        *string   `gorm:"column:email;type:varchar(320)" json:"email,omitempty"`
	PasswordHash *string   `gorm:"column:password_hash;type:varchar(256)" json:"-"`
	Role         string    `gorm:"column:role;type:varchar(20);not null;default:'user'" json:"role"`
	IsBanned     bool      `gorm:"column:is_banned;not null;default:false" json:"isBanned"`
	BanReason    *string   `gorm:"column:ban_reason;type:text" json:"banReason,omitempty"`
	CreatedAt    time.Time `gorm:"column:created_at;autoCreateTime" json:"createdAt"`
	UpdatedAt    time.Time `gorm:"column:updated_at;autoUpdateTime" json:"updatedAt"`
}

func (*User) IsAdmin

func (u *User) IsAdmin() bool

func (*User) IsModerator

func (u *User) IsModerator() bool

func (User) TableName

func (User) TableName() string

type VersionFile

type VersionFile struct {
	Path        string `json:"path"`
	Size        int64  `json:"size"`
	SHA256      string `json:"sha256"`
	ContentType string `json:"contentType,omitempty"`
}

Jump to

Keyboard shortcuts

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