chore: 初始化仓库,排除二进制文件和覆盖率文件
This commit is contained in:
63
internal/model/profile.go
Normal file
63
internal/model/profile.go
Normal file
@@ -0,0 +1,63 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
// Profile Minecraft 档案模型
|
||||
type Profile struct {
|
||||
UUID string `gorm:"column:uuid;type:varchar(36);primaryKey" json:"uuid"`
|
||||
UserID int64 `gorm:"column:user_id;not null;index" json:"user_id"`
|
||||
Name string `gorm:"column:name;type:varchar(16);not null;uniqueIndex" json:"name"` // Minecraft 角色名
|
||||
SkinID *int64 `gorm:"column:skin_id;type:bigint" json:"skin_id,omitempty"`
|
||||
CapeID *int64 `gorm:"column:cape_id;type:bigint" json:"cape_id,omitempty"`
|
||||
RSAPrivateKey string `gorm:"column:rsa_private_key;type:text;not null" json:"-"` // RSA 私钥不返回给前端
|
||||
IsActive bool `gorm:"column:is_active;not null;default:true;index" json:"is_active"`
|
||||
LastUsedAt *time.Time `gorm:"column:last_used_at;type:timestamp" json:"last_used_at,omitempty"`
|
||||
CreatedAt time.Time `gorm:"column:created_at;type:timestamp;not null;default:CURRENT_TIMESTAMP" json:"created_at"`
|
||||
UpdatedAt time.Time `gorm:"column:updated_at;type:timestamp;not null;default:CURRENT_TIMESTAMP" json:"updated_at"`
|
||||
|
||||
// 关联
|
||||
User *User `gorm:"foreignKey:UserID" json:"user,omitempty"`
|
||||
Skin *Texture `gorm:"foreignKey:SkinID" json:"skin,omitempty"`
|
||||
Cape *Texture `gorm:"foreignKey:CapeID" json:"cape,omitempty"`
|
||||
}
|
||||
|
||||
// TableName 指定表名
|
||||
func (Profile) TableName() string {
|
||||
return "profiles"
|
||||
}
|
||||
|
||||
// ProfileResponse 档案响应(包含完整的皮肤/披风信息)
|
||||
type ProfileResponse struct {
|
||||
UUID string `json:"uuid"`
|
||||
Name string `json:"name"`
|
||||
Textures ProfileTexturesData `json:"textures"`
|
||||
IsActive bool `json:"is_active"`
|
||||
LastUsedAt *time.Time `json:"last_used_at,omitempty"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
}
|
||||
|
||||
// ProfileTexturesData Minecraft 材质数据结构
|
||||
type ProfileTexturesData struct {
|
||||
Skin *ProfileTexture `json:"SKIN,omitempty"`
|
||||
Cape *ProfileTexture `json:"CAPE,omitempty"`
|
||||
}
|
||||
|
||||
// ProfileTexture 单个材质信息
|
||||
type ProfileTexture struct {
|
||||
URL string `json:"url"`
|
||||
Metadata *ProfileTextureMetadata `json:"metadata,omitempty"`
|
||||
}
|
||||
|
||||
// ProfileTextureMetadata 材质元数据
|
||||
type ProfileTextureMetadata struct {
|
||||
Model string `json:"model,omitempty"` // "slim" or "classic"
|
||||
}
|
||||
|
||||
type KeyPair struct {
|
||||
PrivateKey string `json:"private_key" bson:"private_key"`
|
||||
PublicKey string `json:"public_key" bson:"public_key"`
|
||||
Expiration time.Time `json:"expiration" bson:"expiration"`
|
||||
Refresh time.Time `json:"refresh" bson:"refresh"`
|
||||
}
|
||||
Reference in New Issue
Block a user