mirror of
https://github.com/semaphoreui/semaphore.git
synced 2025-01-24 03:40:52 +01:00
2e1ad91e7a
- Link models with tables - Basic API to fetch everything
38 lines
753 B
Go
38 lines
753 B
Go
package projects
|
|
|
|
import (
|
|
"github.com/ansible-semaphore/semaphore/database"
|
|
"github.com/ansible-semaphore/semaphore/models"
|
|
"github.com/gin-gonic/gin"
|
|
"github.com/masterminds/squirrel"
|
|
)
|
|
|
|
func EnvironmentMiddleware(c *gin.Context) {
|
|
c.AbortWithStatus(501)
|
|
}
|
|
|
|
func GetEnvironment(c *gin.Context) {
|
|
project := c.MustGet("project").(models.Project)
|
|
var env []models.Environment
|
|
|
|
q := squirrel.Select("*").
|
|
From("project__environment").
|
|
Where("project_id=?", project.ID)
|
|
|
|
query, args, _ := q.ToSql()
|
|
|
|
if _, err := database.Mysql.Select(&env, query, args...); err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
c.JSON(200, env)
|
|
}
|
|
|
|
func AddEnvironment(c *gin.Context) {
|
|
c.AbortWithStatus(501)
|
|
}
|
|
|
|
func RemoveEnvironment(c *gin.Context) {
|
|
c.AbortWithStatus(501)
|
|
}
|