create new api for drawing random marks

This commit is contained in:
2026-02-24 13:08:31 +05:30
parent 65be794ea4
commit 572327b540

View File

@@ -42,6 +42,7 @@ const saveGameScore2 = async (req, res) => {
const result = await newGame.save();
// Upload screenshot to S3 if provided
if (screenShot) {
try {
let base64Image = screenShot.split(";base64,").pop();
const buffer = Buffer.from(base64Image, "base64");
@@ -55,6 +56,10 @@ const saveGameScore2 = async (req, res) => {
const s3Response = await s3.upload(uploadParams).promise();
newGame.screenshotUrl = s3Response.Location;
await newGame.save();
} catch (uploadError) {
console.log("Screenshot upload failed, saving without screenshot:", uploadError.message);
// Continue without screenshot - the game data is still saved
}
}
res.status(200).json({