♻️ Use the new dealer BaseUser and remove ExternalID
This commit is contained in:
@ -1,21 +1,12 @@
|
||||
package models
|
||||
|
||||
// Account profiles basically fetched from Hydrogen.Passport
|
||||
// But cache at here for better usage
|
||||
// At the same time this model can make relations between local models
|
||||
type Account struct {
|
||||
BaseModel
|
||||
import "git.solsynth.dev/hydrogen/dealer/pkg/hyper"
|
||||
|
||||
Name string `json:"name"`
|
||||
Nick string `json:"nick"`
|
||||
Avatar string `json:"avatar"`
|
||||
Banner string `json:"banner"`
|
||||
Description string `json:"description"`
|
||||
EmailAddress string `json:"email_address"`
|
||||
PowerLevel int `json:"power_level"`
|
||||
Posts []Post `json:"posts" gorm:"foreignKey:AuthorID"`
|
||||
Reactions []Reaction `json:"reactions"`
|
||||
ExternalID uint `json:"external_id"`
|
||||
type Account struct {
|
||||
hyper.BaseUser
|
||||
|
||||
Posts []Post `json:"posts" gorm:"foreignKey:AuthorID"`
|
||||
Reactions []Reaction `json:"reactions"`
|
||||
|
||||
TotalUpvote int `json:"total_upvote"`
|
||||
TotalDownvote int `json:"total_downvote"`
|
||||
|
@ -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"`
|
||||
}
|
@ -1,7 +1,9 @@
|
||||
package models
|
||||
|
||||
import "git.solsynth.dev/hydrogen/dealer/pkg/hyper"
|
||||
|
||||
type Tag struct {
|
||||
BaseModel
|
||||
hyper.BaseModel
|
||||
|
||||
Alias string `json:"alias" gorm:"uniqueIndex" validate:"lowercase"`
|
||||
Name string `json:"name"`
|
||||
@ -10,7 +12,7 @@ type Tag struct {
|
||||
}
|
||||
|
||||
type Category struct {
|
||||
BaseModel
|
||||
hyper.BaseModel
|
||||
|
||||
Alias string `json:"alias" gorm:"uniqueIndex" validate:"lowercase,alphanum"`
|
||||
Name string `json:"name"`
|
||||
|
@ -3,6 +3,7 @@ package models
|
||||
import (
|
||||
"time"
|
||||
|
||||
"git.solsynth.dev/hydrogen/dealer/pkg/hyper"
|
||||
"gorm.io/datatypes"
|
||||
)
|
||||
|
||||
@ -22,7 +23,7 @@ const (
|
||||
)
|
||||
|
||||
type Post struct {
|
||||
BaseModel
|
||||
hyper.BaseModel
|
||||
|
||||
Type string `json:"type"`
|
||||
Body datatypes.JSONMap `json:"body"`
|
||||
|
@ -1,15 +1,9 @@
|
||||
package models
|
||||
|
||||
// Realm profiles basically fetched from Hydrogen.Passport
|
||||
// But cache at here for better usage and database relations
|
||||
type Realm struct {
|
||||
BaseModel
|
||||
import "git.solsynth.dev/hydrogen/dealer/pkg/hyper"
|
||||
|
||||
Alias string `json:"alias"`
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
Posts []Post `json:"posts"`
|
||||
IsPublic bool `json:"is_public"`
|
||||
IsCommunity bool `json:"is_community"`
|
||||
ExternalID uint `json:"external_id"`
|
||||
type Realm struct {
|
||||
hyper.BaseRealm
|
||||
|
||||
Posts []Post `json:"posts"`
|
||||
}
|
||||
|
Reference in New Issue
Block a user