37 lines
1.0 KiB
TypeScript
37 lines
1.0 KiB
TypeScript
import { Enums, prisma } from "#lib/server/prisma.js";
|
|
|
|
let start = 1;
|
|
let limit = 10;
|
|
|
|
const existing_verbauchsausweiswohnen_list = await prisma.verbrauchsausweisWohnen.findMany({
|
|
where: {
|
|
rechnung_id: null
|
|
}
|
|
});
|
|
|
|
for (const ausweis of existing_verbauchsausweiswohnen_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.verbrauchsausweisWohnen.update({
|
|
where: {
|
|
id: ausweis.id
|
|
},
|
|
data: {
|
|
bestellt: false,
|
|
ausgestellt: false,
|
|
ausstellungsdatum: null
|
|
}
|
|
});
|
|
|
|
// if (start >= limit) break;
|
|
start++;
|
|
}
|
|
} |