(c *fiber.Ctx)
| 26 | } |
| 27 | |
| 28 | func (controller *appControllerImpl) CreateApp(c *fiber.Ctx) error { |
| 29 | var appRequest types.CreateAppRequest |
| 30 | validationErrors := utils.BindAndValidate(c, &appRequest) |
| 31 | if len(validationErrors) > 0 { |
| 32 | return utils.ValidationErrorResponse(c, validationErrors) |
| 33 | } |
| 34 | logger.L.Info("Creating app", zap.Any("appRequest", appRequest)) |
| 35 | app, err := controller.appService.CreateApp(context.Background(), appRequest.AppName, appRequest.OS) |
| 36 | if err != nil { |
| 37 | logger.L.Error("Error creating app", zap.Error(err)) |
| 38 | return utils.ErrorResponse(c, "Error creating app") |
| 39 | } |
| 40 | logger.L.Info("App created", zap.Any("app", app)) |
| 41 | return utils.SuccessResponse(c, fiber.Map{ |
| 42 | "name": app.Name, |
| 43 | "os": app.OS, |
| 44 | }) |
| 45 | } |
| 46 | |
| 47 | func (controller *appControllerImpl) GetApps(c *fiber.Ctx) error { |
| 48 | apps, err := controller.appService.GetApps(context.Background()) |
nothing calls this directly
no test coverage detected