fix: update last accessed client on push

This commit is contained in:
DecDuck
2025-04-01 21:14:39 +11:00
parent 36e6c92938
commit 065951d91f
2 changed files with 10 additions and 2 deletions

View File

@ -39,7 +39,13 @@ export default defineClientEventHandler(
if (!game) if (!game)
throw createError({ statusCode: 400, statusMessage: "Invalid game ID" }); throw createError({ statusCode: 400, statusMessage: "Invalid game ID" });
await saveManager.pushSave(gameId, user.id, slotIndex, h3.node.req); await saveManager.pushSave(
gameId,
user.id,
slotIndex,
h3.node.req,
client.id
);
return; return;
} }

View File

@ -20,7 +20,8 @@ class SaveManager {
gameId: string, gameId: string,
userId: string, userId: string,
index: number, index: number,
stream: IncomingMessage stream: IncomingMessage,
clientId: string | undefined = undefined
) { ) {
const save = await prisma.saveSlot.findUnique({ const save = await prisma.saveSlot.findUnique({
where: { where: {
@ -84,6 +85,7 @@ class SaveManager {
historyChecksums: { historyChecksums: {
push: hash, push: hash,
}, },
...(clientId && { lastUsedClientId: clientId }),
}, },
}); });