refactor: integra reconcile no boot, dedup categoria/pasta, CI, Go 1.24
ci / check (push) Successful in 4m12s

- Boot chama ReconcileBlobs com log de órfãos (era código morto)
- treeNode/validTreeName/siblingDup/moveCreatesCycle compartilhados
  entre Create/Update Category/Folder (mesma regra, um só lugar)
- mapStoreErrorFor com mensagens 404 por recurso (nota/arquivo/pasta/categoria)
- revisionHash helper + teste GET /revisions/{hash} (200 + 404)
- ReconcileBlobs com lock curto (coleta sob RLock, I/O fora do lock)
- AddFile com LimitReader no stream (cap antes de gravar, não depois)
- DeleteFile/DeleteFolder transacionais com rollback em memória
- attachmentKind único no frontend (syntax/html/preview)
- CI: gofmt, vet, test -race, node --check; go.mod 1.24 = Dockerfile
- README: notas operacionais (memória, proxy, boot, SSE, 413/400)
This commit is contained in:
lgcosta committed 2026-11-05 19:57:38 -03:00
1 parent 0e59ef23f4
commit e0bef77e31
16 files changed
+518 -126

No files matched your search

+7 -10
View File
@@ -31,7 +31,7 @@ func (s *Server) handleFileUpload(w http.ResponseWriter, r *http.Request) {
defer f.Close()
meta, err := s.st.AddFile(hdr.Filename, r.FormValue("folder_id"), r.FormValue("note_id"), f)
if err != nil {
mapStoreError(w, err)
mapStoreErrorFor(w, err, "arquivo")
return
}
writeJSON(w, http.StatusCreated, map[string]any{
@@ -51,13 +51,13 @@ func (s *Server) handleFileTree(w http.ResponseWriter, r *http.Request) {
func (s *Server) handleFileStatic(w http.ResponseWriter, r *http.Request) {
if err := s.st.ServeFile(w, r, r.PathValue("id")); err != nil {
mapStoreError(w, err)
mapStoreErrorFor(w, err, "arquivo")
}
}
func (s *Server) handleFileDelete(w http.ResponseWriter, r *http.Request) {
if err := s.st.DeleteFile(r.PathValue("id")); err != nil {
mapStoreError(w, err)
mapStoreErrorFor(w, err, "arquivo")
return
}
w.WriteHeader(http.StatusNoContent)
@@ -73,13 +73,12 @@ func (s *Server) handleFileMove(w http.ResponseWriter, r *http.Request) {
var in fileMoveInput
if r.ContentLength > 0 {
if err := decodeJSON(w, r, &in, 1<<20); err != nil {
writeError(w, http.StatusBadRequest, "corpo JSON inválido")
return
}
}
m, err := s.st.MoveFile(r.PathValue("id"), in.Name, in.Folder, in.Note)
if err != nil {
mapStoreError(w, err)
mapStoreErrorFor(w, err, "arquivo")
return
}
writeJSON(w, http.StatusOK, map[string]any{
@@ -97,7 +96,6 @@ type folderInput struct {
func (s *Server) handleFolderCreate(w http.ResponseWriter, r *http.Request) {
var in folderInput
if err := decodeJSON(w, r, &in, 1<<20); err != nil {
writeError(w, http.StatusBadRequest, "corpo JSON inválido")
return
}
parent := ""
@@ -106,7 +104,7 @@ func (s *Server) handleFolderCreate(w http.ResponseWriter, r *http.Request) {
}
f, err := s.st.CreateFolder(in.Name, parent)
if err != nil {
mapStoreError(w, err)
mapStoreErrorFor(w, err, "pasta")
return
}
writeJSON(w, http.StatusCreated, f)
@@ -115,12 +113,11 @@ func (s *Server) handleFolderCreate(w http.ResponseWriter, r *http.Request) {
func (s *Server) handleFolderUpdate(w http.ResponseWriter, r *http.Request) {
var in folderInput
if err := decodeJSON(w, r, &in, 1<<20); err != nil {
writeError(w, http.StatusBadRequest, "corpo JSON inválido")
return
}
f, err := s.st.UpdateFolder(r.PathValue("id"), in.Name, in.Parent)
if err != nil {
mapStoreError(w, err)
mapStoreErrorFor(w, err, "pasta")
return
}
writeJSON(w, http.StatusOK, f)
@@ -128,7 +125,7 @@ func (s *Server) handleFolderUpdate(w http.ResponseWriter, r *http.Request) {
func (s *Server) handleFolderDelete(w http.ResponseWriter, r *http.Request) {
if err := s.st.DeleteFolder(r.PathValue("id")); err != nil {
mapStoreError(w, err)
mapStoreErrorFor(w, err, "pasta")
return
}
w.WriteHeader(http.StatusNoContent)