diff --git a/.air.toml b/.air.toml index 67b1383..a770bbd 100644 --- a/.air.toml +++ b/.air.toml @@ -7,7 +7,7 @@ tmp_dir = "tmp" bin = "tmp\\main.exe" cmd = "go build -o ./tmp/main.exe ./main" delay = 1000 - exclude_dir = ["assets", "tmp", "vendor", "testdata"] + exclude_dir = ["assets", "tmp", "vendor", "testdata", "api\\static\\tinymce", "api\\static\\bootstrap-icons"] exclude_file = [] exclude_regex = ["_test.go"] exclude_unchanged = false diff --git a/adapters/secondary/gateways/postRepository.go b/adapters/secondary/gateways/postRepository.go index 533dbbb..02c575a 100644 --- a/adapters/secondary/gateways/postRepository.go +++ b/adapters/secondary/gateways/postRepository.go @@ -29,6 +29,18 @@ func (a *PostRepository) Get(id uint32) (domain.Post, error) { return mapPostToDomain(post), nil } +func (a *PostRepository) GetByName(name string) (domain.Post, error) { + var post entity.Post + err := a.db.Model(&entity.Post{ + Title: name, + }).First(&post).Error + if err != nil { + return domain.Post{}, err + } + + return mapPostToDomain(post), nil +} + func (a *PostRepository) Create(post domain.Post) (domain.Post, error) { creationResult := a.db.Create(&entity.Post{ Title: post.Title, diff --git a/adapters/secondary/gateways/web/templates/postCreate.html b/adapters/secondary/gateways/web/templates/postCreate.html index cbb213b..6e35512 100644 --- a/adapters/secondary/gateways/web/templates/postCreate.html +++ b/adapters/secondary/gateways/web/templates/postCreate.html @@ -3,7 +3,6 @@