graph2: Changed Comment to return null instead of a zero-date if it's cleared.
the build was successful
the build was successful
This commit is contained in:
@@ -3,6 +3,7 @@ package types
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"time"
|
||||
|
||||
"git.aiterp.net/rpdata/api/internal/loader"
|
||||
"git.aiterp.net/rpdata/api/models"
|
||||
@@ -28,5 +29,13 @@ func (r *commentResolver) Character(ctx context.Context, obj *models.Comment) (*
|
||||
return &character, nil
|
||||
}
|
||||
|
||||
func (r *commentResolver) FictionalDate(ctx context.Context, obj *models.Comment) (*time.Time, error) {
|
||||
if obj.FictionalDate.IsZero() {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
return &obj.FictionalDate, nil
|
||||
}
|
||||
|
||||
// CommentResolver is a resolver
|
||||
var CommentResolver commentResolver
|
||||
|
||||
Reference in New Issue
Block a user