Begin to impl list order, should have prereq
parent
c756c005ac
commit
0f49595f0b
17
feed/feed.go
17
feed/feed.go
|
|
@ -1,17 +0,0 @@
|
||||||
package feed
|
|
||||||
|
|
||||||
import (
|
|
||||||
"errors"
|
|
||||||
"local/storage"
|
|
||||||
"net/url"
|
|
||||||
)
|
|
||||||
|
|
||||||
type Feed struct{}
|
|
||||||
|
|
||||||
func New(db storage.DB, values url.Values) (*Feed, error) {
|
|
||||||
return nil, errors.New("not impl")
|
|
||||||
}
|
|
||||||
|
|
||||||
func (f *Feed) Read(p []byte) (int, error) {
|
|
||||||
return 0, errors.New("not impl")
|
|
||||||
}
|
|
||||||
|
|
@ -9,6 +9,7 @@ import (
|
||||||
|
|
||||||
type Ajax struct {
|
type Ajax struct {
|
||||||
DB storage.DB
|
DB storage.DB
|
||||||
|
ListCnt int
|
||||||
}
|
}
|
||||||
|
|
||||||
func New() (*Ajax, error) {
|
func New() (*Ajax, error) {
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ func (a *Ajax) loadLists(w http.ResponseWriter, r *http.Request) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
a.ListCnt = len(lists)
|
||||||
return json.NewEncoder(w).Encode(map[string]interface{}{
|
return json.NewEncoder(w).Encode(map[string]interface{}{
|
||||||
"total": len(lists),
|
"total": len(lists),
|
||||||
"list": lists,
|
"list": lists,
|
||||||
|
|
@ -26,6 +27,8 @@ func (a *Ajax) addList(w http.ResponseWriter, r *http.Request) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
a.ListCnt += 1
|
||||||
|
newList.Index = a.ListCnt
|
||||||
if err := a.storageSetList(newList); err != nil {
|
if err := a.storageSetList(newList); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
@ -70,7 +73,7 @@ func (a *Ajax) publishList(w http.ResponseWriter, r *http.Request) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *Ajax) changeListOrder(w http.ResponseWriter, r *http.Request) error {
|
func (a *Ajax) changeListOrder(w http.ResponseWriter, r *http.Request) error {
|
||||||
return errors.New("not impl")
|
return errors.New("TODO not impl")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *Ajax) clearCompletedInList(w http.ResponseWriter, r *http.Request) error {
|
func (a *Ajax) clearCompletedInList(w http.ResponseWriter, r *http.Request) error {
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ type List struct {
|
||||||
ShowNotes int `json:"showNotes"`
|
ShowNotes int `json:"showNotes"`
|
||||||
Hidden int `json:"hidden"`
|
Hidden int `json:"hidden"`
|
||||||
Max int `json:"max"`
|
Max int `json:"max"`
|
||||||
|
Index int `json:"index"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func New(r *http.Request) (*List, error) {
|
func New(r *http.Request) (*List, error) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue