🎉 Initial Commit

This commit is contained in:
2025-01-09 18:56:30 +08:00
commit 2950d2ed06
27 changed files with 2110 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
package models
import (
"git.solsynth.dev/hypernet/nexus/pkg/nex/cruda"
"gorm.io/datatypes"
)
type Product struct {
cruda.BaseModel
Icon string `json:"icon"` // random id of atttachment
Name string `json:"name"`
Alias string `json:"alias" gorm:"uniqueIndex"`
Description string `json:"description"`
Previews datatypes.JSONSlice[string] `json:"previews"` // random id of attachments
Tags datatypes.JSONSlice[string] `json:"tags"`
Meta ProductMeta `json:"meta" gorm:"foreignKey:ProductID"`
Releases []ProductRelease `json:"releases" gorm:"foreignKey:ProductID"`
AccountID uint `json:"account_id"`
}
type ProductMeta struct {
cruda.BaseModel
Introduction string `json:"introduction"`
Attachments datatypes.JSONSlice[string] `json:"attachments"` // random id of attachments
ProductID uint `json:"product_id"`
}

View File

@@ -0,0 +1,36 @@
package models
import (
"git.solsynth.dev/hypernet/nexus/pkg/nex/cruda"
"gorm.io/datatypes"
)
type ProductReleaseType int
const (
ReleaseTypeMinor = ProductReleaseType(iota)
ReleaseTypeRegular
ReleaseTypeMajor
)
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"`
ProductID uint `json:"product_id"`
Meta ProductReleaseMeta `json:"meta" gorm:"foreignKey:ReleaseID"`
}
type ProductReleaseMeta struct {
cruda.BaseModel
Title string `json:"title"`
Description string `json:"description"`
Content string `json:"content"`
Attachments datatypes.JSONSlice[string] `json:"attachments"`
ReleaseID uint `json:"release_id"`
}