feat: add service and model

This commit is contained in:
Jeffrey Duroyon
2020-05-10 23:58:49 +02:00
parent 4369438ff2
commit c8993f1ca3
20 changed files with 89 additions and 29 deletions

View File

@@ -2,22 +2,22 @@ package handlers
import "github.com/gin-gonic/gin"
func (hc *handlersContext) getAllCages(c *gin.Context){
func (hc *handlersContext) getAllCages(c *gin.Context) {
}
func (hc *handlersContext) getACage(c *gin.Context){
func (hc *handlersContext) getACage(c *gin.Context) {
}
func (hc *handlersContext) createACage(c *gin.Context){
func (hc *handlersContext) createACage(c *gin.Context) {
}
func (hc *handlersContext) updateACage(c *gin.Context){
func (hc *handlersContext) updateACage(c *gin.Context) {
}
func (hc *handlersContext) deleteACage(c *gin.Context){
func (hc *handlersContext) deleteACage(c *gin.Context) {
}

View File

@@ -2,26 +2,26 @@ package handlers
import "github.com/gin-gonic/gin"
func (hc *handlersContext) getAllGames(c *gin.Context){
func (hc *handlersContext) getAllGames(c *gin.Context) {
}
func (hc *handlersContext) getAGame(c *gin.Context){
func (hc *handlersContext) getAGame(c *gin.Context) {
}
func (hc *handlersContext) createAGame(c *gin.Context){
func (hc *handlersContext) createAGame(c *gin.Context) {
}
func (hc *handlersContext) updateAGame(c *gin.Context){
func (hc *handlersContext) updateAGame(c *gin.Context) {
}
func (hc *handlersContext) deleteAGame(c *gin.Context){
func (hc *handlersContext) deleteAGame(c *gin.Context) {
}
func (hc *handlersContext) getHamstersOfGame(c *gin.Context){
func (hc *handlersContext) getHamstersOfGame(c *gin.Context) {
}
}

View File

@@ -2,22 +2,22 @@ package handlers
import "github.com/gin-gonic/gin"
func (hc *handlersContext) getAllHamsters(c *gin.Context){
func (hc *handlersContext) getAllHamsters(c *gin.Context) {
}
func (hc *handlersContext) getAHamster(c *gin.Context){
func (hc *handlersContext) getAHamster(c *gin.Context) {
}
func (hc *handlersContext) createAHamster(c *gin.Context){
func (hc *handlersContext) createAHamster(c *gin.Context) {
}
func (hc *handlersContext) updateAHamster(c *gin.Context){
func (hc *handlersContext) updateAHamster(c *gin.Context) {
}
func (hc *handlersContext) deleteAHamster(c *gin.Context){
func (hc *handlersContext) deleteAHamster(c *gin.Context) {
}

View File

@@ -65,7 +65,7 @@ func NewRouter(config *Config) *gin.Engine {
userRoute.Handle("LOGIN", "", hc.connectUser)
userRoute.Handle(http.MethodPost, "", hc.createUser)
securedUserRoute := userRoute.Group("")
securedUserRoute := userRoute.Group("")
//TODO add secure auth
securedUserRoute.Handle(http.MethodGet, "", hc.getAllUsers)
securedUserRoute.Handle(http.MethodGet, "/:userId", hc.getUser)
@@ -77,19 +77,19 @@ func NewRouter(config *Config) *gin.Engine {
gameRoute.Handle(http.MethodGet, "", hc.getAllGames)
gameRoute.Handle(http.MethodGet, "/:gameId", hc.getAGame)
gameRoute.Handle(http.MethodPost, "/:gameId", hc.createAGame)
gameRoute.Handle(http.MethodPut, "/:gameId",hc.updateAGame)
gameRoute.Handle(http.MethodGet, "/:gameId/hamsters",hc.getHamstersOfGame)
gameRoute.Handle(http.MethodDelete, "/:gameId",hc.deleteAGame)
gameRoute.Handle(http.MethodPut, "/:gameId", hc.updateAGame)
gameRoute.Handle(http.MethodGet, "/:gameId/hamsters", hc.getHamstersOfGame)
gameRoute.Handle(http.MethodDelete, "/:gameId", hc.deleteAGame)
cageRoute := gameRoute.Group("/:gameId/cages")
cageRoute.Handle(http.MethodGet, "",hc.getAllCages)
cageRoute.Handle(http.MethodGet, "", hc.getAllCages)
cageRoute.Handle(http.MethodGet, "/:cageId", hc.getACage)
cageRoute.Handle(http.MethodPost, "/:cageId", hc.createACage)
cageRoute.Handle(http.MethodPut, "/:cageId", hc.updateACage)
cageRoute.Handle(http.MethodDelete, "/:cageId",hc.deleteACage)
cageRoute.Handle(http.MethodDelete, "/:cageId", hc.deleteACage)
hamsterRoute := cageRoute.Group("/:cageId/hamsters")
hamsterRoute.Handle(http.MethodGet, "",hc.getAllHamsters)
hamsterRoute.Handle(http.MethodGet, "", hc.getAllHamsters)
hamsterRoute.Handle(http.MethodGet, "/:hamsterId", hc.getAHamster)
hamsterRoute.Handle(http.MethodPost, "/:hamsterId", hc.createAHamster)
hamsterRoute.Handle(http.MethodPut, "/:hamsterId", hc.updateAHamster)