stufflog graphql server
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.

18 lines
738 B

  1. package loaders
  2. import (
  3. "context"
  4. "git.aiterp.net/stufflog/server/database"
  5. "git.aiterp.net/stufflog/server/models"
  6. )
  7. func ContextWithLoaders(ctx context.Context, user *models.User, database database.Database) context.Context {
  8. ctx = context.WithValue(ctx, logsByIssueLoaderCtxKey, NewLogsByIssueLoader(ctx, database.Logs()))
  9. ctx = context.WithValue(ctx, userLoaderCtxKey, NewUserLoader(ctx, database.Users()))
  10. ctx = context.WithValue(ctx, projectPermissionCtxKey, NewProjectPermissionLoader(ctx, user, database.Projects()))
  11. ctx = context.WithValue(ctx, issueLoaderCtxKey, NewIssueLoader(ctx, database.Issues()))
  12. ctx = context.WithValue(ctx, activityLoaderCtxKey, NewActivityLoader(ctx, database.Activities()))
  13. return ctx
  14. }