fix: not being able to edit game title

This commit is contained in:
Huskydog9988
2025-05-29 15:59:53 -04:00
parent 59b77b5a5e
commit f97a968e0d
2 changed files with 12 additions and 14 deletions

View File

@ -1,3 +1,4 @@
import type { Prisma } from "~/prisma/client";
import aclManager from "~/server/internal/acls";
import prisma from "~/server/internal/db/database";
import { handleFileUpload } from "~/server/internal/utils/handlefileupload";
@ -27,25 +28,24 @@ export default defineEventHandler(async (h3) => {
const description = options.description;
const gameId = options.id;
if (!id || !name || !description) {
dump();
const changes: Prisma.GameUpdateInput = {
mName: name,
mShortDescription: description,
};
throw createError({
statusCode: 400,
statusMessage: "Nothing has changed",
});
// handle if user uploaded new icon
if (id) {
changes.mIconObjectId = id;
await pull();
} else {
dump();
}
await pull();
const newObject = await prisma.game.update({
where: {
id: gameId,
},
data: {
mIconObjectId: id,
mName: name,
mShortDescription: description,
},
data: changes,
});
return newObject;

View File

@ -306,8 +306,6 @@ export class IGDBProvider implements MetadataProvider {
results.push(await this._getGenreInternal(genre));
}
console.log(results);
return results;
}