Merge branch 'main' into tournament
This commit is contained in:
@@ -8,8 +8,7 @@ class AccidentService {
|
||||
await checkAccess(userToken, clubId);
|
||||
const user = await getUserByToken(userToken);
|
||||
if (!user) {
|
||||
console.log('---------------');
|
||||
throw new Error('User not found');
|
||||
throw new Error('User not found');
|
||||
}
|
||||
const member = await Member.findByPk(memberId);
|
||||
if (!member || member.clubId != clubId) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user