feat: draft/online post field #26

This commit is contained in:
Florian Sylvain
2024-06-14 16:40:01 +02:00
parent 0759ab6d70
commit c69876a704
11 changed files with 111 additions and 13 deletions
+1
View File
@@ -10,6 +10,7 @@ type IPostRepository interface {
GetAll() []post.Post
Create(post post.Post) (post.Post, error)
UpdateBody(id uint32, body string) (post.Post, error)
UpdateIsOnline(id uint32, isOnline bool) (post.Post, error)
Delete(id uint32) error
AddImage(postId uint32, imageId uint32) error
}
+3
View File
@@ -11,6 +11,7 @@ type Post struct {
Title string `json:"title"`
Body string `json:"body"`
Images []*domain.Image `json:"images"`
IsOnline bool `json:"is_online"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
@@ -30,6 +31,7 @@ func FromDb(
title string,
body string,
images []*entity.Image,
isOnline bool,
createdAt time.Time,
updatedAt time.Time,
) Post {
@@ -49,6 +51,7 @@ func FromDb(
Title: title,
Body: body,
Images: domainImages,
IsOnline: isOnline,
CreatedAt: createdAt,
UpdatedAt: updatedAt,
}