- Introduced new API endpoints for rendering textures, avatars, capes, and previews, enhancing the texture handling capabilities. - Implemented corresponding service methods in the TextureHandler to process rendering requests and return appropriate responses. - Updated the TextureRenderService interface to include methods for rendering textures, avatars, and capes, along with their respective parameters. - Enhanced error handling for invalid texture IDs and added support for different rendering types and formats. - Updated go.mod to include the webp library for image processing.
38 lines
862 B
Go
38 lines
862 B
Go
package repository
|
|
|
|
import (
|
|
"carrotskin/internal/model"
|
|
"context"
|
|
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
// yggdrasilRepository YggdrasilRepository的实现
|
|
type yggdrasilRepository struct {
|
|
db *gorm.DB
|
|
}
|
|
|
|
// NewYggdrasilRepository 创建YggdrasilRepository实例
|
|
func NewYggdrasilRepository(db *gorm.DB) YggdrasilRepository {
|
|
return &yggdrasilRepository{db: db}
|
|
}
|
|
|
|
func (r *yggdrasilRepository) GetPasswordByID(ctx context.Context, id int64) (string, error) {
|
|
var yggdrasil model.Yggdrasil
|
|
err := r.db.WithContext(ctx).Select("password").Where("id = ?", id).First(&yggdrasil).Error
|
|
if err != nil {
|
|
return "", err
|
|
}
|
|
return yggdrasil.Password, nil
|
|
}
|
|
|
|
func (r *yggdrasilRepository) ResetPassword(ctx context.Context, id int64, password string) error {
|
|
return r.db.WithContext(ctx).Model(&model.Yggdrasil{}).Where("id = ?", id).Update("password", password).Error
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|