Hello from MCP server
/// <reference path="../pb_data/types.d.ts" />
function createRates(app, fixRate) {
const currencyRates = app.findCollectionByNameOrId("currencyRates");
const currencyRecords = app.findAllRecords("currencies");
const base = currencyRecords.find((e) => e.get("refId") == "silver");
const exchangeRates = {
usd: 38.041295,
cad: 52.516244,
bitcoin: 0.000319766951329,
gold: 0.011369975785086,
euro: 32.624386,
nixon: 5000,
slurm: 100,
};
for (const currency of currencyRecords) {
console.log(currency.refId, currency.id);
console.log(JSON.stringify(currency));
if (exchangeRates[currency.get("refId")]) {
let record = new Record(currencyRates);
record.set("currencyRateFixed", fixRate.id);
record.set("baseCurrency", base.id);
record.set("quoteCurrency", currency.id);
record.set("rate", exchangeRates[currency.get("refId")]);
app.save(record);
}
}
}
migrate(
(app) => {
const fixRate = app.findCollectionByNameOrId("currencyRateFixed");
const record = new Record(fixRate);
record.set("created", "2025-08-14 00:00:00.000Z");
record.set("name", "August 2025 Exchange Rates");
app.save(record);
createRates(app, record);
},
(app) => {
// add down queries...
},
);