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
18 lines
738 B
package loaders
|
|
|
|
import (
|
|
"context"
|
|
|
|
"git.aiterp.net/stufflog/server/database"
|
|
"git.aiterp.net/stufflog/server/models"
|
|
)
|
|
|
|
func ContextWithLoaders(ctx context.Context, user *models.User, database database.Database) context.Context {
|
|
ctx = context.WithValue(ctx, logsByIssueLoaderCtxKey, NewLogsByIssueLoader(ctx, database.Logs()))
|
|
ctx = context.WithValue(ctx, userLoaderCtxKey, NewUserLoader(ctx, database.Users()))
|
|
ctx = context.WithValue(ctx, projectPermissionCtxKey, NewProjectPermissionLoader(ctx, user, database.Projects()))
|
|
ctx = context.WithValue(ctx, issueLoaderCtxKey, NewIssueLoader(ctx, database.Issues()))
|
|
ctx = context.WithValue(ctx, activityLoaderCtxKey, NewActivityLoader(ctx, database.Activities()))
|
|
|
|
return ctx
|
|
}
|