feat: SEO backend data (1/4)

This commit is contained in:
Florian Sylvain committed 2026-10-15 19:30:29 +02:00
1 parent cb1410f0b0
commit 0eb46b0d74
90 files changed
+6094 -350

No files matched your search

+9 -7
View File
@@ -90,9 +90,11 @@ func intQueryParam(values url.Values, name string, fallback int) (int, error) {
}
type usageResponse struct {
ID uint32 `json:"id"`
Title string `json:"title"`
Published bool `json:"published"`
Type string `json:"type"`
ID uint32 `json:"id"`
Title string `json:"title"`
Published *bool `json:"published,omitempty"`
Fields []string `json:"fields"`
}
type mergeResponse struct {
@@ -324,15 +326,15 @@ func (h *Handler) Usage(w http.ResponseWriter, r *http.Request) {
return
}
articles, err := h.UsageUseCase.Usage(id)
usages, err := h.UsageUseCase.Usage(id)
if err != nil {
writeImageError(w, err)
return
}
response := make([]usageResponse, 0, len(articles))
for _, a := range articles {
response = append(response, usageResponse{ID: a.ID, Title: a.Title, Published: a.IsOnline})
response := make([]usageResponse, 0, len(usages))
for _, usage := range usages {
response = append(response, usageResponse{Type: usage.Type, ID: usage.ID, Title: usage.Title, Published: usage.Published, Fields: usage.Fields})
}
writeJSON(w, http.StatusOK, response)
}