1
Fork 0
photoview/api/graphql/resolvers/timeline.go

20 lines
544 B
Go
Raw Normal View History

2021-02-04 19:02:51 +01:00
package resolvers
import (
"context"
"time"
2021-02-07 17:13:27 +01:00
"github.com/photoview/photoview/api/graphql/auth"
2021-02-04 19:02:51 +01:00
"github.com/photoview/photoview/api/graphql/models"
2021-09-27 20:23:10 +02:00
"github.com/photoview/photoview/api/graphql/models/actions"
2021-02-04 19:02:51 +01:00
)
2021-09-18 20:17:24 +02:00
func (r *queryResolver) MyTimeline(ctx context.Context, paginate *models.Pagination, onlyFavorites *bool, fromDate *time.Time) ([]*models.Media, error) {
2021-02-07 17:13:27 +01:00
user := auth.UserFromContext(ctx)
if user == nil {
return nil, auth.ErrUnauthorized
}
2021-02-04 19:02:51 +01:00
2021-09-27 20:23:10 +02:00
return actions.MyTimeline(r.Database, user, paginate, onlyFavorites, fromDate)
2021-02-04 19:02:51 +01:00
}