refac: article title rules are the same in the API request and the domain; an invalid title returns 400 instead of 500

This commit is contained in:
fsylvain committed 2026-09-23 20:04:09 +02:00
1 parent ff8cd5f0ec
commit 4278d96882
9 files changed
+456 -7

No files matched your search

+6 -4
View File
@@ -12,10 +12,11 @@ import (
)
type mockArticleRepo struct {
articles map[uint32]article.Article
images map[uint32]*imageDomain.Image
nextID uint32
fail failSwitch
articles map[uint32]article.Article
images map[uint32]*imageDomain.Image
nextID uint32
fail failSwitch
createCalled bool
}
func newMockArticleRepo() *mockArticleRepo {
@@ -82,6 +83,7 @@ func (m *mockArticleRepo) GetAll() []article.Article {
}
func (m *mockArticleRepo) Create(a article.Article) (article.Article, error) {
m.createCalled = true
if err := m.fail.trigger("Create"); err != nil {
return article.Article{}, err
}