You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
562 B
27 lines
562 B
package types
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
|
|
"git.aiterp.net/rpdata/api/models/chapters"
|
|
|
|
"git.aiterp.net/rpdata/api/models"
|
|
)
|
|
|
|
type storyResolver struct{}
|
|
|
|
func (r *storyResolver) FictionalDate(ctx context.Context, story *models.Story) (*time.Time, error) {
|
|
if story.FictionalDate.IsZero() {
|
|
return nil, nil
|
|
}
|
|
|
|
return &story.FictionalDate, nil
|
|
}
|
|
|
|
func (r *storyResolver) Chapters(ctx context.Context, story *models.Story) ([]models.Chapter, error) {
|
|
return chapters.ListStoryID(story.ID)
|
|
}
|
|
|
|
// StoryResolver is a resolver
|
|
var StoryResolver storyResolver
|