WIP
This commit is contained in:
@@ -55,7 +55,7 @@ async function getSchichtplanungForDay(day: Date) {
|
||||
}
|
||||
|
||||
async function main() {
|
||||
const schichtplanung = await getSchichtplanungForDay(new Date('2025-08-11')).then(response => response.json());
|
||||
const schichtplanung = await getSchichtplanungForDay(new Date('2025-12-01')).then(response => response.json());
|
||||
const chunks = chunk(schichtplanung.map(({id}) => id), 1)
|
||||
for(const chunk of chunks) {
|
||||
await deleteSchichtplanungItems(chunk as string[])
|
||||
|
||||
@@ -0,0 +1,147 @@
|
||||
const operationIds = [
|
||||
'2426751',
|
||||
'2434332',
|
||||
'2437824',
|
||||
'2441471',
|
||||
'2442525',
|
||||
'2444241',
|
||||
'2448226',
|
||||
'2450977',
|
||||
'2450978',
|
||||
'2452151',
|
||||
'2454255',
|
||||
'2455048',
|
||||
'2456857',
|
||||
'2459854',
|
||||
'2464152',
|
||||
'2427276',
|
||||
'257516',
|
||||
'253794',
|
||||
'255167',
|
||||
'2512213',
|
||||
'2517294',
|
||||
'2426410',
|
||||
'2426948',
|
||||
'2431358',
|
||||
'2431912',
|
||||
'2434469',
|
||||
'2436242',
|
||||
'2438333',
|
||||
'2437519',
|
||||
'2437520',
|
||||
'2443169',
|
||||
'2444553',
|
||||
'2440273',
|
||||
'2447842',
|
||||
'2445509',
|
||||
'2448178',
|
||||
'2445513',
|
||||
'2448657',
|
||||
'2448656',
|
||||
'2448658',
|
||||
'2452629',
|
||||
'2448659',
|
||||
'2448660',
|
||||
'2458555',
|
||||
'2448936',
|
||||
'2459573',
|
||||
'2448937',
|
||||
'2448938',
|
||||
'2461070',
|
||||
'2461023',
|
||||
'2448939',
|
||||
'2448941',
|
||||
'2448942',
|
||||
'2448943',
|
||||
'2448944',
|
||||
'2448945',
|
||||
'2465278',
|
||||
'2466056',
|
||||
'2466569',
|
||||
'2470605',
|
||||
'2471479',
|
||||
'252341',
|
||||
'253677',
|
||||
'256885',
|
||||
'2510564',
|
||||
'2510931',
|
||||
'2513296',
|
||||
'2516877',
|
||||
'2519324',
|
||||
'2522937',
|
||||
'2525602',
|
||||
'2512706',
|
||||
'2460117',
|
||||
'254894',
|
||||
'255872',
|
||||
'2467856',
|
||||
'2444103',
|
||||
'2470688',
|
||||
'2428718',
|
||||
'2432271',
|
||||
'2469884',
|
||||
'2440536',
|
||||
'2462825',
|
||||
'2468018',
|
||||
'2440535',
|
||||
'2462410',
|
||||
'2447292',
|
||||
'2464146',
|
||||
'2455744',
|
||||
'2443173',
|
||||
];
|
||||
|
||||
const query = `
|
||||
query GetTourCostBreakdown($operationId: String!) {
|
||||
tourCostBreakdown(operationId: $operationId) {
|
||||
tariffDescription
|
||||
tariffValidityPeriod
|
||||
servicePositions {
|
||||
value
|
||||
description
|
||||
variant
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
async function fetchCalculation(tourId: string) {
|
||||
try {
|
||||
const response = await fetch('http://localhost:3000/graphql', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify({
|
||||
query,
|
||||
variables: {
|
||||
"operationId": tourId,
|
||||
},
|
||||
}),
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
console.error(
|
||||
`failed to load calculation for ${tourId}: ${response.status}`
|
||||
);
|
||||
return
|
||||
}
|
||||
|
||||
const json = await response.json()
|
||||
|
||||
return {
|
||||
einsatznummer: tourId,
|
||||
...json.data.tourCostBreakdown,
|
||||
}
|
||||
} catch (error) {}
|
||||
}
|
||||
|
||||
const promises = operationIds.map(id => fetchCalculation(id));
|
||||
const results = await Promise.all(promises);
|
||||
|
||||
await Deno.writeTextFile(
|
||||
"./tour_export.json",
|
||||
JSON.stringify(results, null, 2)
|
||||
);
|
||||
|
||||
export {}
|
||||
Reference in New Issue
Block a user