This commit is contained in:
konrad 2018-07-12 23:47:50 +02:00 committed by kolaente
parent bb44b2f98c
commit 376c649a12
Signed by untrusted user: konrad
GPG Key ID: F40E70337AB24C9B
12 changed files with 381 additions and 435 deletions

View File

@ -126,12 +126,14 @@ Teams sind global, d.h. Ein Team kann mehrere Namespaces verwalten.
* [ ] Mit Link
* [ ] Offen
* [ ] Passwortgeschützt
* [ ] Rechtemanagement (Und damit Unterscheidung zwischen Ownern und Mitgleidern)
Wenn man Listen mit nem Nutzer teilt, wird ein Team für diesen Nutzer erstellt, falls er nicht bereits in einem ist.
?? Wenn man Listen mit nem Nutzer teilt, wird ein Team für diesen Nutzer erstellt, falls er nicht bereits in einem ist.
#### v0.3
* [ ] Rechtemanagement (Und damit Unterscheidung zwischen Ownern und Mitgleidern)
* [ ] Labels
* [ ] Priorities
#### v0.4
@ -151,24 +153,25 @@ Wenn ein Objekt 5x hin und hergereicht wird, und jedesmal nur geringfügig was d
doch auch in einer Funktion machbar sein.
* [ ] ganz viel in eigene neue Dateien + Packages auslagern, am besten eine package pro model mit allen methoden etc.
* [ ] Alle alten dinger die nicht mehr gebraucht werden, weg.
* [ ] Die alten handlerfunktionen alle in eine datei packen und erstmal "lagern", erstmal brauchen wir die noch für swagger.
* [ ] CI aufsetzen
* [x] Die alten handlerfunktionen alle in eine datei packen und erstmal "lagern", erstmal brauchen wir die noch für swagger.
* [ ] Drone aufsetzen
* [ ] Tests schreiben
* [ ] Namen finden
* [ ] Alle Packages umziehen
* [x] Swagger UI aufsetzen
* [ ] Cacher konfigurierbar
* [ ] Überall echo.NewHTTPError statt c.JSON(Message{}) benutzen
* [ ] Deps nach dep umziehen
* [x] Überall echo.NewHTTPError statt c.JSON(Message{}) benutzen
* [ ] Bessere Fehlermeldungen wenn das Model was ankommt falsch ist und nicht geparst werden kann
* [ ] Fehlerhandling irgendwie besser machen. Zb mit "World error messages"? Sprich, die Methode ruft einfach auf obs die entsprechende Fehlermeldung gibt und zeigt sonst 500 an.
* [ ] Endpoints neu organisieren? Also zb `namespaces/:nID/lists/:lID/items/:iID` statt einzelnen Endpoints für alles
* [ ] "Apiformat" Methoden, damit in der Ausgabe zb kein Passwort drin ist..., oder created/updated von Nutzern... oder ownerID nicht drin ist sondern nur das ownerobject
* [ ] Rechte überprüfen:
* [ ] Listen erstellen
* [ ] Listen bearbeiten (nur eigene im Moment)
* [ ] Listenpunkte hinzufügen
* [ ] Listenpunkte bearbeiten
* [x] Rechte überprüfen:
* [x] Listen erstellen
* [x] Listen bearbeiten (nur eigene im Moment)
* [x] Listenpunkte hinzufügen
* [x] Listenpunkte bearbeiten
* [ ] An "accepted" für post/put payloads schrauben, man soll da zb keine id/created/updated/etc übergeben können.
* [ ] Globale Limits für anlegbare Listen + Namespaces

View File

@ -1,36 +0,0 @@
package v1
import (
"github.com/labstack/echo"
"net/http"
)
// DeleteListItemByIDtemByID is the web handler to delete a list item
func DeleteListItemByIDtemByID(c echo.Context) error {
// swagger:operation DELETE /item/{itemID} lists deleteListItem
// ---
// summary: Deletes a list item
// consumes:
// - application/json
// produces:
// - application/json
// parameters:
// - name: itemID
// in: path
// description: ID of the list item to delete
// type: string
// required: true
// responses:
// "200":
// "$ref": "#/responses/Message"
// "400":
// "$ref": "#/responses/Message"
// "403":
// "$ref": "#/responses/Message"
// "404":
// "$ref": "#/responses/Message"
// "500":
// "$ref": "#/responses/Message"
return echo.NewHTTPError(http.StatusNotImplemented)
}

