🎨 Update project structure
This commit is contained in:
18
pkg/internal/models/accounts.go
Normal file
18
pkg/internal/models/accounts.go
Normal file
@ -0,0 +1,18 @@
|
||||
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
|
||||
|
||||
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"`
|
||||
Attachments []Attachment `json:"attachments"`
|
||||
ExternalID uint `json:"external_id"`
|
||||
}
|
22
pkg/internal/models/attachments.go
Normal file
22
pkg/internal/models/attachments.go
Normal file
@ -0,0 +1,22 @@
|
||||
package models
|
||||
|
||||
import "gorm.io/datatypes"
|
||||
|
||||
type Attachment struct {
|
||||
BaseModel
|
||||
|
||||
Uuid string `json:"uuid"`
|
||||
Size int64 `json:"size"`
|
||||
Name string `json:"name"`
|
||||
Alternative string `json:"alt"`
|
||||
Usage string `json:"usage"`
|
||||
MimeType string `json:"mimetype"`
|
||||
HashCode string `json:"hash"`
|
||||
Destination string `json:"destination"`
|
||||
|
||||
Metadata datatypes.JSONMap `json:"metadata"`
|
||||
IsMature bool `json:"is_mature"`
|
||||
|
||||
Account Account `json:"account"`
|
||||
AccountID uint `json:"account_id"`
|
||||
}
|
17
pkg/internal/models/base.go
Normal file
17
pkg/internal/models/base.go
Normal file
@ -0,0 +1,17 @@
|
||||
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"`
|
||||
}
|
27
pkg/internal/models/destination.go
Normal file
27
pkg/internal/models/destination.go
Normal file
@ -0,0 +1,27 @@
|
||||
package models
|
||||
|
||||
const (
|
||||
DestinationTypeLocal = "local"
|
||||
DestinationTypeS3 = "s3"
|
||||
)
|
||||
|
||||
type BaseDestination struct {
|
||||
Type string `json:"type"`
|
||||
}
|
||||
|
||||
type LocalDestination struct {
|
||||
BaseDestination
|
||||
|
||||
Path string `json:"path"`
|
||||
}
|
||||
|
||||
type S3Destination struct {
|
||||
BaseDestination
|
||||
|
||||
Path string `json:"path"`
|
||||
Bucket string `json:"bucket"`
|
||||
Endpoint string `json:"endpoint"`
|
||||
SecretID string `json:"secret_id"`
|
||||
SecretKey string `json:"secret_key"`
|
||||
EnableSSL bool `json:"enable_ssl"`
|
||||
}
|
4
pkg/internal/models/metadata.go
Normal file
4
pkg/internal/models/metadata.go
Normal file
@ -0,0 +1,4 @@
|
||||
package models
|
||||
|
||||
type MediaMetadata struct {
|
||||
}
|
Reference in New Issue
Block a user