mirror of
				https://github.com/hydralauncher/hydra.git
				synced 2025-03-09 15:40:26 +00:00 
			
		
		
		
	post to /games on startGameDownload
This commit is contained in:
		
							parent
							
								
									6179fb9cf6
								
							
						
					
					
						commit
						ab4cf23f97
					
				
					 1 changed files with 14 additions and 0 deletions
				
			
		| 
						 | 
					@ -12,6 +12,7 @@ import { DownloadManager } from "@main/services";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import { Not } from "typeorm";
 | 
					import { Not } from "typeorm";
 | 
				
			||||||
import { steamGamesWorker } from "@main/workers";
 | 
					import { steamGamesWorker } from "@main/workers";
 | 
				
			||||||
 | 
					import { createGame } from "@main/services/library-sync";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const startGameDownload = async (
 | 
					const startGameDownload = async (
 | 
				
			||||||
  _event: Electron.IpcMainInvokeEvent,
 | 
					  _event: Electron.IpcMainInvokeEvent,
 | 
				
			||||||
| 
						 | 
					@ -94,6 +95,19 @@ const startGameDownload = async (
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  createGame(updatedGame!).then((response) => {
 | 
				
			||||||
 | 
					    const {
 | 
				
			||||||
 | 
					      id: remoteId,
 | 
				
			||||||
 | 
					      playTimeInMilliseconds,
 | 
				
			||||||
 | 
					      lastTimePlayed,
 | 
				
			||||||
 | 
					    } = response.data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    gameRepository.update(
 | 
				
			||||||
 | 
					      { objectID },
 | 
				
			||||||
 | 
					      { remoteId, playTimeInMilliseconds, lastTimePlayed }
 | 
				
			||||||
 | 
					    );
 | 
				
			||||||
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  await downloadQueueRepository.delete({ game: { id: updatedGame!.id } });
 | 
					  await downloadQueueRepository.delete({ game: { id: updatedGame!.id } });
 | 
				
			||||||
  await downloadQueueRepository.insert({ game: { id: updatedGame!.id } });
 | 
					  await downloadQueueRepository.insert({ game: { id: updatedGame!.id } });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue