mercury/web/api/post.go

26 lines
590 B
Go
Raw Normal View History

package api
import (
"git.sleepycat.moe/sam/mercury/internal/database"
"github.com/oklog/ulid/v2"
)
type Post struct {
ID ulid.ULID `json:"id"`
Content *string `json:"content"`
Source *string `json:"source"`
Visibility database.PostVisibility `json:"visibility"`
2023-09-15 16:33:08 +02:00
Blog Blog `json:"blog"`
}
2023-09-15 16:33:08 +02:00
func DBPostToPost(p database.Post, b database.Blog, a database.Account) Post {
return Post{
ID: p.ID,
Content: p.Content,
Source: p.Source,
Visibility: p.Visibility,
2023-09-15 16:33:08 +02:00
Blog: DBBlogToBlog(b, a),
}
}