Windows Updates
Service-Shop and SSA js
This commit is contained in:
9
ssa/fetch.js
Normal file
9
ssa/fetch.js
Normal file
@ -0,0 +1,9 @@
|
||||
let url = 'https://ssa.eu.infineon.com/m42Services/api/orders?decider=false&costCenterDecider=false&catalogRequest=false&minimalResultSet=true&$orderby=CreatedDate%20desc&$top=2000&$count=true';
|
||||
fetch(url)
|
||||
.then((res) => res.text())
|
||||
.then((text) => {
|
||||
const data = JSON.parse(text);
|
||||
if (data.length > 0)
|
||||
console.log(data[0]);
|
||||
})
|
||||
.catch((e) => console.error(e));
|
27
ssa/file.js
Normal file
27
ssa/file.js
Normal file
@ -0,0 +1,27 @@
|
||||
import ssa from '../ssa/file.json' with { type: 'json' };
|
||||
|
||||
let booking;
|
||||
let element;
|
||||
let services = [];
|
||||
let bookings = [];
|
||||
const path = 'J:/5-Other-Small/Notes/EC-Documentation/ssa/out.json';
|
||||
|
||||
for (let i = 0; i < ssa.Orders.length; i++) {
|
||||
bookings = [];
|
||||
element = ssa.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);
|
Reference in New Issue
Block a user