package graph import ( "context" "fmt" "tailly_back_v2/internal/domain" "time" ) type likeResolver struct{ *Resolver } // Like returns LikeResolver implementation. func (r *Resolver) Like() LikeResolver { return &likeResolver{r} } // Post is the resolver for the post field. func (r *likeResolver) Post(ctx context.Context, obj *domain.Like) (*domain.Post, error) { post, err := r.Services.Post.GetByID(ctx, obj.PostID) if err != nil { return nil, fmt.Errorf("failed to get post: %w", err) } return post, nil } // User is the resolver for the user field. func (r *likeResolver) User(ctx context.Context, obj *domain.Like) (*domain.User, error) { // This would typically use a UserService to fetch the user // For now, we'll return nil as the user service isn't shown in the provided code return nil, nil } // CreatedAt is the resolver for the createdAt field. func (r *likeResolver) CreatedAt(ctx context.Context, obj *domain.Like) (string, error) { return obj.CreatedAt.Format(time.RFC3339), nil }