mirror of
https://github.com/hay-kot/homebox.git
synced 2024-11-25 01:55:43 +00:00
update API endpoints
This commit is contained in:
parent
de670a00ed
commit
f2d06c21e8
3 changed files with 7 additions and 4 deletions
|
@ -65,8 +65,8 @@ func (ctrl *V1Controller) HandleItemsCreate() server.HandlerFunc {
|
||||||
return validate.NewRequestError(err, http.StatusInternalServerError)
|
return validate.NewRequestError(err, http.StatusInternalServerError)
|
||||||
}
|
}
|
||||||
|
|
||||||
user := services.UseUserCtx(r.Context())
|
ctx := services.NewContext(r.Context())
|
||||||
item, err := ctrl.repo.Items.Create(r.Context(), user.GroupID, createData)
|
item, err := ctrl.svc.Items.Create(ctx, createData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Err(err).Msg("failed to create item")
|
log.Err(err).Msg("failed to create item")
|
||||||
return validate.NewRequestError(err, http.StatusInternalServerError)
|
return validate.NewRequestError(err, http.StatusInternalServerError)
|
||||||
|
|
|
@ -112,7 +112,10 @@ func run(cfg *config.Config) error {
|
||||||
|
|
||||||
app.db = c
|
app.db = c
|
||||||
app.repos = repo.New(c, cfg.Storage.Data)
|
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\
|
// Start Server\
|
||||||
|
|
|
@ -51,7 +51,7 @@ func (a *app) mountRoutes(repos *repo.AllRepos) {
|
||||||
a.services,
|
a.services,
|
||||||
a.repos,
|
a.repos,
|
||||||
v1.WithMaxUploadSize(a.conf.Web.MaxUploadSize),
|
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
|
v1.WithDemoStatus(a.conf.Demo), // Disable Password Change in Demo Mode
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue