feat: implement base template support
This commit is contained in:
@@ -14,6 +14,7 @@ type createTemplateRequestBody struct {
|
||||
Description string `json:"description"`
|
||||
Content string `json:"content"`
|
||||
Documentation string `json:"documentation"`
|
||||
BaseTemplate string `json:"baseTemplate"`
|
||||
}
|
||||
|
||||
type postTemplateRequestBody struct {
|
||||
@@ -33,6 +34,15 @@ func fetchAllTemplates(c echo.Context) error {
|
||||
return c.JSON(http.StatusOK, templates)
|
||||
}
|
||||
|
||||
func fetchBaseTemplates(c echo.Context) error {
|
||||
mgr := templateManagerFrom(c)
|
||||
templates, err := mgr.findBaseTemplates(c.Request().Context())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return c.JSON(http.StatusOK, templates)
|
||||
}
|
||||
|
||||
func fetchTemplate(c echo.Context) error {
|
||||
mgr := templateManagerFrom(c)
|
||||
template, err := mgr.findTemplate(c.Request().Context(), c.Param("templateName"))
|
||||
@@ -79,8 +89,9 @@ func createTemplate(c echo.Context) error {
|
||||
}
|
||||
|
||||
createdTemplate, err := mgr.createTemplate(c.Request().Context(), createTemplateOptions{
|
||||
name: name,
|
||||
description: body.Description,
|
||||
name: name,
|
||||
description: body.Description,
|
||||
baseTemplate: body.BaseTemplate,
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
|
Reference in New Issue
Block a user