feat: partial user platform support + statusMessage -> message

This commit is contained in:
DecDuck
2025-08-27 11:25:23 +10:00
parent 3af00e085e
commit 8efddc07bc
143 changed files with 831 additions and 593 deletions

View File

@ -8,13 +8,13 @@ export default defineClientEventHandler(async (h3, { fetchUser }) => {
if (!id)
throw createError({
statusCode: 400,
statusMessage: "ID required in route params",
message: "ID required in route params",
});
const body = await readBody(h3);
const gameId = body.id;
if (!gameId)
throw createError({ statusCode: 400, statusMessage: "Game ID required" });
throw createError({ statusCode: 400, message: "Game ID required" });
const successful = await userLibraryManager.collectionRemove(
gameId,
@ -24,7 +24,7 @@ export default defineClientEventHandler(async (h3, { fetchUser }) => {
if (!successful)
throw createError({
statusCode: 404,
statusMessage: "Collection not found",
message: "Collection not found",
});
return {};
});

View File

@ -8,13 +8,13 @@ export default defineClientEventHandler(async (h3, { fetchUser }) => {
if (!id)
throw createError({
statusCode: 400,
statusMessage: "ID required in route params",
message: "ID required in route params",
});
const body = await readBody(h3);
const gameId = body.id;
if (!gameId)
throw createError({ statusCode: 400, statusMessage: "Game ID required" });
throw createError({ statusCode: 400, message: "Game ID required" });
return await userLibraryManager.collectionAdd(gameId, id, user.id);
});

View File

@ -8,7 +8,7 @@ export default defineClientEventHandler(async (h3, { fetchUser }) => {
if (!id)
throw createError({
statusCode: 400,
statusMessage: "ID required in route params",
message: "ID required in route params",
});
// Verify collection exists and user owns it
@ -17,13 +17,13 @@ export default defineClientEventHandler(async (h3, { fetchUser }) => {
if (!collection)
throw createError({
statusCode: 404,
statusMessage: "Collection not found",
message: "Collection not found",
});
if (collection.userId !== user.id)
throw createError({
statusCode: 403,
statusMessage: "Not authorized to delete this collection",
message: "Not authorized to delete this collection",
});
await userLibraryManager.deleteCollection(id);

View File

@ -8,7 +8,7 @@ export default defineClientEventHandler(async (h3, { fetchUser }) => {
if (!id)
throw createError({
statusCode: 400,
statusMessage: "ID required in route params",
message: "ID required in route params",
});
// Fetch specific collection
@ -17,14 +17,14 @@ export default defineClientEventHandler(async (h3, { fetchUser }) => {
if (!collection)
throw createError({
statusCode: 404,
statusMessage: "Collection not found",
message: "Collection not found",
});
// Verify user owns this collection
if (collection.userId !== user.id)
throw createError({
statusCode: 403,
statusMessage: "Not authorized to access this collection",
message: "Not authorized to access this collection",
});
return collection;