Files
phares@iscn5cg20977xq 1563c27577 Windows Updates
Service-Shop and SSA js
2025-08-19 11:41:24 -07:00

27 lines
745 B
JavaScript

import serviceShop from '../service-shop/file.json' with { type: 'json' };
let booking;
let element;
let services = [];
let bookings = [];
const path = 'J:/5-Other-Small/Notes/EC-Documentation/service-shop/out.json';
for (let i = 0; i < serviceShop.Orders.length; i++) {
bookings = [];
element = serviceShop.Orders[i];
for (let j = 0; j < element.Bookings.length; j++) {
booking = element.Bookings[j];
bookings.push({
'Name': booking.Name,
'ServiceId': booking.Service.Id
});
}
services.push({
'Name': element.Name,
'CreatedDate': element.CreatedDate,
'Bookings': bookings
});
}
const json = JSON.stringify(services);
await Bun.write(path, json);