Index: database/drizzle/queries/builds.ts
===================================================================
--- database/drizzle/queries/builds.ts	(revision 915ce0f79f23f0277a9fcbdce9b3ea649e0fb428)
+++ database/drizzle/queries/builds.ts	(revision 387083452a874472599c1fd728bdeea99bf1c966)
@@ -522,35 +522,38 @@
 
 export async function getBuildState(db: Database, userId: number, buildId: number) {
-    const [build] = await db
-        .select({
-            id: buildsTable.id,
-            userId: buildsTable.userId,
-            isApproved: buildsTable.isApproved,
-            name: buildsTable.name,
-            description: buildsTable.description,
-            totalPrice: buildsTable.totalPrice,
-        })
-        .from(buildsTable)
-        .where(
-            and(
-                eq(buildsTable.id, buildId),
-                eq(buildsTable.userId, userId)
-            )
-        )
-        .limit(1);
-
-    if (!build || build.isApproved) return null;
-
-    const components = await db
-        .select({ componentId: buildComponentsTable.componentId
-            })
-        .from(buildComponentsTable)
-        .where(
-            eq(buildComponentsTable.buildId, buildId)
-        );
-
-    return {
-        build,
-        componentIds: components.map(c => c.componentId)
-    };
-}
+    return db.transaction(async (tx) => {
+        const [build] = await tx
+            .select({
+                id: buildsTable.id,
+                userId: buildsTable.userId,
+                isApproved: buildsTable.isApproved,
+                name: buildsTable.name,
+                description: buildsTable.description,
+                totalPrice: buildsTable.totalPrice,
+            })
+            .from(buildsTable)
+            .where(
+                and(
+                    eq(buildsTable.id, buildId),
+                    eq(buildsTable.userId, userId)
+                )
+            )
+            .limit(1);
+
+        if (!build || build.isApproved) return null;
+
+        const components = await tx
+            .select({
+                componentId: buildComponentsTable.componentId
+            })
+            .from(buildComponentsTable)
+            .where(
+                eq(buildComponentsTable.buildId, buildId)
+            );
+
+        return {
+            build,
+            componentIds: components.map(c => c.componentId)
+        };
+    });
+}
