feat: post list and edition redirect

This commit is contained in:
Florian Sylvain
2024-05-17 16:38:41 +02:00
parent 24eefb743b
commit 900ad3e8b8
2062 changed files with 7238 additions and 24 deletions
@@ -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,