Mobile App design
Run Tests on Branches / Detect Changes (push) Successful in 10s
Run Tests on Branches / Backend Tests (push) Successful in 2m12s
Run Tests on Branches / Frontend Tests (push) Has been skipped
Run Tests on Branches / Frontend Mobile Tests (push) Successful in 1m47s

This commit is contained in:
Ichitux
2026-07-09 13:33:54 +02:00
parent 5f604b11ba
commit 2f36ef685d
32 changed files with 1793 additions and 926 deletions
+20 -1
View File
@@ -512,7 +512,8 @@ app.get('/api/medicines/:medicineId/pharmacies', async (req, res) => {
try {
const nregistro = req.params.medicineId; // Ahora es el nregistro de CIMA
const pharmacies = await userDbAll(`
// First try to get pharmacies with specific medicine data
let pharmacies = await userDbAll(`
SELECT
p.id,
p.name,
@@ -529,6 +530,24 @@ app.get('/api/medicines/:medicineId/pharmacies', async (req, res) => {
ORDER BY p.name
`, [nregistro]);
// If no specific links exist, return all pharmacies as potential sellers
if (pharmacies.length === 0) {
pharmacies = await userDbAll(`
SELECT
p.id,
p.name,
p.address,
p.phone,
p.latitude,
p.longitude,
p.opening_hours,
NULL as price,
0 as stock
FROM pharmacies p
ORDER BY p.name
`);
}
res.json(pharmacies);
} catch (error) {
console.error('Error fetching pharmacies:', error);