mercury/web/api/blog.go

27 lines
523 B
Go
Raw Permalink Normal View History

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"`
2023-09-15 16:33:08 +02:00
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,
2023-09-15 16:33:08 +02:00
Account: DBAccountToAccount(a),
}
}