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