Files
multy-stub/server/routers/kfu-m-24-1/sber_mobile/utility_payments.js
2025-06-04 18:49:25 +03:00

17 lines
704 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
const router = require('express').Router();
const { getSupabaseClient } = require('./supabaseClient');
// Получить все платежи по конкретной квартире с данными сервиса
router.get('/utility-payments', async (req, res) => {
const supabase = getSupabaseClient();
const { apartment_id } = req.query;
if (!apartment_id) return res.status(400).json({ error: 'apartment_id required' });
const { data, error } = await supabase
.from('utility_payments')
.select('*, payment_services(*)')
.eq('apartment_id', apartment_id);
if (error) return res.status(400).json({ error: error.message });
res.json(data);
});
module.exports = router;