Remove unnecessary await/async from sync bun:sqlite db calls

drizzle-orm/bun-sqlite is fully synchronous — all queries return values
directly, not promises. Remove await from all db calls, drop async from
functions that no longer need it, simplify Promise.all patterns that
wrapped sync operations, and fix setSetting() which was missing .run()
(previously masked by await triggering execution via thenable).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-03 19:04:40 -05:00
co-authored by Claude Opus 4.6
parent 0f345c8cd6
commit d9b408128b
14 changed files with 275 additions and 379 deletions
+11 -11
View File
@@ -28,58 +28,58 @@ export async function updateTitleStatus(
) {
const userId = await getSessionUserId();
if (status === null) {
await removeTitleStatus(userId, titleId);
removeTitleStatus(userId, titleId);
} else {
await setTitleStatus(userId, titleId, status);
setTitleStatus(userId, titleId, status);
}
}
export async function markAllWatchedAction(titleId: string) {
const userId = await getSessionUserId();
await markAllEpisodesWatched(userId, titleId);
markAllEpisodesWatched(userId, titleId);
}
export async function updateTitleRating(titleId: string, ratingStars: number) {
const userId = await getSessionUserId();
if (ratingStars < 0 || ratingStars > 5) throw new Error("Invalid rating");
await rateTitleStars(userId, titleId, ratingStars);
rateTitleStars(userId, titleId, ratingStars);
}
export async function watchMovie(titleId: string) {
const userId = await getSessionUserId();
await logMovieWatch(userId, titleId);
logMovieWatch(userId, titleId);
}
export async function watchEpisode(episodeId: string) {
const userId = await getSessionUserId();
await logEpisodeWatch(userId, episodeId);
logEpisodeWatch(userId, episodeId);
}
export async function unwatchEpisodeAction(episodeId: string) {
const userId = await getSessionUserId();
await unwatchEpisode(userId, episodeId);
unwatchEpisode(userId, episodeId);
}
export async function watchSeason(seasonId: string) {
const userId = await getSessionUserId();
const seasonEps = await db
const seasonEps = db
.select()
.from(episodes)
.where(eq(episodes.seasonId, seasonId))
.all();
for (const ep of seasonEps) {
await logEpisodeWatch(userId, ep.id);
logEpisodeWatch(userId, ep.id);
}
}
export async function unwatchSeasonAction(seasonId: string) {
const userId = await getSessionUserId();
await unwatchSeason(userId, seasonId);
unwatchSeason(userId, seasonId);
}
export async function batchWatchEpisodes(episodeIds: string[]) {
const userId = await getSessionUserId();
for (const id of episodeIds) {
await logEpisodeWatch(userId, id);
logEpisodeWatch(userId, id);
}
}