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.
45 lines
1.7 KiB
45 lines
1.7 KiB
package resolvers
|
|
|
|
// This file will be automatically regenerated based on the schema, any resolver implementations
|
|
// will be copied through when generating and any unknown code will be moved to the end.
|
|
|
|
import (
|
|
"context"
|
|
"git.aiterp.net/stufflog/server/graph/loaders"
|
|
|
|
"git.aiterp.net/stufflog/server/graph/graphcore"
|
|
"git.aiterp.net/stufflog/server/models"
|
|
)
|
|
|
|
func (r *logResolver) User(ctx context.Context, obj *models.Log) (*models.User, error) {
|
|
return r.Database.Users().Find(ctx, obj.UserID)
|
|
}
|
|
|
|
func (r *logItemResolver) Issue(ctx context.Context, obj *models.LogItem) (*models.Issue, error) {
|
|
return loaders.IssueLoaderFromContext(ctx).Load(obj.IssueID)
|
|
}
|
|
|
|
func (r *logItemResolver) Item(ctx context.Context, obj *models.LogItem) (*models.IssueItem, error) {
|
|
return r.Database.IssueItems().Find(ctx, obj.IssueItemID)
|
|
}
|
|
|
|
func (r *logTaskResolver) Issue(ctx context.Context, obj *models.LogTask) (*models.Issue, error) {
|
|
return loaders.IssueLoaderFromContext(ctx).Load(obj.IssueID)
|
|
}
|
|
|
|
func (r *logTaskResolver) Task(ctx context.Context, obj *models.LogTask) (*models.IssueTask, error) {
|
|
return r.Database.IssueTasks().Find(ctx, obj.IssueTaskID)
|
|
}
|
|
|
|
// Log returns graphcore.LogResolver implementation.
|
|
func (r *Resolver) Log() graphcore.LogResolver { return &logResolver{r} }
|
|
|
|
// LogItem returns graphcore.LogItemResolver implementation.
|
|
func (r *Resolver) LogItem() graphcore.LogItemResolver { return &logItemResolver{r} }
|
|
|
|
// LogTask returns graphcore.LogTaskResolver implementation.
|
|
func (r *Resolver) LogTask() graphcore.LogTaskResolver { return &logTaskResolver{r} }
|
|
|
|
type logResolver struct{ *Resolver }
|
|
type logItemResolver struct{ *Resolver }
|
|
type logTaskResolver struct{ *Resolver }
|