feat: add terminal-scoped transaction analytics

This commit is contained in:
2026-08-20 20:56:15 +03:30
parent f710762b90
commit 857f29635e
8 changed files with 571 additions and 55 deletions

View File

@@ -22,7 +22,7 @@ func SeedDemo(ctx context.Context, pool *pgxpool.Pool, username, password string
var merchantID int64
err = pool.QueryRow(ctx, `SELECT m.id,m.source_key,m.display_name
FROM merchants m JOIN payment_sessions ps ON ps.merchant_id=m.id
GROUP BY m.id ORDER BY count(*) DESC,m.source_key LIMIT 1`).Scan(
GROUP BY m.id ORDER BY (count(DISTINCT ps.terminal_id)>1) DESC,count(*) DESC,m.source_key LIMIT 1`).Scan(
&merchantID, &result.MerchantSourceKey, &result.MerchantName,
)
if err != nil {