mercury/web/api/post.go
2023-09-15 16:33:08 +02:00

25 lines
590 B
Go

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"`
Blog Blog `json:"blog"`
}
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,
Blog: DBBlogToBlog(b, a),
}
}