Initial commit

This commit is contained in:
2025-05-11 20:32:14 +08:00
commit d97247159f
80 changed files with 13013 additions and 0 deletions

26
server/model/image.go Normal file
View File

@@ -0,0 +1,26 @@
package model
import "gorm.io/gorm"
type Image struct {
gorm.Model
FileName string
Width int
Height int
// An image can only belong to one resource, or it doesn't belong to any resource and is waiting for usage.
Resource []Resource `gorm:"many2many:resource_images;"`
}
type ImageView struct {
ID uint `json:"id"`
Width int `json:"width"`
Height int `json:"height"`
}
func (i *Image) ToView() ImageView {
return ImageView{
ID: i.ID,
Width: i.Width,
Height: i.Height,
}
}