feat: Enhance dependency injection and service integration
- Updated main.go to initialize email service and include it in the dependency injection container. - Refactored handlers to utilize context in service method calls, improving consistency and error handling. - Introduced new service options for upload, security, and captcha services, enhancing modularity and testability. - Removed unused repository implementations to streamline the codebase. This commit continues the effort to improve the architecture by ensuring all services are properly injected and utilized across the application.
This commit is contained in:
25
internal/model/base.go
Normal file
25
internal/model/base.go
Normal file
@@ -0,0 +1,25 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
// BaseModel 基础模型
|
||||
// 包含 uint 类型的 ID 和标准时间字段,但时间字段不通过 JSON 返回给前端
|
||||
type BaseModel struct {
|
||||
// ID 主键
|
||||
ID uint `gorm:"primarykey" json:"id"`
|
||||
|
||||
// CreatedAt 创建时间 (不返回给前端)
|
||||
CreatedAt time.Time `gorm:"column:created_at" json:"-"`
|
||||
|
||||
// UpdatedAt 更新时间 (不返回给前端)
|
||||
UpdatedAt time.Time `gorm:"column:updated_at" json:"-"`
|
||||
|
||||
// DeletedAt 删除时间 (软删除,不返回给前端)
|
||||
DeletedAt gorm.DeletedAt `gorm:"index;column:deleted_at" json:"-"`
|
||||
}
|
||||
|
||||
|
||||
@@ -56,8 +56,11 @@ type ProfileTextureMetadata struct {
|
||||
}
|
||||
|
||||
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"`
|
||||
PrivateKey string `json:"private_key" bson:"private_key"`
|
||||
PublicKey string `json:"public_key" bson:"public_key"`
|
||||
PublicKeySignature string `json:"public_key_signature" bson:"public_key_signature"`
|
||||
PublicKeySignatureV2 string `json:"public_key_signature_v2" bson:"public_key_signature_v2"`
|
||||
YggdrasilPublicKey string `json:"yggdrasil_public_key" bson:"yggdrasil_public_key"`
|
||||
Expiration time.Time `json:"expiration" bson:"expiration"`
|
||||
Refresh time.Time `json:"refresh" bson:"refresh"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user