[GH-61] Fix manual mapping leading to duplicates in DB

This commit is contained in:
grimsi
2022-10-21 21:15:51 +02:00
parent 76ea2d81f6
commit 755611689e
3 changed files with 9 additions and 3 deletions
@@ -105,6 +105,8 @@ public class GameService {
.orElseThrow(() -> new ResponseStatusException(HttpStatus.NOT_FOUND, "Game with slug '%s' does not exist on IGDB.".formatted(slug))); .orElseThrow(() -> new ResponseStatusException(HttpStatus.NOT_FOUND, "Game with slug '%s' does not exist on IGDB.".formatted(slug)));
DetectedGame game = gameMapper.toDetectedGame(igdbGame, Path.of(unmappableFile.getPath())); DetectedGame game = gameMapper.toDetectedGame(igdbGame, Path.of(unmappableFile.getPath()));
game.setConfirmedMatch(true);
game = detectedGameRepository.save(game); game = detectedGameRepository.save(game);
unmappableFileRepository.delete(unmappableFile); unmappableFileRepository.delete(unmappableFile);
@@ -117,8 +119,12 @@ public class GameService {
.orElseThrow(() -> new ResponseStatusException(HttpStatus.NOT_FOUND, "Game with slug '%s' does not exist on IGDB.".formatted(slug))); .orElseThrow(() -> new ResponseStatusException(HttpStatus.NOT_FOUND, "Game with slug '%s' does not exist on IGDB.".formatted(slug)));
DetectedGame game = gameMapper.toDetectedGame(igdbGame, Path.of(existingGame.getPath())); DetectedGame game = gameMapper.toDetectedGame(igdbGame, Path.of(existingGame.getPath()));
game.setConfirmedMatch(true);
game = detectedGameRepository.save(game); game = detectedGameRepository.save(game);
detectedGameRepository.delete(existingGame);
return game; return game;
} }
} }
+2 -2
View File
@@ -1,12 +1,12 @@
{ {
"name": "frontend", "name": "frontend",
"version": "1.2.4-SNAPSHOT", "version": "1.2.5-SNAPSHOT",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "frontend", "name": "frontend",
"version": "1.2.4-SNAPSHOT", "version": "1.2.5-SNAPSHOT",
"dependencies": { "dependencies": {
"@angular/animations": "^14.0.0", "@angular/animations": "^14.0.0",
"@angular/cdk": "^14.1.0", "@angular/cdk": "^14.1.0",
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "frontend", "name": "frontend",
"version": "1.2.4-SNAPSHOT", "version": "1.2.5-SNAPSHOT",
"scripts": { "scripts": {
"ng": "ng", "ng": "ng",
"start": "ng serve", "start": "ng serve",