diff --git a/internal/app/app.go b/internal/app/app.go index f58a1be..6c2d621 100644 --- a/internal/app/app.go +++ b/internal/app/app.go @@ -101,7 +101,7 @@ func Run(config *models.Config, logger *zap.Logger) (appErr error) { apix := initialize.NewAPI(*controllers) _ = apix - api := swagger.NewAPI2(logger, mongoDB) + api := swagger.NewAPI2(logger, mongoDB, config) serverHTTP, httpErr := server.NewHTTP(server.DepsHTTP{ Logger: logger, diff --git a/internal/interface/controller/rest/account/account.go b/internal/interface/controller/rest/account/account.go index d3ae201..f484474 100644 --- a/internal/interface/controller/rest/account/account.go +++ b/internal/interface/controller/rest/account/account.go @@ -127,7 +127,6 @@ func (receiver *Controller) RemoveDirectAccount(ctx echo.Context, userID string) return ctx.JSON(http.StatusOK, account) } -// TODO delete func (receiver *Controller) SetVerificationStatus(ctx echo.Context, userID string) error { request, bindErr := echotools.Bind[models.SetAccountStatus](ctx) if bindErr != nil { @@ -144,7 +143,6 @@ func (receiver *Controller) SetVerificationStatus(ctx echo.Context, userID strin return ctx.JSON(http.StatusOK, account) } -// TODO delete func (receiver *Controller) UpdateAccountName(ctx echo.Context) error { userID, ok := ctx.Get(models.AuthJWTDecodedUserIDKey).(string) if !ok { diff --git a/internal/interface/swagger/api.2.go b/internal/interface/swagger/api.2.go index a5b2fa7..e5a5eba 100644 --- a/internal/interface/swagger/api.2.go +++ b/internal/interface/swagger/api.2.go @@ -184,8 +184,17 @@ func (api *API2) AddAccount(ctx echo.Context) error { } func (api *API2) DeleteDirectAccount(ctx echo.Context, userID string) error { - // return receiver.accountController.RemoveDirectAccount(ctx, userID) - return ctx.JSON(http.StatusBadRequest, models.ResponseErrorHTTP{Message: "TODO", StatusCode: 888}) + account, err := api.account.Remove(ctx.Request().Context(), userID) + if err != nil { + api.logger.Error("failed to remove account on of ", + zap.Error(err), + zap.String("userID", userID), + ) + return errors.HTTP(ctx, err) + + } + + return ctx.JSON(http.StatusOK, account) } func (api *API2) GetDirectAccount(ctx echo.Context, userID string) error {