From 9aac9e5bf79f566b470c3eaa012bbf823bf3d916 Mon Sep 17 00:00:00 2001 From: Thomas Boerger Date: Mon, 25 Jul 2016 17:20:14 +0200 Subject: [PATCH] Integrated team secrets dummy API --- router/router.go | 12 ++++++++++++ server/secret.go | 19 +++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/router/router.go b/router/router.go index 446b4d64..5d37b53a 100644 --- a/router/router.go +++ b/router/router.go @@ -62,6 +62,18 @@ func Load(middleware ...gin.HandlerFunc) http.Handler { users.DELETE("/:login", server.DeleteUser) } + teams := e.Group("/api/teams") + { + // TODO: Restrict access + + team := teams.Group("/:team") + { + team.GET("/secrets", server.GetTeamSecrets) + team.POST("/secrets", server.PostTeamSecret) + team.DELETE("/secrets/:secret", server.DeleteTeamSecret) + } + } + repos := e.Group("/api/repos/:owner/:name") { repos.POST("", server.PostRepo) diff --git a/server/secret.go b/server/secret.go index bc241dca..39e5bd35 100644 --- a/server/secret.go +++ b/server/secret.go @@ -28,6 +28,15 @@ func GetSecrets(c *gin.Context) { c.JSON(http.StatusOK, list) } +func GetTeamSecrets(c *gin.Context) { + var ( + list []*model.Secret + ) + + // TODO(must): Integrate a real implementation + c.JSON(http.StatusOK, list) +} + func PostSecret(c *gin.Context) { repo := session.Repo(c) @@ -49,6 +58,11 @@ func PostSecret(c *gin.Context) { c.String(http.StatusOK, "") } +func PostTeamSecret(c *gin.Context) { + c.String(http.StatusOK, "") + // TODO(must): Integrate a real implementation +} + func DeleteSecret(c *gin.Context) { repo := session.Repo(c) name := c.Param("secret") @@ -66,3 +80,8 @@ func DeleteSecret(c *gin.Context) { c.String(http.StatusOK, "") } + +func DeleteTeamSecret(c *gin.Context) { + c.String(http.StatusOK, "") + // TODO(must): Integrate a real implementation +}