🎉 Initial Commit
This commit is contained in:
28
pkg/internal/models/product.go
Normal file
28
pkg/internal/models/product.go
Normal 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"`
|
||||
}
|
35
pkg/internal/models/release.go
Normal file
35
pkg/internal/models/release.go
Normal 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"`
|
||||
}
|
Reference in New Issue
Block a user