Skip to content

Commit

Permalink
fix: publisher conflict message (#169)
Browse files Browse the repository at this point in the history
Remove `email` from the conflict message as it's no longer a unique
field.
  • Loading branch information
bfabio authored Oct 11, 2022
1 parent ada1cf8 commit ebc5993
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion internal/handlers/publishers.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ func (p *Publisher) PostPublisher(ctx *fiber.Ctx) error {
case common.ErrDBUniqueConstraint:
return common.Error(fiber.StatusConflict,
"can't create Publisher",
"Publisher with provided description, email, alternativeId or CodeHosting URL already exists")
"description, alternativeId or codeHosting URL already exists")
default:
return common.Error(fiber.StatusInternalServerError,
"can't create Publisher",
Expand Down
8 changes: 4 additions & 4 deletions main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ func TestPublishersEndpoints(t *testing.T) {
},
expectedCode: 409,
expectedContentType: "application/problem+json",
expectedBody: `{"title":"can't create Publisher","detail":"Publisher with provided description, email, alternativeId or CodeHosting URL already exists","status":409}`,
expectedBody: `{"title":"can't create Publisher","detail":"description, alternativeId or codeHosting URL already exists","status":409}`,
},
{
description: "POST publisher with empty alternativeId",
Expand Down Expand Up @@ -528,7 +528,7 @@ func TestPublishersEndpoints(t *testing.T) {
},
expectedCode: 409,
expectedContentType: "application/problem+json",
expectedBody: `{"title":"can't create Publisher","detail":"Publisher with provided description, email, alternativeId or CodeHosting URL already exists","status":409}`,
expectedBody: `{"title":"can't create Publisher","detail":"description, alternativeId or codeHosting URL already exists","status":409}`,
},
{
description: "POST new publisher with an existing email",
Expand Down Expand Up @@ -596,7 +596,7 @@ func TestPublishersEndpoints(t *testing.T) {
},
expectedCode: 409,
expectedContentType: "application/problem+json",
expectedBody: `{"title":"can't create Publisher","detail":"Publisher with provided description, email, alternativeId or CodeHosting URL already exists","status":409}`,
expectedBody: `{"title":"can't create Publisher","detail":"description, alternativeId or codeHosting URL already exists","status":409}`,
},
{
description: "POST new publisher with no description",
Expand Down Expand Up @@ -632,7 +632,7 @@ func TestPublishersEndpoints(t *testing.T) {
},
expectedCode: 409,
expectedContentType: "application/problem+json",
expectedBody: `{"title":"can't create Publisher","detail":"Publisher with provided description, email, alternativeId or CodeHosting URL already exists","status":409}`,
expectedBody: `{"title":"can't create Publisher","detail":"description, alternativeId or codeHosting URL already exists","status":409}`,
},
{
description: "POST publishers with invalid payload",
Expand Down

0 comments on commit ebc5993

Please sign in to comment.