:card_box: Add detailed release model

This commit is contained in:
2025-01-11 13:23:24 +08:00
parent c13c1f57a4
commit 79e03e74f3
2 changed files with 46 additions and 25 deletions

View File

@ -15,10 +15,11 @@ const (
type ProductRelease struct {
cruda.BaseModel
Version string `json:"version"`
Type ProductReleaseType `json:"type"`
Channel string `json:"channel"`
Assets datatypes.JSONType[map[string]any] `json:"assets"`
Version string `json:"version"`
Type ProductReleaseType `json:"type"`
Channel string `json:"channel"`
Assets datatypes.JSONType[map[string]ReleaseAsset] `json:"assets"`
Installers datatypes.JSONType[map[string]ReleaseInstaller] `json:"installers"`
ProductID uint `json:"product_id"`
Meta ProductReleaseMeta `json:"meta" gorm:"foreignKey:ReleaseID"`
@ -33,3 +34,19 @@ type ProductReleaseMeta struct {
Attachments datatypes.JSONSlice[string] `json:"attachments"`
ReleaseID uint `json:"release_id"`
}
type ReleaseAsset struct {
URI string `json:"uri" validate:"required"`
ContentType string `json:"content_type" validate:"required"`
}
type ReleaseInstaller struct {
Workdir string `json:"workdir"`
Script string `json:"script"`
Patches []ReleaseInstallerPatch `json:"patches"`
}
type ReleaseInstallerPatch struct {
Action string `json:"action" validate:"required"`
Glob string `json:"glob" validate:"required"`
}