Added some tests

This commit is contained in:
2021-06-23 22:30:45 +02:00
parent 24f897e907
commit 3d3d7fae48
3796 changed files with 218744 additions and 3 deletions

View File

@@ -29,9 +29,11 @@ type AuthInput struct {
// @Accept json
// @Produce json
// @Param body body AccountInput true "Account object to be written to database"
// @Success 200 {object} db.CreatedAccount
// @Success 201 {object} db.CreatedAccount
// @Failure 400 {object} []ResJSONError
// @Failure 401 {object} []ResJSONError
// @Failure 403 {object} []ResJSONError
// @Failure 409 {object} []ResJSONError
// @Failure 415 {object} []ResJSONError
// @Failure 500 {object} []ResJSONError
// @Router /account [post]
@@ -79,7 +81,7 @@ func (h Handlers) AccountCreate(c *fiber.Ctx) error {
if err != nil {
if strings.HasPrefix(err.Error(), "ERROR: duplicate key") {
return c.Status(409).JSON([]ResJSONError{{Error: "accountName is already taken"}})
return c.Status(409).JSON([]ResJSONError{{Error: "Name is already taken", Field: "name"}})
}
return c.Status(500).JSON([]ResJSONError{{Error: err.Error()}})
}