feat: implement Havenllo single-board kanban (Go+SQLite backend, Preact/Vite frontend)
- Single fixed 'Haven' board: lists (To do/In progress/Done) + cards, no multi-board - Go 1.24 backend, CGO-free modernc.org/sqlite, embedded SPA, REST /api - Preact + Vite + TS frontend, native HTML5 drag-and-drop, optimistic UI, dark Haven theme - PVC (nfs-client) for SQLite, root container on NFS, simple nginx ingress havenllo.haven - Dockerfile multi-arch build, Gitea CI via pipeline-actions@main
This commit is contained in:
72
internal/api/types.go
Normal file
72
internal/api/types.go
Normal file
@@ -0,0 +1,72 @@
|
||||
package api
|
||||
|
||||
import "havenllo/internal/domain"
|
||||
|
||||
type createListRequest struct {
|
||||
Name string `json:"name"`
|
||||
Position *float64 `json:"position,omitempty"`
|
||||
}
|
||||
|
||||
type updateListRequest struct {
|
||||
Name *string `json:"name,omitempty"`
|
||||
Position *float64 `json:"position,omitempty"`
|
||||
}
|
||||
|
||||
type createCardRequest struct {
|
||||
Title string `json:"title"`
|
||||
Description string `json:"description"`
|
||||
Position *float64 `json:"position,omitempty"`
|
||||
}
|
||||
|
||||
type updateCardRequest struct {
|
||||
Title *string `json:"title,omitempty"`
|
||||
Description *string `json:"description,omitempty"`
|
||||
Done *bool `json:"done,omitempty"`
|
||||
ListID *int64 `json:"list_id,omitempty"`
|
||||
Position *float64 `json:"position,omitempty"`
|
||||
}
|
||||
|
||||
type errorResponse struct {
|
||||
Error apiError `json:"error"`
|
||||
}
|
||||
|
||||
type apiError struct {
|
||||
Code string `json:"code"`
|
||||
Message string `json:"message"`
|
||||
}
|
||||
|
||||
type listResponse struct {
|
||||
List domain.List `json:"list"`
|
||||
}
|
||||
|
||||
type listDetailsResponse struct {
|
||||
List domain.List `json:"list"`
|
||||
Cards []domain.Card `json:"cards"`
|
||||
}
|
||||
|
||||
type listSummary struct {
|
||||
ID int64 `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Position float64 `json:"position"`
|
||||
CardCount int `json:"card_count"`
|
||||
}
|
||||
|
||||
type listsResponse struct {
|
||||
Lists []listSummary `json:"lists"`
|
||||
}
|
||||
type cardResponse struct {
|
||||
Card domain.Card `json:"card"`
|
||||
}
|
||||
type cardsResponse struct {
|
||||
Cards []domain.Card `json:"cards"`
|
||||
}
|
||||
|
||||
func listSummaries(lists []domain.List) []listSummary {
|
||||
summaries := make([]listSummary, 0, len(lists))
|
||||
for _, list := range lists {
|
||||
summaries = append(summaries, listSummary{
|
||||
ID: list.ID, Name: list.Name, Position: list.Position, CardCount: list.CardCount,
|
||||
})
|
||||
}
|
||||
return summaries
|
||||
}
|
||||
Reference in New Issue
Block a user