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

25 lines
838 B
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"
)
// LikeResolver реализует методы для работы с лайками в GraphQL
type likeResolver struct{ *Resolver }
// User возвращает пользователя, который поставил лайк
func (r *likeResolver) User(ctx context.Context, obj *domain.Like) (*domain.User, error) {
return r.services.User.GetByID(ctx, obj.UserID)
}
// Post возвращает пост, который был лайкнут
func (r *likeResolver) Post(ctx context.Context, obj *domain.Like) (*domain.Post, error) {
return r.services.Post.GetByID(ctx, obj.PostID)
}
// CreatedAt is the resolver for the createdAt field.
func (r *likeResolver) CreatedAt(ctx context.Context, obj *domain.Like) (string, error) {
panic("not implemented")
}