30 lines
915 B
Go
30 lines
915 B
Go
package graph
|
|
|
|
import (
|
|
"context"
|
|
"tailly_back_v2/internal/domain"
|
|
)
|
|
|
|
// Comment is the resolver for the comment field.
|
|
type commentResolver struct{ *Resolver }
|
|
|
|
// Author is the resolver for the author field.
|
|
func (r *commentResolver) Author(ctx context.Context, obj *domain.Comment) (*domain.User, error) {
|
|
return r.services.User.GetByID(ctx, obj.AuthorID)
|
|
}
|
|
|
|
// Post is the resolver for the post field.
|
|
func (r *commentResolver) Post(ctx context.Context, obj *domain.Comment) (*domain.Post, error) {
|
|
return r.services.Post.GetByID(ctx, obj.PostID)
|
|
}
|
|
|
|
// CreatedAt is the resolver for the createdAt field.
|
|
func (r *commentResolver) CreatedAt(ctx context.Context, obj *domain.Comment) (string, error) {
|
|
panic("not implemented")
|
|
}
|
|
|
|
// UpdatedAt is the resolver for the updatedAt field.
|
|
func (r *commentResolver) UpdatedAt(ctx context.Context, obj *domain.Comment) (string, error) {
|
|
panic("not implemented")
|
|
}
|