diff --git a/backend/app/api/handlers/v1/v1_ctrl_items.go b/backend/app/api/handlers/v1/v1_ctrl_items.go index f4d43d3..f6bc5ff 100644 --- a/backend/app/api/handlers/v1/v1_ctrl_items.go +++ b/backend/app/api/handlers/v1/v1_ctrl_items.go @@ -65,8 +65,8 @@ func (ctrl *V1Controller) HandleItemsCreate() server.HandlerFunc { return validate.NewRequestError(err, http.StatusInternalServerError) } - user := services.UseUserCtx(r.Context()) - item, err := ctrl.repo.Items.Create(r.Context(), user.GroupID, createData) + ctx := services.NewContext(r.Context()) + item, err := ctrl.svc.Items.Create(ctx, createData) if err != nil { log.Err(err).Msg("failed to create item") return validate.NewRequestError(err, http.StatusInternalServerError) diff --git a/backend/app/api/main.go b/backend/app/api/main.go index c62d5df..c505eea 100644 --- a/backend/app/api/main.go +++ b/backend/app/api/main.go @@ -112,7 +112,10 @@ func run(cfg *config.Config) error { app.db = c app.repos = repo.New(c, cfg.Storage.Data) - app.services = services.New(app.repos) + app.services = services.New( + app.repos, + services.WithAutoIncrementAssetID(cfg.Options.AutoIncrementAssetID), + ) // ========================================================================= // Start Server\ diff --git a/backend/app/api/routes.go b/backend/app/api/routes.go index beec706..cab1a14 100644 --- a/backend/app/api/routes.go +++ b/backend/app/api/routes.go @@ -51,7 +51,7 @@ func (a *app) mountRoutes(repos *repo.AllRepos) { a.services, a.repos, v1.WithMaxUploadSize(a.conf.Web.MaxUploadSize), - v1.WithRegistration(a.conf.AllowRegistration), + v1.WithRegistration(a.conf.Options.AllowRegistration), v1.WithDemoStatus(a.conf.Demo), // Disable Password Change in Demo Mode )