moved to root - api/ dir flattened
This commit is contained in:
parent
d3ba23c436
commit
6b70e3d1c4
1 changed files with 0 additions and 68 deletions
|
|
@ -1,68 +0,0 @@
|
||||||
package main
|
|
||||||
|
|
||||||
import "time"
|
|
||||||
|
|
||||||
// Author — human or agent, single identity model.
|
|
||||||
type Author struct {
|
|
||||||
ID string `json:"id"`
|
|
||||||
Kind string `json:"kind"` // "human" | "agent" | "system"
|
|
||||||
DisplayName string `json:"display_name"`
|
|
||||||
AvatarURL string `json:"avatar_url,omitempty"`
|
|
||||||
CreatedAt time.Time `json:"created_at"`
|
|
||||||
UpdatedAt time.Time `json:"updated_at"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// Channel — lightweight, optional, many-to-many with posts.
|
|
||||||
type Channel struct {
|
|
||||||
Slug string `json:"slug"`
|
|
||||||
Name string `json:"name"`
|
|
||||||
Description string `json:"description"`
|
|
||||||
CreatedAt time.Time `json:"created_at"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// Post — the primitive. Always lives in 0..N channels.
|
|
||||||
type Post struct {
|
|
||||||
ID string `json:"id"`
|
|
||||||
AuthorID string `json:"author_id"`
|
|
||||||
Title string `json:"title"`
|
|
||||||
Body string `json:"body"`
|
|
||||||
BumpedAt time.Time `json:"bumped_at"`
|
|
||||||
CreatedAt time.Time `json:"created_at"`
|
|
||||||
UpdatedAt time.Time `json:"updated_at"`
|
|
||||||
IsDeleted bool `json:"is_deleted,omitempty"`
|
|
||||||
ParentPost string `json:"parent_post,omitempty"`
|
|
||||||
Channels []string `json:"channels,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// Comment — nested to arbitrary depth via path.
|
|
||||||
type Comment struct {
|
|
||||||
ID string `json:"id"`
|
|
||||||
PostID string `json:"post_id"`
|
|
||||||
ParentID string `json:"parent_id,omitempty"`
|
|
||||||
Path string `json:"path"`
|
|
||||||
Depth int `json:"depth"`
|
|
||||||
AuthorID string `json:"author_id"`
|
|
||||||
Body string `json:"body"`
|
|
||||||
CreatedAt time.Time `json:"created_at"`
|
|
||||||
UpdatedAt time.Time `json:"updated_at"`
|
|
||||||
IsDeleted bool `json:"is_deleted,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// PostWithComments — for /api/posts/:id (the unit of rendering).
|
|
||||||
type PostWithComments struct {
|
|
||||||
Post Post `json:"post"`
|
|
||||||
Comments []Comment `json:"comments"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// CreatePostRequest — input shape.
|
|
||||||
type CreatePostRequest struct {
|
|
||||||
Title string `json:"title"`
|
|
||||||
Body string `json:"body"`
|
|
||||||
Channels []string `json:"channels,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// CreateCommentRequest — input shape.
|
|
||||||
type CreateCommentRequest struct {
|
|
||||||
ParentID string `json:"parent_id,omitempty"`
|
|
||||||
Body string `json:"body"`
|
|
||||||
}
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue