mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-10-25 09:41:04 +01:00
Wrap routine document upsert in transaction
Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
1 parent
87e354f07a
commit
9cf661cc22
1 file changed
+6
@@ -654,6 +654,12 @@ export function routineService(
|
||||
actor: Actor,
|
||||
options: { changeSummary?: string | null } = {},
|
||||
): Promise<RoutineDescriptionDocument> {
|
||||
if (executor === db) {
|
||||
return db.transaction(async (tx) => (
|
||||
upsertRoutineDescriptionDocument(tx as unknown as Db, routine, actor, options)
|
||||
));
|
||||
}
|
||||
|
||||
const now = new Date();
|
||||
const body = routine.description ?? "";
|
||||
const existing = await getRoutineDescriptionDocument(routine.id, executor);
|
||||
|
||||
Reference in new issue
Block a user