From 894f81fdbb03a6b0d4d4231d4f9e96b57f6f8093 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krist=C3=B3f=20Poduszl=C3=B3?= <14854048+kripod@users.noreply.github.com> Date: Wed, 17 Apr 2024 11:32:20 +0200 Subject: [PATCH] refactor: rename 'rates' collection to 'quoteRecords' --- package.json | 2 +- src/content/config.ts | 4 ++-- src/content/{rates => quoteRecords}/ATSHUF.json | 0 src/content/{rates => quoteRecords}/AUDHUF.json | 0 src/content/{rates => quoteRecords}/AUPHUF.json | 0 src/content/{rates => quoteRecords}/BEFHUF.json | 0 src/content/{rates => quoteRecords}/BGLHUF.json | 0 src/content/{rates => quoteRecords}/BGNHUF.json | 0 src/content/{rates => quoteRecords}/BRLHUF.json | 0 src/content/{rates => quoteRecords}/CADHUF.json | 0 src/content/{rates => quoteRecords}/CHFHUF.json | 0 src/content/{rates => quoteRecords}/CNYHUF.json | 0 src/content/{rates => quoteRecords}/CSDHUF.json | 0 src/content/{rates => quoteRecords}/CSKHUF.json | 0 src/content/{rates => quoteRecords}/CZKHUF.json | 0 src/content/{rates => quoteRecords}/DDMHUF.json | 0 src/content/{rates => quoteRecords}/DEMHUF.json | 0 src/content/{rates => quoteRecords}/DKKHUF.json | 0 src/content/{rates => quoteRecords}/EEKHUF.json | 0 src/content/{rates => quoteRecords}/EGPHUF.json | 0 src/content/{rates => quoteRecords}/ESPHUF.json | 0 src/content/{rates => quoteRecords}/EURHUF.json | 0 src/content/{rates => quoteRecords}/FIMHUF.json | 0 src/content/{rates => quoteRecords}/FRFHUF.json | 0 src/content/{rates => quoteRecords}/GBPHUF.json | 0 src/content/{rates => quoteRecords}/GHPHUF.json | 0 src/content/{rates => quoteRecords}/GRDHUF.json | 0 src/content/{rates => quoteRecords}/HKDHUF.json | 0 src/content/{rates => quoteRecords}/HRKHUF.json | 0 src/content/{rates => quoteRecords}/IDRHUF.json | 0 src/content/{rates => quoteRecords}/IEPHUF.json | 0 src/content/{rates => quoteRecords}/ILSHUF.json | 0 src/content/{rates => quoteRecords}/INRHUF.json | 0 src/content/{rates => quoteRecords}/ISKHUF.json | 0 src/content/{rates => quoteRecords}/ITLHUF.json | 0 src/content/{rates => quoteRecords}/JPYHUF.json | 0 src/content/{rates => quoteRecords}/KPWHUF.json | 0 src/content/{rates => quoteRecords}/KRWHUF.json | 0 src/content/{rates => quoteRecords}/KWDHUF.json | 0 src/content/{rates => quoteRecords}/LBPHUF.json | 0 src/content/{rates => quoteRecords}/LTLHUF.json | 0 src/content/{rates => quoteRecords}/LUFHUF.json | 0 src/content/{rates => quoteRecords}/LVLHUF.json | 0 src/content/{rates => quoteRecords}/MNTHUF.json | 0 src/content/{rates => quoteRecords}/MXNHUF.json | 0 src/content/{rates => quoteRecords}/MYRHUF.json | 0 src/content/{rates => quoteRecords}/NLGHUF.json | 0 src/content/{rates => quoteRecords}/NOKHUF.json | 0 src/content/{rates => quoteRecords}/NZDHUF.json | 0 src/content/{rates => quoteRecords}/OALHUF.json | 0 src/content/{rates => quoteRecords}/OBLHUF.json | 0 src/content/{rates => quoteRecords}/OFRHUF.json | 0 src/content/{rates => quoteRecords}/ORBHUF.json | 0 src/content/{rates => quoteRecords}/PHPHUF.json | 0 src/content/{rates => quoteRecords}/PKRHUF.json | 0 src/content/{rates => quoteRecords}/PLNHUF.json | 0 src/content/{rates => quoteRecords}/PTEHUF.json | 0 src/content/{rates => quoteRecords}/ROLHUF.json | 0 src/content/{rates => quoteRecords}/RONHUF.json | 0 src/content/{rates => quoteRecords}/RSDHUF.json | 0 src/content/{rates => quoteRecords}/RUBHUF.json | 0 src/content/{rates => quoteRecords}/SDPHUF.json | 0 src/content/{rates => quoteRecords}/SEKHUF.json | 0 src/content/{rates => quoteRecords}/SGDHUF.json | 0 src/content/{rates => quoteRecords}/SITHUF.json | 0 src/content/{rates => quoteRecords}/SKKHUF.json | 0 src/content/{rates => quoteRecords}/SURHUF.json | 0 src/content/{rates => quoteRecords}/THBHUF.json | 0 src/content/{rates => quoteRecords}/TRYHUF.json | 0 src/content/{rates => quoteRecords}/UAHHUF.json | 0 src/content/{rates => quoteRecords}/USDHUF.json | 0 src/content/{rates => quoteRecords}/VNDHUF.json | 0 src/content/{rates => quoteRecords}/XEUHUF.json | 0 src/content/{rates => quoteRecords}/XTRHUF.json | 0 src/content/{rates => quoteRecords}/YUDHUF.json | 0 src/content/{rates => quoteRecords}/ZARHUF.json | 0 src/content/{rates => quoteRecords}/_scraper.ts | 8 ++++---- src/pages/api/v1/symbols/[symbol]/index.json.ts | 8 ++++---- src/pages/api/v1/symbols/index.json.ts | 8 ++++---- src/pages/api/v1/years/index.json.ts | 10 ++++++---- 80 files changed, 21 insertions(+), 19 deletions(-) rename src/content/{rates => quoteRecords}/ATSHUF.json (100%) rename src/content/{rates => quoteRecords}/AUDHUF.json (100%) rename src/content/{rates => quoteRecords}/AUPHUF.json (100%) rename src/content/{rates => quoteRecords}/BEFHUF.json (100%) rename src/content/{rates => quoteRecords}/BGLHUF.json (100%) rename src/content/{rates => quoteRecords}/BGNHUF.json (100%) rename src/content/{rates => quoteRecords}/BRLHUF.json (100%) rename src/content/{rates => quoteRecords}/CADHUF.json (100%) rename src/content/{rates => quoteRecords}/CHFHUF.json (100%) rename src/content/{rates => quoteRecords}/CNYHUF.json (100%) rename src/content/{rates => quoteRecords}/CSDHUF.json (100%) rename src/content/{rates => quoteRecords}/CSKHUF.json (100%) rename src/content/{rates => quoteRecords}/CZKHUF.json (100%) rename src/content/{rates => quoteRecords}/DDMHUF.json (100%) rename src/content/{rates => quoteRecords}/DEMHUF.json (100%) rename src/content/{rates => quoteRecords}/DKKHUF.json (100%) rename src/content/{rates => quoteRecords}/EEKHUF.json (100%) rename src/content/{rates => quoteRecords}/EGPHUF.json (100%) rename src/content/{rates => quoteRecords}/ESPHUF.json (100%) rename src/content/{rates => quoteRecords}/EURHUF.json (100%) rename src/content/{rates => quoteRecords}/FIMHUF.json (100%) rename src/content/{rates => quoteRecords}/FRFHUF.json (100%) rename src/content/{rates => quoteRecords}/GBPHUF.json (100%) rename src/content/{rates => quoteRecords}/GHPHUF.json (100%) rename src/content/{rates => quoteRecords}/GRDHUF.json (100%) rename src/content/{rates => quoteRecords}/HKDHUF.json (100%) rename src/content/{rates => quoteRecords}/HRKHUF.json (100%) rename src/content/{rates => quoteRecords}/IDRHUF.json (100%) rename src/content/{rates => quoteRecords}/IEPHUF.json (100%) rename src/content/{rates => quoteRecords}/ILSHUF.json (100%) rename src/content/{rates => quoteRecords}/INRHUF.json (100%) rename src/content/{rates => quoteRecords}/ISKHUF.json (100%) rename src/content/{rates => quoteRecords}/ITLHUF.json (100%) rename src/content/{rates => quoteRecords}/JPYHUF.json (100%) rename src/content/{rates => quoteRecords}/KPWHUF.json (100%) rename src/content/{rates => quoteRecords}/KRWHUF.json (100%) rename src/content/{rates => quoteRecords}/KWDHUF.json (100%) rename src/content/{rates => quoteRecords}/LBPHUF.json (100%) rename src/content/{rates => quoteRecords}/LTLHUF.json (100%) rename src/content/{rates => quoteRecords}/LUFHUF.json (100%) rename src/content/{rates => quoteRecords}/LVLHUF.json (100%) rename src/content/{rates => quoteRecords}/MNTHUF.json (100%) rename src/content/{rates => quoteRecords}/MXNHUF.json (100%) rename src/content/{rates => quoteRecords}/MYRHUF.json (100%) rename src/content/{rates => quoteRecords}/NLGHUF.json (100%) rename src/content/{rates => quoteRecords}/NOKHUF.json (100%) rename src/content/{rates => quoteRecords}/NZDHUF.json (100%) rename src/content/{rates => quoteRecords}/OALHUF.json (100%) rename src/content/{rates => quoteRecords}/OBLHUF.json (100%) rename src/content/{rates => quoteRecords}/OFRHUF.json (100%) rename src/content/{rates => quoteRecords}/ORBHUF.json (100%) rename src/content/{rates => quoteRecords}/PHPHUF.json (100%) rename src/content/{rates => quoteRecords}/PKRHUF.json (100%) rename src/content/{rates => quoteRecords}/PLNHUF.json (100%) rename src/content/{rates => quoteRecords}/PTEHUF.json (100%) rename src/content/{rates => quoteRecords}/ROLHUF.json (100%) rename src/content/{rates => quoteRecords}/RONHUF.json (100%) rename src/content/{rates => quoteRecords}/RSDHUF.json (100%) rename src/content/{rates => quoteRecords}/RUBHUF.json (100%) rename src/content/{rates => quoteRecords}/SDPHUF.json (100%) rename src/content/{rates => quoteRecords}/SEKHUF.json (100%) rename src/content/{rates => quoteRecords}/SGDHUF.json (100%) rename src/content/{rates => quoteRecords}/SITHUF.json (100%) rename src/content/{rates => quoteRecords}/SKKHUF.json (100%) rename src/content/{rates => quoteRecords}/SURHUF.json (100%) rename src/content/{rates => quoteRecords}/THBHUF.json (100%) rename src/content/{rates => quoteRecords}/TRYHUF.json (100%) rename src/content/{rates => quoteRecords}/UAHHUF.json (100%) rename src/content/{rates => quoteRecords}/USDHUF.json (100%) rename src/content/{rates => quoteRecords}/VNDHUF.json (100%) rename src/content/{rates => quoteRecords}/XEUHUF.json (100%) rename src/content/{rates => quoteRecords}/XTRHUF.json (100%) rename src/content/{rates => quoteRecords}/YUDHUF.json (100%) rename src/content/{rates => quoteRecords}/ZARHUF.json (100%) rename src/content/{rates => quoteRecords}/_scraper.ts (92%) diff --git a/package.json b/package.json index 4c67c53..e8a684a 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "private": true, "type": "module", "scripts": { - "fetch:mnb": "tsx ./src/content/rates/_scraper.ts", + "fetch:mnb": "tsx ./src/content/quoteRecords/_scraper.ts", "dev": "astro dev", "build": "astro build", "preview": "astro preview", diff --git a/src/content/config.ts b/src/content/config.ts index c0371ee..e931be8 100644 --- a/src/content/config.ts +++ b/src/content/config.ts @@ -6,12 +6,12 @@ const docsCollection = defineCollection({ schema: docsSchema(), }); -const ratesCollection = defineCollection({ +const quoteRecordsCollection = defineCollection({ type: "data", schema: z.record(z.string(), z.number()), }); export const collections = { docs: docsCollection, - rates: ratesCollection, + quoteRecords: quoteRecordsCollection, }; diff --git a/src/content/rates/ATSHUF.json b/src/content/quoteRecords/ATSHUF.json similarity index 100% rename from src/content/rates/ATSHUF.json rename to src/content/quoteRecords/ATSHUF.json diff --git a/src/content/rates/AUDHUF.json b/src/content/quoteRecords/AUDHUF.json similarity index 100% rename from src/content/rates/AUDHUF.json rename to src/content/quoteRecords/AUDHUF.json diff --git a/src/content/rates/AUPHUF.json b/src/content/quoteRecords/AUPHUF.json similarity index 100% rename from src/content/rates/AUPHUF.json rename to src/content/quoteRecords/AUPHUF.json diff --git a/src/content/rates/BEFHUF.json b/src/content/quoteRecords/BEFHUF.json similarity index 100% rename from src/content/rates/BEFHUF.json rename to src/content/quoteRecords/BEFHUF.json diff --git a/src/content/rates/BGLHUF.json b/src/content/quoteRecords/BGLHUF.json similarity index 100% rename from src/content/rates/BGLHUF.json rename to src/content/quoteRecords/BGLHUF.json diff --git a/src/content/rates/BGNHUF.json b/src/content/quoteRecords/BGNHUF.json similarity index 100% rename from src/content/rates/BGNHUF.json rename to src/content/quoteRecords/BGNHUF.json diff --git a/src/content/rates/BRLHUF.json b/src/content/quoteRecords/BRLHUF.json similarity index 100% rename from src/content/rates/BRLHUF.json rename to src/content/quoteRecords/BRLHUF.json diff --git a/src/content/rates/CADHUF.json b/src/content/quoteRecords/CADHUF.json similarity index 100% rename from src/content/rates/CADHUF.json rename to src/content/quoteRecords/CADHUF.json diff --git a/src/content/rates/CHFHUF.json b/src/content/quoteRecords/CHFHUF.json similarity index 100% rename from src/content/rates/CHFHUF.json rename to src/content/quoteRecords/CHFHUF.json diff --git a/src/content/rates/CNYHUF.json b/src/content/quoteRecords/CNYHUF.json similarity index 100% rename from src/content/rates/CNYHUF.json rename to src/content/quoteRecords/CNYHUF.json diff --git a/src/content/rates/CSDHUF.json b/src/content/quoteRecords/CSDHUF.json similarity index 100% rename from src/content/rates/CSDHUF.json rename to src/content/quoteRecords/CSDHUF.json diff --git a/src/content/rates/CSKHUF.json b/src/content/quoteRecords/CSKHUF.json similarity index 100% rename from src/content/rates/CSKHUF.json rename to src/content/quoteRecords/CSKHUF.json diff --git a/src/content/rates/CZKHUF.json b/src/content/quoteRecords/CZKHUF.json similarity index 100% rename from src/content/rates/CZKHUF.json rename to src/content/quoteRecords/CZKHUF.json diff --git a/src/content/rates/DDMHUF.json b/src/content/quoteRecords/DDMHUF.json similarity index 100% rename from src/content/rates/DDMHUF.json rename to src/content/quoteRecords/DDMHUF.json diff --git a/src/content/rates/DEMHUF.json b/src/content/quoteRecords/DEMHUF.json similarity index 100% rename from src/content/rates/DEMHUF.json rename to src/content/quoteRecords/DEMHUF.json diff --git a/src/content/rates/DKKHUF.json b/src/content/quoteRecords/DKKHUF.json similarity index 100% rename from src/content/rates/DKKHUF.json rename to src/content/quoteRecords/DKKHUF.json diff --git a/src/content/rates/EEKHUF.json b/src/content/quoteRecords/EEKHUF.json similarity index 100% rename from src/content/rates/EEKHUF.json rename to src/content/quoteRecords/EEKHUF.json diff --git a/src/content/rates/EGPHUF.json b/src/content/quoteRecords/EGPHUF.json similarity index 100% rename from src/content/rates/EGPHUF.json rename to src/content/quoteRecords/EGPHUF.json diff --git a/src/content/rates/ESPHUF.json b/src/content/quoteRecords/ESPHUF.json similarity index 100% rename from src/content/rates/ESPHUF.json rename to src/content/quoteRecords/ESPHUF.json diff --git a/src/content/rates/EURHUF.json b/src/content/quoteRecords/EURHUF.json similarity index 100% rename from src/content/rates/EURHUF.json rename to src/content/quoteRecords/EURHUF.json diff --git a/src/content/rates/FIMHUF.json b/src/content/quoteRecords/FIMHUF.json similarity index 100% rename from src/content/rates/FIMHUF.json rename to src/content/quoteRecords/FIMHUF.json diff --git a/src/content/rates/FRFHUF.json b/src/content/quoteRecords/FRFHUF.json similarity index 100% rename from src/content/rates/FRFHUF.json rename to src/content/quoteRecords/FRFHUF.json diff --git a/src/content/rates/GBPHUF.json b/src/content/quoteRecords/GBPHUF.json similarity index 100% rename from src/content/rates/GBPHUF.json rename to src/content/quoteRecords/GBPHUF.json diff --git a/src/content/rates/GHPHUF.json b/src/content/quoteRecords/GHPHUF.json similarity index 100% rename from src/content/rates/GHPHUF.json rename to src/content/quoteRecords/GHPHUF.json diff --git a/src/content/rates/GRDHUF.json b/src/content/quoteRecords/GRDHUF.json similarity index 100% rename from src/content/rates/GRDHUF.json rename to src/content/quoteRecords/GRDHUF.json diff --git a/src/content/rates/HKDHUF.json b/src/content/quoteRecords/HKDHUF.json similarity index 100% rename from src/content/rates/HKDHUF.json rename to src/content/quoteRecords/HKDHUF.json diff --git a/src/content/rates/HRKHUF.json b/src/content/quoteRecords/HRKHUF.json similarity index 100% rename from src/content/rates/HRKHUF.json rename to src/content/quoteRecords/HRKHUF.json diff --git a/src/content/rates/IDRHUF.json b/src/content/quoteRecords/IDRHUF.json similarity index 100% rename from src/content/rates/IDRHUF.json rename to src/content/quoteRecords/IDRHUF.json diff --git a/src/content/rates/IEPHUF.json b/src/content/quoteRecords/IEPHUF.json similarity index 100% rename from src/content/rates/IEPHUF.json rename to src/content/quoteRecords/IEPHUF.json diff --git a/src/content/rates/ILSHUF.json b/src/content/quoteRecords/ILSHUF.json similarity index 100% rename from src/content/rates/ILSHUF.json rename to src/content/quoteRecords/ILSHUF.json diff --git a/src/content/rates/INRHUF.json b/src/content/quoteRecords/INRHUF.json similarity index 100% rename from src/content/rates/INRHUF.json rename to src/content/quoteRecords/INRHUF.json diff --git a/src/content/rates/ISKHUF.json b/src/content/quoteRecords/ISKHUF.json similarity index 100% rename from src/content/rates/ISKHUF.json rename to src/content/quoteRecords/ISKHUF.json diff --git a/src/content/rates/ITLHUF.json b/src/content/quoteRecords/ITLHUF.json similarity index 100% rename from src/content/rates/ITLHUF.json rename to src/content/quoteRecords/ITLHUF.json diff --git a/src/content/rates/JPYHUF.json b/src/content/quoteRecords/JPYHUF.json similarity index 100% rename from src/content/rates/JPYHUF.json rename to src/content/quoteRecords/JPYHUF.json diff --git a/src/content/rates/KPWHUF.json b/src/content/quoteRecords/KPWHUF.json similarity index 100% rename from src/content/rates/KPWHUF.json rename to src/content/quoteRecords/KPWHUF.json diff --git a/src/content/rates/KRWHUF.json b/src/content/quoteRecords/KRWHUF.json similarity index 100% rename from src/content/rates/KRWHUF.json rename to src/content/quoteRecords/KRWHUF.json diff --git a/src/content/rates/KWDHUF.json b/src/content/quoteRecords/KWDHUF.json similarity index 100% rename from src/content/rates/KWDHUF.json rename to src/content/quoteRecords/KWDHUF.json diff --git a/src/content/rates/LBPHUF.json b/src/content/quoteRecords/LBPHUF.json similarity index 100% rename from src/content/rates/LBPHUF.json rename to src/content/quoteRecords/LBPHUF.json diff --git a/src/content/rates/LTLHUF.json b/src/content/quoteRecords/LTLHUF.json similarity index 100% rename from src/content/rates/LTLHUF.json rename to src/content/quoteRecords/LTLHUF.json diff --git a/src/content/rates/LUFHUF.json b/src/content/quoteRecords/LUFHUF.json similarity index 100% rename from src/content/rates/LUFHUF.json rename to src/content/quoteRecords/LUFHUF.json diff --git a/src/content/rates/LVLHUF.json b/src/content/quoteRecords/LVLHUF.json similarity index 100% rename from src/content/rates/LVLHUF.json rename to src/content/quoteRecords/LVLHUF.json diff --git a/src/content/rates/MNTHUF.json b/src/content/quoteRecords/MNTHUF.json similarity index 100% rename from src/content/rates/MNTHUF.json rename to src/content/quoteRecords/MNTHUF.json diff --git a/src/content/rates/MXNHUF.json b/src/content/quoteRecords/MXNHUF.json similarity index 100% rename from src/content/rates/MXNHUF.json rename to src/content/quoteRecords/MXNHUF.json diff --git a/src/content/rates/MYRHUF.json b/src/content/quoteRecords/MYRHUF.json similarity index 100% rename from src/content/rates/MYRHUF.json rename to src/content/quoteRecords/MYRHUF.json diff --git a/src/content/rates/NLGHUF.json b/src/content/quoteRecords/NLGHUF.json similarity index 100% rename from src/content/rates/NLGHUF.json rename to src/content/quoteRecords/NLGHUF.json diff --git a/src/content/rates/NOKHUF.json b/src/content/quoteRecords/NOKHUF.json similarity index 100% rename from src/content/rates/NOKHUF.json rename to src/content/quoteRecords/NOKHUF.json diff --git a/src/content/rates/NZDHUF.json b/src/content/quoteRecords/NZDHUF.json similarity index 100% rename from src/content/rates/NZDHUF.json rename to src/content/quoteRecords/NZDHUF.json diff --git a/src/content/rates/OALHUF.json b/src/content/quoteRecords/OALHUF.json similarity index 100% rename from src/content/rates/OALHUF.json rename to src/content/quoteRecords/OALHUF.json diff --git a/src/content/rates/OBLHUF.json b/src/content/quoteRecords/OBLHUF.json similarity index 100% rename from src/content/rates/OBLHUF.json rename to src/content/quoteRecords/OBLHUF.json diff --git a/src/content/rates/OFRHUF.json b/src/content/quoteRecords/OFRHUF.json similarity index 100% rename from src/content/rates/OFRHUF.json rename to src/content/quoteRecords/OFRHUF.json diff --git a/src/content/rates/ORBHUF.json b/src/content/quoteRecords/ORBHUF.json similarity index 100% rename from src/content/rates/ORBHUF.json rename to src/content/quoteRecords/ORBHUF.json diff --git a/src/content/rates/PHPHUF.json b/src/content/quoteRecords/PHPHUF.json similarity index 100% rename from src/content/rates/PHPHUF.json rename to src/content/quoteRecords/PHPHUF.json diff --git a/src/content/rates/PKRHUF.json b/src/content/quoteRecords/PKRHUF.json similarity index 100% rename from src/content/rates/PKRHUF.json rename to src/content/quoteRecords/PKRHUF.json diff --git a/src/content/rates/PLNHUF.json b/src/content/quoteRecords/PLNHUF.json similarity index 100% rename from src/content/rates/PLNHUF.json rename to src/content/quoteRecords/PLNHUF.json diff --git a/src/content/rates/PTEHUF.json b/src/content/quoteRecords/PTEHUF.json similarity index 100% rename from src/content/rates/PTEHUF.json rename to src/content/quoteRecords/PTEHUF.json diff --git a/src/content/rates/ROLHUF.json b/src/content/quoteRecords/ROLHUF.json similarity index 100% rename from src/content/rates/ROLHUF.json rename to src/content/quoteRecords/ROLHUF.json diff --git a/src/content/rates/RONHUF.json b/src/content/quoteRecords/RONHUF.json similarity index 100% rename from src/content/rates/RONHUF.json rename to src/content/quoteRecords/RONHUF.json diff --git a/src/content/rates/RSDHUF.json b/src/content/quoteRecords/RSDHUF.json similarity index 100% rename from src/content/rates/RSDHUF.json rename to src/content/quoteRecords/RSDHUF.json diff --git a/src/content/rates/RUBHUF.json b/src/content/quoteRecords/RUBHUF.json similarity index 100% rename from src/content/rates/RUBHUF.json rename to src/content/quoteRecords/RUBHUF.json diff --git a/src/content/rates/SDPHUF.json b/src/content/quoteRecords/SDPHUF.json similarity index 100% rename from src/content/rates/SDPHUF.json rename to src/content/quoteRecords/SDPHUF.json diff --git a/src/content/rates/SEKHUF.json b/src/content/quoteRecords/SEKHUF.json similarity index 100% rename from src/content/rates/SEKHUF.json rename to src/content/quoteRecords/SEKHUF.json diff --git a/src/content/rates/SGDHUF.json b/src/content/quoteRecords/SGDHUF.json similarity index 100% rename from src/content/rates/SGDHUF.json rename to src/content/quoteRecords/SGDHUF.json diff --git a/src/content/rates/SITHUF.json b/src/content/quoteRecords/SITHUF.json similarity index 100% rename from src/content/rates/SITHUF.json rename to src/content/quoteRecords/SITHUF.json diff --git a/src/content/rates/SKKHUF.json b/src/content/quoteRecords/SKKHUF.json similarity index 100% rename from src/content/rates/SKKHUF.json rename to src/content/quoteRecords/SKKHUF.json diff --git a/src/content/rates/SURHUF.json b/src/content/quoteRecords/SURHUF.json similarity index 100% rename from src/content/rates/SURHUF.json rename to src/content/quoteRecords/SURHUF.json diff --git a/src/content/rates/THBHUF.json b/src/content/quoteRecords/THBHUF.json similarity index 100% rename from src/content/rates/THBHUF.json rename to src/content/quoteRecords/THBHUF.json diff --git a/src/content/rates/TRYHUF.json b/src/content/quoteRecords/TRYHUF.json similarity index 100% rename from src/content/rates/TRYHUF.json rename to src/content/quoteRecords/TRYHUF.json diff --git a/src/content/rates/UAHHUF.json b/src/content/quoteRecords/UAHHUF.json similarity index 100% rename from src/content/rates/UAHHUF.json rename to src/content/quoteRecords/UAHHUF.json diff --git a/src/content/rates/USDHUF.json b/src/content/quoteRecords/USDHUF.json similarity index 100% rename from src/content/rates/USDHUF.json rename to src/content/quoteRecords/USDHUF.json diff --git a/src/content/rates/VNDHUF.json b/src/content/quoteRecords/VNDHUF.json similarity index 100% rename from src/content/rates/VNDHUF.json rename to src/content/quoteRecords/VNDHUF.json diff --git a/src/content/rates/XEUHUF.json b/src/content/quoteRecords/XEUHUF.json similarity index 100% rename from src/content/rates/XEUHUF.json rename to src/content/quoteRecords/XEUHUF.json diff --git a/src/content/rates/XTRHUF.json b/src/content/quoteRecords/XTRHUF.json similarity index 100% rename from src/content/rates/XTRHUF.json rename to src/content/quoteRecords/XTRHUF.json diff --git a/src/content/rates/YUDHUF.json b/src/content/quoteRecords/YUDHUF.json similarity index 100% rename from src/content/rates/YUDHUF.json rename to src/content/quoteRecords/YUDHUF.json diff --git a/src/content/rates/ZARHUF.json b/src/content/quoteRecords/ZARHUF.json similarity index 100% rename from src/content/rates/ZARHUF.json rename to src/content/quoteRecords/ZARHUF.json diff --git a/src/content/rates/_scraper.ts b/src/content/quoteRecords/_scraper.ts similarity index 92% rename from src/content/rates/_scraper.ts rename to src/content/quoteRecords/_scraper.ts index 2c39c1d..6a9031c 100644 --- a/src/content/rates/_scraper.ts +++ b/src/content/quoteRecords/_scraper.ts @@ -88,17 +88,17 @@ for (const [currency, rateByDate] of rateByDateByCurrency) { ); const prevContents = await file.readFile("utf8"); - const entries = prevContents + const quotes = prevContents ? Object.entries(JSON.parse(prevContents)) : []; for (const [date, rate] of rateByDate) { - entries.push([stringifyDate(date), rate]); + quotes.push([stringifyDate(date), rate]); } - entries.sort(([aDate], [bDate]) => Date.parse(aDate) - Date.parse(bDate)); + quotes.sort(([aDate], [bDate]) => Date.parse(aDate) - Date.parse(bDate)); await file.write( - JSON.stringify(Object.fromEntries(entries), null, 2) + "\n", + JSON.stringify(Object.fromEntries(quotes), null, 2) + "\n", 0, ); } diff --git a/src/pages/api/v1/symbols/[symbol]/index.json.ts b/src/pages/api/v1/symbols/[symbol]/index.json.ts index 3997a87..53cde54 100644 --- a/src/pages/api/v1/symbols/[symbol]/index.json.ts +++ b/src/pages/api/v1/symbols/[symbol]/index.json.ts @@ -6,12 +6,12 @@ import type { } from "astro"; import { getCollection } from "astro:content"; -const rates = await getCollection("rates"); +const quoteRecords = await getCollection("quoteRecords"); export const getStaticPaths = (() => { - return rates.map((rate) => ({ - params: { symbol: rate.id }, - props: rate.data, + return quoteRecords.map((quoteRecord) => ({ + params: { symbol: quoteRecord.id }, + props: quoteRecord.data, })); }) satisfies GetStaticPaths; diff --git a/src/pages/api/v1/symbols/index.json.ts b/src/pages/api/v1/symbols/index.json.ts index 27c481e..a62fb23 100644 --- a/src/pages/api/v1/symbols/index.json.ts +++ b/src/pages/api/v1/symbols/index.json.ts @@ -1,14 +1,14 @@ import type { APIRoute } from "astro"; import { getCollection } from "astro:content"; -const rates = await getCollection("rates"); +const quoteRecords = await getCollection("quoteRecords"); export const GET: APIRoute = () => Response.json( Object.fromEntries( - rates.map((rate) => { - const lastEntry = Object.entries(rate.data).at(-1); - return [rate.id, lastEntry]; + quoteRecords.map((quoteRecord) => { + const lastEntry = Object.entries(quoteRecord.data).at(-1); + return [quoteRecord.id, lastEntry]; }), ), ); diff --git a/src/pages/api/v1/years/index.json.ts b/src/pages/api/v1/years/index.json.ts index cce9018..1b9c94a 100644 --- a/src/pages/api/v1/years/index.json.ts +++ b/src/pages/api/v1/years/index.json.ts @@ -1,13 +1,15 @@ import type { APIRoute } from "astro"; import { getCollection } from "astro:content"; -const rates = await getCollection("rates"); +const quoteRecords = await getCollection("quoteRecords"); const currencyPairsByYear = new Map(); -for (const rate of rates) { +for (const quoteRecord of quoteRecords) { const years = [ ...new Set( - Object.keys(rate.data).map((date) => new Date(date).getUTCFullYear()), + Object.keys(quoteRecord.data).map((date) => + new Date(date).getUTCFullYear(), + ), ), ]; for (const year of years) { @@ -16,7 +18,7 @@ for (const rate of rates) { currencyPairs = []; currencyPairsByYear.set(year, currencyPairs); } - currencyPairs.push(rate.id); + currencyPairs.push(quoteRecord.id); } }