package types import ( "context" "git.aiterp.net/rpdata/api/services" "time" "git.aiterp.net/rpdata/api/models" ) type chapterResolver struct { stories *services.StoryService } func (r *chapterResolver) FictionalDate(ctx context.Context, chapter *models.Chapter) (*time.Time, error) { if chapter.FictionalDate.IsZero() { return nil, nil } return &chapter.FictionalDate, nil } func (r *chapterResolver) Comments(ctx context.Context, chapter *models.Chapter, limit *int) ([]*models.Comment, error) { if limit == nil { limit = new(int) *limit = 0 } return r.stories.ListComments(ctx, *chapter, *limit) } // ChapterResolver is a resolver func ChapterResolver(s *services.Bundle) *chapterResolver { return &chapterResolver{stories: s.Stories} }