♻️ User dealer's BaseModel

This commit is contained in:
2024-09-11 23:55:46 +08:00
parent 6c5a99e867
commit 98036b18b7
5 changed files with 22 additions and 29 deletions

View File

@ -1,8 +1,10 @@
package models
import (
"gorm.io/datatypes"
"time"
"git.solsynth.dev/hydrogen/dealer/pkg/hyper"
"gorm.io/datatypes"
)
type AttachmentDst = int8
@ -13,7 +15,7 @@ const (
)
type Attachment struct {
BaseModel
hyper.BaseModel
// Random ID is for accessing (appear in URL)
Rid string `json:"rid" gorm:"uniqueIndex"`

View File

@ -1,17 +0,0 @@
package models
import (
"time"
"gorm.io/datatypes"
"gorm.io/gorm"
)
type JSONMap = datatypes.JSONType[map[string]any]
type BaseModel struct {
ID uint `json:"id" gorm:"primaryKey"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
DeletedAt gorm.DeletedAt `json:"deleted_at" gorm:"index"`
}

View File

@ -1,9 +1,12 @@
package models
import "gorm.io/datatypes"
import (
"git.solsynth.dev/hydrogen/dealer/pkg/hyper"
"gorm.io/datatypes"
)
type AttachmentPool struct {
BaseModel
hyper.BaseModel
Alias string `json:"alias"`
Name string `json:"name"`

View File

@ -1,7 +1,9 @@
package models
import "git.solsynth.dev/hydrogen/dealer/pkg/hyper"
type Sticker struct {
BaseModel
hyper.BaseModel
Alias string `json:"alias"`
Name string `json:"name"`
@ -14,7 +16,7 @@ type Sticker struct {
}
type StickerPack struct {
BaseModel
hyper.BaseModel
Prefix string `json:"prefix"`
Name string `json:"name"`