View File

@ -1,39 +0,0 @@
package v1
import (
// "git.kolaente.de/konrad/list/models"
"github.com/labstack/echo"
// "net/http"
// "strconv"
"net/http"
)
// DeleteListByID ...
func DeleteListByID(c echo.Context) error {
// swagger:operation DELETE /lists/{listID} lists deleteList
// ---
// summary: Deletes a list with all items on it
// consumes:
// - application/json
// produces:
// - application/json
// parameters:
// - name: listID
// in: path
// description: ID of the list to delete
// type: string
// required: true
// responses:
// "200":
// "$ref": "#/responses/Message"
// "400":
// "$ref": "#/responses/Message"
// "403":
// "$ref": "#/responses/Message"
// "404":
// "$ref": "#/responses/Message"
// "500":
// "$ref": "#/responses/Message"
return echo.NewHTTPError(http.StatusNotImplemented)
}

View File

@ -1,66 +0,0 @@
package v1
import (
"github.com/labstack/echo"
"net/http"
)
// AddListItem ...
func AddListItem(c echo.Context) error {
// swagger:operation PUT /lists/{listID} lists addListItem
// ---
// summary: Adds an item to a list
// consumes:
// - application/json
// produces:
// - application/json
// parameters:
// - name: listID
// in: path
// description: ID of the list to use
// type: string
// required: true
// - name: body
// in: body
// schema:
// "$ref": "#/definitions/ListItem"
// responses:
// "200":
// "$ref": "#/responses/ListItem"
// "400":
// "$ref": "#/responses/Message"
// "500":
// "$ref": "#/responses/Message"
return echo.NewHTTPError(http.StatusNotImplemented)
}
// UpdateListItem ...
func UpdateListItem(c echo.Context) error {
// swagger:operation PUT /item/{itemID} lists updateListItem
// ---
// summary: Updates a list item
// consumes:
// - application/json
// produces:
// - application/json
// parameters:
// - name: itemID
// in: path
// description: ID of the item to update
// type: string
// required: true
// - name: body
// in: body
// schema:
// "$ref": "#/definitions/ListItem"
// responses:
// "200":
// "$ref": "#/responses/ListItem"
// "400":
// "$ref": "#/responses/Message"
// "500":
// "$ref": "#/responses/Message"
return echo.NewHTTPError(http.StatusNotImplemented)
}

View File

@ -1,32 +0,0 @@
package v1
import (
"github.com/labstack/echo"
"net/http"
)
// GetListByID Adds or updates a new list
func GetListByID(c echo.Context) error {
// swagger:operation GET /lists/{listID} lists getList
// ---
// summary: gets one list with all todo items
// consumes:
// - application/json
// produces:
// - application/json
// parameters:
// - name: listID
// in: path
// description: ID of the list to show
// type: string
// required: true
// responses:
// "200":
// "$ref": "#/responses/List"
// "400":
// "$ref": "#/responses/Message"
// "500":
// "$ref": "#/responses/Message"
return echo.NewHTTPError(http.StatusNotImplemented)
}

View File

@ -1,71 +0,0 @@
package v1
import (
"github.com/labstack/echo"
"net/http"
)
// AddList ...
func AddList(c echo.Context) error {
// swagger:operation PUT /namespaces/{namespaceID}/lists lists addList
// ---
// summary: Creates a new list owned by the currently logged in user in that namespace
// consumes:
// - application/json
// produces:
// - application/json
// parameters:
// - name: namespaceID
// in: path
// description: ID of the namespace that list should belong to
// type: string
// required: true
// - name: body
// in: body
// required: true
// schema:
// "$ref": "#/definitions/List"
// responses:
// "200":
// "$ref": "#/responses/List"
// "400":
// "$ref": "#/responses/Message"
// "403":
// "$ref": "#/responses/Message"
// "500":
// "$ref": "#/responses/Message"
return echo.NewHTTPError(http.StatusNotImplemented)
}
// UpdateList ...
func UpdateList(c echo.Context) error {
// swagger:operation POST /lists/{listID} lists upadteList
// ---
// summary: Updates a list
// consumes:
// - application/json
// produces:
// - application/json
// parameters:
// - name: listID
// in: path
// description: ID of the list to update
// type: string
// required: true
// - name: body
// in: body
// schema:
// "$ref": "#/definitions/List"
// responses:
// "200":
// "$ref": "#/responses/List"
// "400":
// "$ref": "#/responses/Message"
// "403":
// "$ref": "#/responses/Message"
// "500":
// "$ref": "#/responses/Message"
return echo.NewHTTPError(http.StatusNotImplemented)
}

