You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
522 B
21 lines
522 B
package httpapi
|
|
|
|
import (
|
|
"git.aiterp.net/stufflog3/stufflog3/usecases/projects"
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
func Projects(g *gin.RouterGroup, projects *projects.Service) {
|
|
g.GET("", handler("projects", func(c *gin.Context) (interface{}, error) {
|
|
return projects.List(c.Request.Context())
|
|
}))
|
|
|
|
g.GET("/:project_id", handler("project", func(c *gin.Context) (interface{}, error) {
|
|
id, err := reqInt(c, "project_id")
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return projects.Find(c.Request.Context(), id)
|
|
}))
|
|
}
|