product performance grouped kpi improvements
This commit is contained in:
@@ -28,7 +28,7 @@ func GetProductPerformanceHandler(pg *sql.DB) http.HandlerFunc {
|
||||
Bucket: strings.TrimSpace(r.URL.Query().Get("bucket")),
|
||||
SortBy: strings.TrimSpace(r.URL.Query().Get("sort_by")),
|
||||
Descending: boolQuery(r, "descending", true),
|
||||
Limit: intQuery(r, "limit", 100),
|
||||
Limit: intQuery(r, "limit", 50000),
|
||||
Page: intQuery(r, "page", 1),
|
||||
}
|
||||
rows, total, err := queries.ListProductPerformance(ctx, pg, f)
|
||||
@@ -109,7 +109,7 @@ func GetProductPerformanceGeneralHandler(pg *sql.DB) http.HandlerFunc {
|
||||
ctx, cancel := context.WithTimeout(utils.ContextWithTraceID(r.Context(), traceID), 60*time.Second)
|
||||
defer cancel()
|
||||
|
||||
rows, err := queries.ListProductPerformanceGeneral(ctx, pg, intQuery(r, "limit", 500))
|
||||
rows, err := queries.ListProductPerformanceGeneral(ctx, pg, intQuery(r, "limit", 50000))
|
||||
if err != nil {
|
||||
http.Error(w, "genel urun performans KPI alinamadi: "+err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
@@ -125,7 +125,7 @@ func GetProductPerformanceOrdersHandler(pg *sql.DB) http.HandlerFunc {
|
||||
ctx, cancel := context.WithTimeout(utils.ContextWithTraceID(r.Context(), traceID), 90*time.Second)
|
||||
defer cancel()
|
||||
|
||||
rows, err := queries.ListProductPerformanceOrderAnalysis(ctx, pg, intQuery(r, "limit", 500))
|
||||
rows, err := queries.ListProductPerformanceOrderAnalysis(ctx, pg, intQuery(r, "limit", 50000))
|
||||
if err != nil {
|
||||
http.Error(w, "siparis analiz verisi alinamadi: "+err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
@@ -145,7 +145,7 @@ func GetProductPerformanceOrderGroupsHandler(pg *sql.DB) http.HandlerFunc {
|
||||
ctx,
|
||||
pg,
|
||||
strings.TrimSpace(r.URL.Query().Get("breakdown")),
|
||||
intQuery(r, "limit", 500),
|
||||
intQuery(r, "limit", 50000),
|
||||
)
|
||||
if err != nil {
|
||||
http.Error(w, "siparis grup analiz verisi alinamadi: "+err.Error(), http.StatusInternalServerError)
|
||||
@@ -162,7 +162,7 @@ func GetProductPerformanceOrderProductCustomersHandler(pg *sql.DB) http.HandlerF
|
||||
ctx, cancel := context.WithTimeout(utils.ContextWithTraceID(r.Context(), traceID), 90*time.Second)
|
||||
defer cancel()
|
||||
|
||||
rows, err := queries.ListProductPerformanceOrderProductCustomers(ctx, pg, intQuery(r, "limit", 500))
|
||||
rows, err := queries.ListProductPerformanceOrderProductCustomers(ctx, pg, intQuery(r, "limit", 50000))
|
||||
if err != nil {
|
||||
http.Error(w, "urun musteri siparis analiz verisi alinamadi: "+err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
@@ -178,7 +178,7 @@ func GetProductPerformanceOrderMarketDetailsHandler(pg *sql.DB) http.HandlerFunc
|
||||
ctx, cancel := context.WithTimeout(utils.ContextWithTraceID(r.Context(), traceID), 90*time.Second)
|
||||
defer cancel()
|
||||
|
||||
rows, err := queries.ListProductPerformanceOrderMarketDetails(ctx, pg, intQuery(r, "limit", 800))
|
||||
rows, err := queries.ListProductPerformanceOrderMarketDetails(ctx, pg, intQuery(r, "limit", 50000))
|
||||
if err != nil {
|
||||
http.Error(w, "piyasa siparis detay analiz verisi alinamadi: "+err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
@@ -194,7 +194,7 @@ func GetProductPerformanceMarketsHandler(pg *sql.DB) http.HandlerFunc {
|
||||
ctx, cancel := context.WithTimeout(utils.ContextWithTraceID(r.Context(), traceID), 30*time.Second)
|
||||
defer cancel()
|
||||
|
||||
rows, err := queries.ListProductPerformanceMarkets(ctx, pg, intQuery(r, "limit", 100))
|
||||
rows, err := queries.ListProductPerformanceMarkets(ctx, pg, intQuery(r, "limit", 50000))
|
||||
if err != nil {
|
||||
http.Error(w, "piyasa performans ozeti alinamadi: "+err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
@@ -210,7 +210,7 @@ func GetProductPerformanceCountriesHandler(pg *sql.DB) http.HandlerFunc {
|
||||
ctx, cancel := context.WithTimeout(utils.ContextWithTraceID(r.Context(), traceID), 30*time.Second)
|
||||
defer cancel()
|
||||
|
||||
rows, err := queries.ListProductPerformanceCountries(ctx, pg, intQuery(r, "limit", 100))
|
||||
rows, err := queries.ListProductPerformanceCountries(ctx, pg, intQuery(r, "limit", 50000))
|
||||
if err != nil {
|
||||
http.Error(w, "ulke performans ozeti alinamadi: "+err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
@@ -230,7 +230,7 @@ func GetProductPerformanceCustomersHandler(pg *sql.DB) http.HandlerFunc {
|
||||
ctx,
|
||||
pg,
|
||||
strings.TrimSpace(r.URL.Query().Get("breakdown")),
|
||||
intQuery(r, "limit", 100),
|
||||
intQuery(r, "limit", 50000),
|
||||
)
|
||||
if err != nil {
|
||||
http.Error(w, "musteri performans kirilimi alinamadi: "+err.Error(), http.StatusInternalServerError)
|
||||
@@ -251,7 +251,7 @@ func GetProductPerformanceSalesBreakdownHandler(pg *sql.DB) http.HandlerFunc {
|
||||
ctx,
|
||||
pg,
|
||||
strings.TrimSpace(r.URL.Query().Get("mode")),
|
||||
intQuery(r, "limit", 500),
|
||||
intQuery(r, "limit", 50000),
|
||||
)
|
||||
if err != nil {
|
||||
http.Error(w, "satis kpi kirilimi alinamadi: "+err.Error(), http.StatusInternalServerError)
|
||||
@@ -269,6 +269,7 @@ func GetProductPerformanceGroupedHandler(pg *sql.DB) http.HandlerFunc {
|
||||
defer cancel()
|
||||
|
||||
mode := strings.TrimSpace(r.URL.Query().Get("mode"))
|
||||
mainGroup := strings.TrimSpace(r.URL.Query().Get("urun_ana_grubu"))
|
||||
groupLevels := splitCSVQuery(r.URL.Query().Get("group_levels"))
|
||||
limit := intQuery(r, "limit", 50000)
|
||||
expanded := map[string]bool{}
|
||||
@@ -278,6 +279,7 @@ func GetProductPerformanceGroupedHandler(pg *sql.DB) http.HandlerFunc {
|
||||
GroupLevels []string `json:"group_levels"`
|
||||
ExpandedKeys []string `json:"expanded_keys"`
|
||||
Limit int `json:"limit"`
|
||||
MainGroup string `json:"urun_ana_grubu"`
|
||||
}
|
||||
if err := json.NewDecoder(r.Body).Decode(&body); err != nil {
|
||||
http.Error(w, "gecersiz grup istegi: "+err.Error(), http.StatusBadRequest)
|
||||
@@ -286,6 +288,9 @@ func GetProductPerformanceGroupedHandler(pg *sql.DB) http.HandlerFunc {
|
||||
if strings.TrimSpace(body.Mode) != "" {
|
||||
mode = strings.TrimSpace(body.Mode)
|
||||
}
|
||||
if strings.TrimSpace(body.MainGroup) != "" {
|
||||
mainGroup = strings.TrimSpace(body.MainGroup)
|
||||
}
|
||||
if len(body.GroupLevels) > 0 {
|
||||
groupLevels = body.GroupLevels
|
||||
}
|
||||
@@ -312,6 +317,7 @@ func GetProductPerformanceGroupedHandler(pg *sql.DB) http.HandlerFunc {
|
||||
GroupLevels: groupLevels,
|
||||
ExpandedKeys: expanded,
|
||||
Limit: limit,
|
||||
MainGroup: mainGroup,
|
||||
})
|
||||
if err != nil {
|
||||
http.Error(w, "urun performans grup verisi alinamadi: "+err.Error(), http.StatusInternalServerError)
|
||||
|
||||
Reference in New Issue
Block a user