Skip to content

Commit 3aa9172

Browse files
committed
fix: fix crash on update and delete already removed meetup
1 parent f6cc3bf commit 3aa9172

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "course-vue-backend",
3-
"version": "1.3.1",
3+
"version": "1.3.3",
44
"description": "API backend for learn.javascript.ru VueJS Course",
55
"author": "Grigorii K. Shartsev <me@shgk.me>",
66
"private": true,

src/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ async function bootstrap() {
3535

3636
const options = new DocumentBuilder()
3737
.setTitle('Meetups API')
38-
.setVersion('1.3.1')
38+
.setVersion('1.3.3')
3939
.addSecurity('cookie-session', {
4040
type: 'apiKey',
4141
in: 'cookie',

src/meetups/meetups.service.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,9 @@ export class MeetupsService {
9797
this.em.merge(organizer);
9898
// TODO: not the best solution and not dry
9999
const meetup = await this.meetupsRepository.findOne(meetupId, ['agenda']);
100+
if (!meetup) {
101+
throw new NotFoundException();
102+
}
100103
meetup.title = newMeetup.title;
101104
meetup.description = newMeetup.description;
102105
meetup.place = newMeetup.place;
@@ -126,7 +129,9 @@ export class MeetupsService {
126129
'participants',
127130
'image',
128131
]);
129-
return this.meetupsRepository.removeAndFlush(meetup);
132+
if (meetup) {
133+
return this.meetupsRepository.removeAndFlush(meetup);
134+
}
130135
}
131136

132137
async attendMeetup(meetupId: number, user: UserEntity) {

0 commit comments

Comments
 (0)