2026-02-07 18:26:47 +00:00
|
|
|
package sync
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"github.com/Gleipnir-Technology/nidus-sync/db/models"
|
|
|
|
|
"github.com/Gleipnir-Technology/nidus-sync/html"
|
|
|
|
|
"net/http"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
type ContentPoolList struct {
|
|
|
|
|
URL ContentURL
|
|
|
|
|
User User
|
|
|
|
|
}
|
2026-02-07 20:02:39 +00:00
|
|
|
type ContentPoolUpload struct {
|
|
|
|
|
URL ContentURL
|
|
|
|
|
User User
|
|
|
|
|
}
|
2026-02-07 18:26:47 +00:00
|
|
|
|
|
|
|
|
func getPoolList(w http.ResponseWriter, r *http.Request, u *models.User) {
|
|
|
|
|
userContent, err := contentForUser(r.Context(), u)
|
|
|
|
|
if err != nil {
|
|
|
|
|
respondError(w, "Failed to get user", err, http.StatusInternalServerError)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
data := ContentPoolList{
|
|
|
|
|
URL: newContentURL(),
|
|
|
|
|
User: userContent,
|
|
|
|
|
}
|
|
|
|
|
html.RenderOrError(w, "sync/pool-list.html", data)
|
|
|
|
|
}
|
2026-02-07 20:02:39 +00:00
|
|
|
|
|
|
|
|
func getPoolUpload(w http.ResponseWriter, r *http.Request, u *models.User) {
|
|
|
|
|
userContent, err := contentForUser(r.Context(), u)
|
|
|
|
|
if err != nil {
|
|
|
|
|
respondError(w, "Failed to get user", err, http.StatusInternalServerError)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
data := ContentPoolUpload{
|
|
|
|
|
URL: newContentURL(),
|
|
|
|
|
User: userContent,
|
|
|
|
|
}
|
|
|
|
|
html.RenderOrError(w, "sync/pool-csv-upload.html", data)
|
|
|
|
|
}
|