enabled yet again

This commit is contained in:
bootunloader
2024-09-22 13:24:16 +03:00
parent 32ded1a789
commit 76d13366c2

View File

@@ -188,48 +188,47 @@ export const postDataApiRouter = createTRPCRouter({
console.log(`[+] Posting ${data.length} entries to the API`); console.log(`[+] Posting ${data.length} entries to the API`);
await removePostSession();
return { return {
ok: true, ok: true,
detail: "Data posted successfully", data: [],
errors: undefined, users: [],
}; };
const res = await postDataToApi({ // const res = await postDataToApi({
sessions: userSessions, // sessions: userSessions,
data, // data,
users: users, // users,
draw: draw, // draw,
}); // });
console.timeEnd("Time taken to post data to the API"); // console.timeEnd("Time taken to post data to the API");
if (!res.ok) { // if (!res.ok) {
await removePostSession(); // await removePostSession();
return { ok: false, detail: res.detail }; // return { ok: false, detail: res.detail };
} // }
console.log(`[+] Data posted to the API successfully`); // console.log(`[+] Data posted to the API successfully`);
await dbApiPostData.upsertData({ // await dbApiPostData.upsertData({
id: getULID(), // id: getULID(),
drawId: +drawId.split(":")[1], // drawId: +drawId.split(":")[1],
bookDate: date, // bookDate: date,
data, // data,
createdAt: new Date().toISOString(), // createdAt: new Date().toISOString(),
updatedAt: new Date().toISOString(), // updatedAt: new Date().toISOString(),
}); // });
// Update the balance of the users after posting to the API // // Update the balance of the users after posting to the API
await updateBalanceOfPostUsers(users); // await updateBalanceOfPostUsers(users);
console.log("[+] Data saved to the database"); // console.log("[+] Data saved to the database");
await postDataCacheStore.del(input.cachedDataKey); // await postDataCacheStore.del(input.cachedDataKey);
await removePostSession(); // await removePostSession();
return { // return {
ok: true, // ok: true,
detail: "Data successfully posted to API", // detail: "Data successfully posted to API",
errors: undefined, // errors: undefined,
}; // };
}), }),
}); });