tailly_back_v2/internal/http/graph/user_resolvers.go
madipo2611 a5a90bed7e v0.0.1
2025-04-28 15:14:02 +03:00

35 lines
1.1 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package graph
import (
"context"
"tailly_back_v2/internal/domain"
)
// userResolver реализует методы для работы с пользователями
type userResolver struct{ *Resolver }
// Query.user - получение пользователя по ID
func (r *queryResolver) User(ctx context.Context, id string) (*domain.User, error) {
return r.services.User.GetByID(ctx, id)
}
// CreatedAt is the resolver for the createdAt field.
func (r *userResolver) CreatedAt(ctx context.Context, obj *domain.User) (string, error) {
panic("not implemented")
}
// UpdatedAt is the resolver for the updatedAt field.
func (r *userResolver) UpdatedAt(ctx context.Context, obj *domain.User) (string, error) {
panic("not implemented")
}
// Mutation.updateProfile - обновление профиля
func (r *mutationResolver) UpdateProfile(ctx context.Context, username string, email string) (*domain.User, error) {
userID, err := getUserIDFromContext(ctx)
if err != nil {
return nil, err
}
return r.services.User.UpdateProfile(ctx, userID, username, email)
}