Change discordId type from integer to string across frontend, backend, and API schema for consistency and proper validation.
This commit is contained in:
@@ -39,8 +39,9 @@ public class AppealController implements AppealsApi {
|
||||
private final com.alttd.altitudeweb.services.discord.AppealDiscord appealDiscord;
|
||||
|
||||
@Override
|
||||
public ResponseEntity<BannedUserResponseDto> getBannedUser(Long discordId) throws Exception {
|
||||
return new ResponseEntity<>(discordAppeal.getBannedUser(discordId), HttpStatus.OK);
|
||||
public ResponseEntity<BannedUserResponseDto> getBannedUser(String discordId) throws Exception {
|
||||
long discordIdAsLong = Long.parseLong(discordId);
|
||||
return new ResponseEntity<>(discordAppeal.getBannedUser(discordIdAsLong), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@RateLimit(limit = 3, timeValue = 1, timeUnit = TimeUnit.HOURS, key = "discordAppeal")
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@ import org.springframework.stereotype.Service;
|
||||
public class BannedUserToBannedUserDtoMapper {
|
||||
|
||||
public BannedUserDto map(BannedUser bannedUser) {
|
||||
return new BannedUserDto(bannedUser.userId(), bannedUser.reason(), bannedUser.name(), bannedUser.avatarUrl());
|
||||
return new BannedUserDto(String.valueOf(bannedUser.userId()), bannedUser.reason(), bannedUser.name(), bannedUser.avatarUrl());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@ public class DiscordAppealDtoToDiscordAppealMapper {
|
||||
return new DiscordAppeal(
|
||||
UUID.randomUUID(),
|
||||
loggedInUserUuid,
|
||||
discordAppealDto.getDiscordId(),
|
||||
Long.parseLong(discordAppealDto.getDiscordId()),
|
||||
discordUsername,
|
||||
discordAppealDto.getAppeal(),
|
||||
Instant.now(),
|
||||
|
||||
@@ -49,7 +49,8 @@ public class DiscordAppeal {
|
||||
|
||||
public FormResponseDto submitAppeal(DiscordAppealDto discordAppealDto) {
|
||||
DiscordAppealDiscord discordAppealDiscord = DiscordAppealDiscord.getInstance();
|
||||
Optional<BannedUser> join = discordAppealDiscord.getBannedUser(discordAppealDto.getDiscordId()).join();
|
||||
long discordId = Long.parseLong(discordAppealDto.getDiscordId());
|
||||
Optional<BannedUser> join = discordAppealDiscord.getBannedUser(discordId).join();
|
||||
if (join.isEmpty()) {
|
||||
throw new ResponseStatusException(HttpStatus.NOT_FOUND, "User not found");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user