Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/workflows/deploy-front.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,11 @@ jobs:
publish-profile: ${{ secrets.AZURE_FRONT_PUBLISH_PROFILE }}
images: ${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}
restart: true

# Warm-up: force ISR regeneration so first real user gets data
- name: Warm-up (force ISR regeneration)
run: |
echo "Waiting for App Service to start..."
sleep 30
curl -s -o /dev/null -w "%{http_code}" https://info-embalse-front-prod-ecguababcfdsepga.westeurope-01.azurewebsites.net/
echo " - Warm-up done, ISR regeneration triggered"
45 changes: 26 additions & 19 deletions front/src/pods/embalse-search/embalse-search.repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,34 @@ import { getDb } from "@/lib/mongodb";
import type { Embalse } from "./api/api.model";

export async function getEmbalsesFromDb(): Promise<Embalse[]> {
const db = await getDb();
const docs = await db
.collection("embalses")
.find(
{},
{
projection: {
_id: 1,
nombre: 1,
provincia: 1,
slug: 1,
try {
const db = await getDb();
const docs = await db
.collection("embalses")
.find(
{},
{
projection: {
_id: 1,
nombre: 1,
provincia: 1,
slug: 1,
},
},
},
)
.toArray();
)
.toArray();

return docs.map((doc) => ({
_id: doc.slug ?? createSlug(doc.nombre ?? ""),
nombre: doc.nombre ?? "",
provincia: doc.provincia ?? "",
}));
return docs.map((doc) => ({
_id: doc.slug ?? createSlug(doc.nombre ?? ""),
nombre: doc.nombre ?? "",
provincia: doc.provincia ?? "",
}));
} catch {
console.warn(
"getEmbalsesFromDb: MongoDB not available (build time?), returning empty array"
);
return [];
}
}

const createSlug = (nombre: string): string => {
Expand Down