(ctx *fiber.Ctx)
| 22 | } |
| 23 | |
| 24 | func (c *authKeyController) CreateAuthKey(ctx *fiber.Ctx) error { |
| 25 | authKey := types.CreateAuthKeyRequest{} |
| 26 | validationErrors := utils.BindAndValidate(ctx, &authKey) |
| 27 | if len(validationErrors) > 0 { |
| 28 | return utils.ValidationErrorResponse(ctx, validationErrors) |
| 29 | } |
| 30 | user := ctx.Locals("user").(*model.User) |
| 31 | createdBy := user.Username |
| 32 | createdAuthKey, err := c.authKeyService.CreateAuthKey(authKey.Name, createdBy) |
| 33 | if err != nil { |
| 34 | return utils.ErrorResponse(ctx, err.Error()) |
| 35 | } |
| 36 | return utils.SuccessResponse(ctx, createdAuthKey) |
| 37 | } |
| 38 | |
| 39 | func (c *authKeyController) GetAllAuthKeys(ctx *fiber.Ctx) error { |
| 40 | authKeys, err := c.authKeyService.GetAllAuthKeys(ctx.Context()) |
nothing calls this directly
no test coverage detected