View File

@ -1,24 +0,0 @@
package v1
import (
"github.com/labstack/echo"
"net/http"
)
// GetListsByUser gets all lists a user owns
func GetListsByUser(c echo.Context) error {
// swagger:operation GET /lists lists getLists
// ---
// summary: Gets all lists owned by the current user
// consumes:
// - application/json
// produces:
// - application/json
// responses:
// "200":
// "$ref": "#/responses/List"
// "500":
// "$ref": "#/responses/Message"
return c.JSON(http.StatusOK, nil)
}

View File

@ -1,65 +0,0 @@
package v1
import (
"github.com/labstack/echo"
"net/http"
)
// AddNamespace ...
func AddNamespace(c echo.Context) error {
// swagger:operation PUT /namespaces namespaces addNamespace
// ---
// summary: Creates a new namespace owned by the currently logged in user
// consumes:
// - application/json
// produces:
// - application/json
// parameters:
// - name: body
// in: body
// schema:
// "$ref": "#/definitions/Namespace"
// responses:
// "200":
// "$ref": "#/responses/Namespace"
// "400":
// "$ref": "#/responses/Message"
// "403":
// "$ref": "#/responses/Message"
// "500":
// "$ref": "#/responses/Message"
return echo.NewHTTPError(http.StatusNotImplemented)
}
// UpdateNamespace ...
func UpdateNamespace(c echo.Context) error {
// swagger:operation POST /namespaces/{namespaceID} namespaces upadteNamespace
// ---
// summary: Updates a namespace
// consumes:
// - application/json
// produces:
// - application/json
// parameters:
// - name: namespaceID
// in: path
// description: ID of the namespace to update
// type: string
// required: true
// - name: body
// in: body
// schema:
// "$ref": "#/definitions/Namespace"
// responses:
// "200":
// "$ref": "#/responses/Namespace"
// "400":
// "$ref": "#/responses/Message"
// "403":
// "$ref": "#/responses/Message"
// "500":
// "$ref": "#/responses/Message"
return echo.NewHTTPError(http.StatusNotImplemented)
}

View File

@ -1,36 +0,0 @@
package v1
import (
"github.com/labstack/echo"
"net/http"
)
// DeleteNamespaceByID ...
func DeleteNamespaceByID(c echo.Context) error {
// swagger:operation DELETE /namespaces/{namespaceID} namespaces deleteNamespace
// ---
// summary: Deletes a namespace with all lists
// consumes:
// - application/json
// produces:
// - application/json
// parameters:
// - name: namespaceID
// in: path
// description: ID of the namespace to delete
// type: string
// required: true
// responses:
// "200":
// "$ref": "#/responses/Message"
// "400":
// "$ref": "#/responses/Message"
// "403":
// "$ref": "#/responses/Message"
// "404":
// "$ref": "#/responses/Message"
// "500":
// "$ref": "#/responses/Message"
return echo.NewHTTPError(http.StatusNotImplemented)
}

View File

@ -1,32 +0,0 @@
package v1
import (
"github.com/labstack/echo"
"net/http"
)
// ShowNamespace ...
func ShowNamespace(c echo.Context) error {
// swagger:operation GET /namespaces/{namespaceID} namespaces getNamespace
// ---
// summary: gets one namespace with all todo items
// consumes:
// - application/json
// produces:
// - application/json
// parameters:
// - name: namespaceID
// in: path
// description: ID of the namespace to show
// type: string
// required: true
// responses:
// "200":
// "$ref": "#/responses/Namespace"
// "400":
// "$ref": "#/responses/Message"
// "500":
// "$ref": "#/responses/Message"
return echo.NewHTTPError(http.StatusNotImplemented)
}

View File

@ -1,24 +0,0 @@
package v1
import (
"github.com/labstack/echo"
"net/http"
)
// GetAllNamespacesByCurrentUser ...
func GetAllNamespacesByCurrentUser(c echo.Context) error {
// swagger:operation GET /namespaces namespaces getNamespaces
// ---
// summary: Get all namespaces the currently logged in user has at least read access
// consumes:
// - application/json
// produces:
// - application/json
// responses:
// "200":
// "$ref": "#/responses/Namespace"
// "500":
// "$ref": "#/responses/Message"
return echo.NewHTTPError(http.StatusNotImplemented)
}

