Fixed UTF8 import

This commit is contained in:
Torsten Schulz
2025-07-15 16:22:14 +02:00
parent f753d45e17
commit 68725af630

View File

@@ -31,7 +31,7 @@ class MatchService {
const matches = [];
try {
const fileStream = fs.createReadStream(filePath)
.pipe(iconv.decodeStream('ISO-8859-15'))
.pipe(iconv.decodeStream('utf8'))
.pipe(csv({ separator: ';' }));
for await (const row of fileStream) {
const parsedDate = parse(row['Termin'], 'dd.MM.yyyy HH:mm', new Date());
@@ -67,15 +67,11 @@ class MatchService {
clubId: clubId,
});
}
let season = null;
if (seasonString) {
const season = await Season.findOne({ where: { season: seasonString } });
season = await Season.findOne({ where: { season: seasonString } });
if (season) {
await Match.destroy({
where: {
clubId: clubId,
seasonId: season.id,
}
});
await Match.destroy({ where: { clubId, seasonId: season.id } });
}
}
const result = await Match.bulkCreate(matches);