MCPcopy Create free account
hub / github.com/SwishHQ/spread / CreateApp

Method CreateApp

src/controller/app_controller.go:28–45  ·  view source on GitHub ↗
(c *fiber.Ctx)

Source from the content-addressed store, hash-verified

26}
27
28func (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
47func (controller *appControllerImpl) GetApps(c *fiber.Ctx) error {
48 apps, err := controller.appService.GetApps(context.Background())

Callers

nothing calls this directly

Calls 5

BindAndValidateFunction · 0.92
ValidationErrorResponseFunction · 0.92
ErrorResponseFunction · 0.92
SuccessResponseFunction · 0.92
CreateAppMethod · 0.65

Tested by

no test coverage detected