feat: интерактивный установщик install.sh (Docker / Ubuntu, админ, БД)

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
shop
2026-05-17 13:57:54 +03:00
parent dedef454c8
commit db4bc9bfe1
28 changed files with 1069 additions and 22 deletions
+20
View File
@@ -0,0 +1,20 @@
const { query } = require('./db');
async function seedPromoCodes() {
const { rows } = await query('SELECT COUNT(*)::int AS n FROM promo_codes');
if (rows[0].n > 0) return;
const expires = new Date();
expires.setDate(expires.getDate() + 30);
await query(
`INSERT INTO promo_codes (code, description, discount_type, discount_value, expires_at, min_order_cents)
VALUES
('WELCOME10', 'Скидка 10% новым покупателям', 'percent', 10, $1, 0),
('SALE500', 'Скидка 500 ₽ от 3000 ₽', 'fixed', 50000, $1, 300000)`,
[expires.toISOString()]
);
console.log('Демо-промокоды: WELCOME10, SALE500');
}
module.exports = { seedPromoCodes };