♻️ Use dealer's BaseModel

This commit is contained in:
2024-09-11 23:58:02 +08:00
parent f962376f42
commit 14e3750bd9
20 changed files with 48 additions and 45 deletions

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,12 +1,14 @@
package models
import (
"github.com/livekit/protocol/livekit"
"time"
"git.solsynth.dev/hydrogen/dealer/pkg/hyper"
"github.com/livekit/protocol/livekit"
)
type Call struct {
BaseModel
hyper.BaseModel
EndedAt *time.Time `json:"ended_at"`

View File

@ -1,6 +1,10 @@
package models
import "fmt"
import (
"fmt"
"git.solsynth.dev/hydrogen/dealer/pkg/hyper"
)
type ChannelType = uint8
@ -10,7 +14,7 @@ const (
)
type Channel struct {
BaseModel
hyper.BaseModel
Alias string `json:"alias"`
Name string `json:"name"`
@ -46,7 +50,7 @@ const (
)
type ChannelMember struct {
BaseModel
hyper.BaseModel
ChannelID uint `json:"channel_id"`
AccountID uint `json:"account_id"`

View File

@ -1,6 +1,9 @@
package models
import "gorm.io/datatypes"
import (
"git.solsynth.dev/hydrogen/dealer/pkg/hyper"
"gorm.io/datatypes"
)
const (
EventMessageNew = "messages.new"
@ -10,7 +13,7 @@ const (
)
type Event struct {
BaseModel
hyper.BaseModel
Uuid string `json:"uuid"`
Body datatypes.JSONMap `json:"body"`

View File

@ -1,9 +1,11 @@
package models
import "git.solsynth.dev/hydrogen/dealer/pkg/hyper"
// Realm profiles basically fetched from Hydrogen.Passport
// But cache at here for better usage and database relations
type Realm struct {
BaseModel
hyper.BaseModel
Alias string `json:"alias"`
Name string `json:"name"`