View File

@ -0,0 +1,368 @@
package v1
import (
"github.com/labstack/echo"
"net/http"
)
// DeleteListItemByIDtemByID is the web handler to delete a list item
func DeleteListItemByIDtemByID(c echo.Context) error {
// swagger:operation DELETE /item/{itemID} lists deleteListItem
// ---
// summary: Deletes a list item
// consumes:
// - application/json
// produces:
// - application/json
// parameters:
// - name: itemID
// in: path
// description: ID of the list item to delete
// type: string
// required: true
// responses:
// "200":
// "$ref": "#/responses/Message"
// "400":
// "$ref": "#/responses/Message"
// "403":
// "$ref": "#/responses/Message"
// "404":
// "$ref": "#/responses/Message"
// "500":
// "$ref": "#/responses/Message"
return echo.NewHTTPError(http.StatusNotImplemented)
}
// DeleteListByID ...
func DeleteListByID(c echo.Context) error {
// swagger:operation DELETE /lists/{listID} lists deleteList
// ---
// summary: Deletes a list with all items on it
// consumes:
// - application/json
// produces:
// - application/json
// parameters:
// - name: listID
// in: path
// description: ID of the list to delete
// type: string
// required: true
// responses:
// "200":
// "$ref": "#/responses/Message"
// "400":
// "$ref": "#/responses/Message"
// "403":
// "$ref": "#/responses/Message"
// "404":
// "$ref": "#/responses/Message"
// "500":
// "$ref": "#/responses/Message"
return echo.NewHTTPError(http.StatusNotImplemented)
}
// AddListItem ...
func AddListItem(c echo.Context) error {
// swagger:operation PUT /lists/{listID} lists addListItem
// ---
// summary: Adds an item to a list
// consumes:
// - application/json
// produces:
// - application/json
// parameters:
// - name: listID
// in: path
// description: ID of the list to use
// type: string
// required: true
// - name: body
// in: body
// schema:
// "$ref": "#/definitions/ListItem"
// responses:
// "200":
// "$ref": "#/responses/ListItem"
// "400":
// "$ref": "#/responses/Message"
// "500":
// "$ref": "#/responses/Message"
return echo.NewHTTPError(http.StatusNotImplemented)
}
// UpdateListItem ...
func UpdateListItem(c echo.Context) error {
// swagger:operation PUT /item/{itemID} lists updateListItem
// ---
// summary: Updates a list item
// consumes:
// - application/json
// produces:
// - application/json
// parameters:
// - name: itemID
// in: path
// description: ID of the item to update
// type: string
// required: true
// - name: body
// in: body
// schema:
// "$ref": "#/definitions/ListItem"
// responses:
// "200":
// "$ref": "#/responses/ListItem"
// "400":
// "$ref": "#/responses/Message"
// "500":
// "$ref": "#/responses/Message"
return echo.NewHTTPError(http.StatusNotImplemented)
}
// GetListByID Adds or updates a new list
func GetListByID(c echo.Context) error {
// swagger:operation GET /lists/{listID} lists getList
// ---
// summary: gets one list with all todo items
// consumes:
// - application/json
// produces:
// - application/json
// parameters:
// - name: listID
// in: path
// description: ID of the list to show
// type: string
// required: true
// responses:
// "200":
// "$ref": "#/responses/List"
// "400":
// "$ref": "#/responses/Message"
// "500":
// "$ref": "#/responses/Message"
return echo.NewHTTPError(http.StatusNotImplemented)
}
// AddList ...
func AddList(c echo.Context) error {
// swagger:operation PUT /namespaces/{namespaceID}/lists lists addList
// ---
// summary: Creates a new list owned by the currently logged in user in that namespace
// consumes:
// - application/json
// produces:
// - application/json
// parameters:
// - name: namespaceID
// in: path
// description: ID of the namespace that list should belong to
// type: string
// required: true
// - name: body
// in: body
// required: true
// schema:
// "$ref": "#/definitions/List"
// responses:
// "200":
// "$ref": "#/responses/List"
// "400":
// "$ref": "#/responses/Message"
// "403":
// "$ref": "#/responses/Message"
// "500":
// "$ref": "#/responses/Message"
return echo.NewHTTPError(http.StatusNotImplemented)
}
// UpdateList ...
func UpdateList(c echo.Context) error {
// swagger:operation POST /lists/{listID} lists upadteList
// ---
// summary: Updates a list
// consumes:
// - application/json
// produces:
// - application/json
// parameters:
// - name: listID
// in: path
// description: ID of the list to update
// type: string
// required: true
// - name: body
// in: body
// schema:
// "$ref": "#/definitions/List"
// responses:
// "200":
// "$ref": "#/responses/List"
// "400":
// "$ref": "#/responses/Message"
// "403":
// "$ref": "#/responses/Message"
// "500":
// "$ref": "#/responses/Message"
return echo.NewHTTPError(http.StatusNotImplemented)
}
// GetListsByUser gets all lists a user owns
func GetListsByUser(c echo.Context) error {
// swagger:operation GET /lists lists getLists
// ---
// summary: Gets all lists owned by the current user
// consumes:
// - application/json
// produces:
// - application/json
// responses:
// "200":
// "$ref": "#/responses/List"
// "500":
// "$ref": "#/responses/Message"
return echo.NewHTTPError(http.StatusNotImplemented)
}
// AddNamespace ...
func AddNamespace(c echo.Context) error {
// swagger:operation PUT /namespaces namespaces addNamespace
// ---
// summary: Creates a new namespace owned by the currently logged in user
// consumes:
// - application/json
// produces:
// - application/json
// parameters:
// - name: body
// in: body
// schema:
// "$ref": "#/definitions/Namespace"
// responses:
// "200":
// "$ref": "#/responses/Namespace"
// "400":
// "$ref": "#/responses/Message"
// "403":
// "$ref": "#/responses/Message"
// "500":
// "$ref": "#/responses/Message"
return echo.NewHTTPError(http.StatusNotImplemented)
}
// UpdateNamespace ...
func UpdateNamespace(c echo.Context) error {
// swagger:operation POST /namespaces/{namespaceID} namespaces upadteNamespace
// ---
// summary: Updates a namespace
// consumes:
// - application/json
// produces:
// - application/json
// parameters:
// - name: namespaceID
// in: path
// description: ID of the namespace to update
// type: string
// required: true
// - name: body
// in: body
// schema:
// "$ref": "#/definitions/Namespace"
// responses:
// "200":
// "$ref": "#/responses/Namespace"
// "400":
// "$ref": "#/responses/Message"
// "403":
// "$ref": "#/responses/Message"
// "500":
// "$ref": "#/responses/Message"
return echo.NewHTTPError(http.StatusNotImplemented)
}
// DeleteNamespaceByID ...
func DeleteNamespaceByID(c echo.Context) error {
// swagger:operation DELETE /namespaces/{namespaceID} namespaces deleteNamespace
// ---
// summary: Deletes a namespace with all lists
// consumes:
// - application/json
// produces:
// - application/json
// parameters:
// - name: namespaceID
// in: path
// description: ID of the namespace to delete
// type: string
// required: true
// responses:
// "200":
// "$ref": "#/responses/Message"
// "400":
// "$ref": "#/responses/Message"
// "403":
// "$ref": "#/responses/Message"
// "404":
// "$ref": "#/responses/Message"
// "500":
// "$ref": "#/responses/Message"
return echo.NewHTTPError(http.StatusNotImplemented)
}
// ShowNamespace ...
func ShowNamespace(c echo.Context) error {
// swagger:operation GET /namespaces/{namespaceID} namespaces getNamespace
// ---
// summary: gets one namespace with all todo items
// consumes:
// - application/json
// produces:
// - application/json
// parameters:
// - name: namespaceID
// in: path
// description: ID of the namespace to show
// type: string
// required: true
// responses:
// "200":
// "$ref": "#/responses/Namespace"
// "400":
// "$ref": "#/responses/Message"
// "500":
// "$ref": "#/responses/Message"
return echo.NewHTTPError(http.StatusNotImplemented)
}
// GetAllNamespacesByCurrentUser ...
func GetAllNamespacesByCurrentUser(c echo.Context) error {
// swagger:operation GET /namespaces namespaces getNamespaces
// ---
// summary: Get all namespaces the currently logged in user has at least read access
// consumes:
// - application/json
// produces:
// - application/json
// responses:
// "200":
// "$ref": "#/responses/Namespace"
// "500":
// "$ref": "#/responses/Message"
return echo.NewHTTPError(http.StatusNotImplemented)
}