Skip to content

Commit fc3bee5

Browse files
committed
Ensure at least one topic selected
1 parent b5e3e9d commit fc3bee5

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

backend/gateway-service/src/modules/match/match.controller.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,12 @@ export class MatchGateway implements OnGatewayInit {
7070
@MessageBody() payload: MatchRequestDto,
7171
) {
7272
const { userId, selectedTopic, selectedDifficulty } = payload;
73-
if (!userId || !selectedTopic || !selectedDifficulty) {
73+
if (
74+
!userId ||
75+
!selectedTopic ||
76+
!selectedDifficulty ||
77+
selectedTopic.length === 0
78+
) {
7479
client.emit(MATCH_ERROR, 'Invalid match request payload.');
7580
return;
7681
}

0 commit comments

Comments
 (0)