Change createAppeal method in AppealMapper to return UUID, adjust AppealController to construct Appeal with generated UUID.
This commit is contained in:
@@ -18,6 +18,7 @@ import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.server.ResponseStatusException;
|
||||
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@@ -44,9 +45,12 @@ public class AppealController implements AppealsApi {
|
||||
.runQuery(sqlSession -> {
|
||||
log.debug("Loading history by id");
|
||||
try {
|
||||
Appeal appeal = sqlSession.getMapper(AppealMapper.class)
|
||||
.createAppeal(mapper.minecraftAppealDtoToAppeal(minecraftAppealDto));
|
||||
appealCompletableFuture.complete(appeal);
|
||||
Appeal appeal = mapper.minecraftAppealDtoToAppeal(minecraftAppealDto);
|
||||
UUID appealId = sqlSession.getMapper(AppealMapper.class)
|
||||
.createAppeal(appeal);
|
||||
Appeal finalAppeal = new Appeal(appealId, appeal.uuid(), appeal.username(), appeal.reason(),
|
||||
appeal.createdAt(), appeal.sendAt(), appeal.email(), appeal.assignedTo());
|
||||
appealCompletableFuture.complete(finalAppeal);
|
||||
} catch (Exception e) {
|
||||
log.error("Failed to load history count", e);
|
||||
appealCompletableFuture.completeExceptionally(e);
|
||||
|
||||
Reference in New Issue
Block a user