2023-09-06 02:23:06 +02:00
|
|
|
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"`
|
2023-09-06 02:23:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
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),
|
2023-09-06 02:23:06 +02:00
|
|
|
}
|
|
|
|
}
|