🎉 Initial Commit

This commit is contained in:
2025-01-08 22:19:45 +08:00
commit 70be262a78
25 changed files with 1932 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
package models
import (
"git.solsynth.dev/hypernet/nexus/pkg/nex/cruda"
"gorm.io/datatypes"
)
type Product struct {
cruda.BaseModel
Name string `json:"name"`
Alias string `json:"alias" gorm:"uniqueIndex"`
Description string `json:"description"`
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"`
ProductID uint `json:"product_id"`
}

View File

@@ -0,0 +1,35 @@
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"`
Assets datatypes.JSON `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"`
}