Files
online-energieausweis/src/testing/ausweise-bw-fix-ausgestellt.ts

37 lines
1.0 KiB
TypeScript

import { Enums, prisma } from "#lib/server/prisma.js";
let start = 1;
let limit = 10;
const existing_bedarfsausweiswohnen_list = await prisma.bedarfsausweisWohnen.findMany({
where: {
rechnung_id: null
}
});
for (const ausweis of existing_bedarfsausweiswohnen_list) {
if (ausweis.bestellt == true && ausweis.benutzer_id != "USCTJ2VV"){
console.log(
'ID:' + ausweis.id +
' Reg.Nr:' + ausweis.registriernummer +
' Rechnung_id: ' + ausweis.rechnung_id +
' Bestellt: ' + ausweis.bestellt +
' Ausgestellt: ' + ausweis.ausgestellt +
' Ausgestellt am: ' + ausweis.ausstellungsdatum
);
await prisma.bedarfsausweisWohnen.update({
where: {
id: ausweis.id
},
data: {
bestellt: false,
ausgestellt: false,
ausstellungsdatum: null
}
});
// if (start >= limit) break;
start++;
}
}