Merge remote-tracking branch 'origin/master'

This commit is contained in:
M_Kececi
2026-03-03 10:16:05 +03:00
parent ecf3a8bd07
commit b208aa32e2
26 changed files with 2013 additions and 965 deletions

View File

@@ -0,0 +1,34 @@
package routes
import (
"bssapp-backend/auth"
"bssapp-backend/queries"
"encoding/json"
"net/http"
)
type agingCacheRefreshResponse struct {
OK bool `json:"ok"`
Message string `json:"message"`
}
// POST /api/finance/account-aging-statement/rebuild-cache
// Runs only step2 + step3.
func RebuildStatementAgingCacheHandler(w http.ResponseWriter, r *http.Request) {
claims, ok := auth.GetClaimsFromContext(r.Context())
if !ok || claims == nil {
http.Error(w, "unauthorized", http.StatusUnauthorized)
return
}
if err := queries.RebuildStatementAgingCache(r.Context()); err != nil {
http.Error(w, "cache rebuild error: "+err.Error(), http.StatusInternalServerError)
return
}
w.Header().Set("Content-Type", "application/json; charset=utf-8")
_ = json.NewEncoder(w).Encode(agingCacheRefreshResponse{
OK: true,
Message: "SP_BUILD_CARI_VADE_GUN_STAGING -> SP_BUILD_CARI_BAKIYE_CACHE çalıştırıldı.",
})
}