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

26 lines
523 B
Go

package api
import (
"git.sleepycat.moe/sam/mercury/internal/database"
"github.com/oklog/ulid/v2"
)
// Blog is the basic blog returned by endpoints.
type Blog struct {
ID ulid.ULID `json:"id"`
Name string `json:"name"`
Domain *string `json:"domain"`
Bio string `json:"bio"`
Account Account `json:"account"`
}
func DBBlogToBlog(b database.Blog, a database.Account) Blog {
return Blog{
ID: b.ID,
Name: b.Name,
Domain: b.Domain,
Bio: b.Bio,
Account: DBAccountToAccount(a),
}
}