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
42 lines
820 B
Go
42 lines
820 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 TemplatesMiddleware(c *gin.Context) {
|
|
c.AbortWithStatus(501)
|
|
}
|
|
|
|
func GetTemplates(c *gin.Context) {
|
|
project := c.MustGet("project").(models.Project)
|
|
var templates []models.Template
|
|
|
|
q := squirrel.Select("*").
|
|
From("project__template").
|
|
Where("project_id=?", project.ID)
|
|
|
|
query, args, _ := q.ToSql()
|
|
|
|
if _, err := database.Mysql.Select(&templates, query, args...); err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
c.JSON(200, templates)
|
|
}
|
|
|
|
func AddTemplate(c *gin.Context) {
|
|
c.AbortWithStatus(501)
|
|
}
|
|
|
|
func UpdateTemplate(c *gin.Context) {
|
|
c.AbortWithStatus(501)
|
|
}
|
|
|
|
func RemoveTemplate(c *gin.Context) {
|
|
c.AbortWithStatus(501)
|
|
}
|