feat: add templates delete command (#1443)

This commit is contained in:
Colin Adler
2022-05-13 22:54:32 +00:00
committed by GitHub
parent 19335df0eb
commit fe7645b8a9
5 changed files with 185 additions and 0 deletions
+7
View File
@@ -45,6 +45,13 @@ func ExtractTemplateParam(db database.Store) func(http.Handler) http.Handler {
return
}
if template.Deleted {
httpapi.Write(rw, http.StatusNotFound, httpapi.Response{
Message: fmt.Sprintf("template %q does not exist", templateID),
})
return
}
ctx := context.WithValue(r.Context(), templateParamContextKey{}, template)
chi.RouteContext(ctx).URLParams.Add("organization", template.OrganizationID.String())
next.ServeHTTP(rw, r.WithContext(ctx))