Merge remote-tracking branch 'origin/master'

This commit is contained in:
M_Kececi
2026-06-19 15:44:12 +03:00
parent da9d7c2fd5
commit 1054a15547
13 changed files with 828 additions and 62 deletions

View File

@@ -184,6 +184,12 @@ func handleUserGet(db *sql.DB, w http.ResponseWriter, userID int64) {
}
}
if groups, err := loadOrderPriceListUserPriceGroups(db, userID); err == nil {
u.OrderPriceListPriceGroups = groups
} else {
log.Printf("WARN [UserDetail] order price list price groups lookup failed user_id=%d err=%v", userID, err)
}
// --------------------------------------------------
// 🟢 RESPONSE
// --------------------------------------------------
@@ -326,6 +332,17 @@ func handleUserUpdate(db *sql.DB, w http.ResponseWriter, r *http.Request, userID
}
}
if err := ensureOrderPriceListUserPriceGroupSchema(db); err != nil {
log.Printf("ERROR [UserDetail] price group schema failed user_id=%d err=%v", userID, err)
http.Error(w, "Fiyat grubu tablosu hazirlanamadi", http.StatusInternalServerError)
return
}
if err := saveOrderPriceListUserPriceGroupsTx(tx, userID, payload.OrderPriceListPriceGroups); err != nil {
log.Printf("ERROR [UserDetail] price groups save failed user_id=%d err=%v", userID, err)
http.Error(w, "Fiyat gruplari guncellenemedi", http.StatusInternalServerError)
return
}
if err := tx.Commit(); err != nil {
log.Printf("❌ [UserDetail] commit failed user_id=%d err=%v", userID, err)
http.Error(w, "Commit başarısız", http.StatusInternalServerError)
@@ -384,6 +401,7 @@ func handleUserDelete(db *sql.DB, w http.ResponseWriter, r *http.Request, userID
`DELETE FROM dfusr_dprt WHERE dfusr_id = $1`,
`DELETE FROM dfusr_piyasa WHERE dfusr_id = $1`,
`DELETE FROM dfusr_nebim_user WHERE dfusr_id = $1`,
`DELETE FROM mk_order_price_list_user_price_group WHERE user_id = $1`,
}
isUndefinedTable := func(err error) bool {