Skip to content

Commit

Permalink
fix: replace task and image saving order
Browse files Browse the repository at this point in the history
  • Loading branch information
solufa committed Jul 19, 2024
1 parent 46480bc commit a784585
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions server/domain/task/repository/taskCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import type { TaskDeleteVal, TaskSaveVal } from '../model/taskEntity';

export const taskCommand = {
save: async (tx: Prisma.TransactionClient, val: TaskSaveVal): Promise<void> => {
if (val.s3Params !== undefined) await s3.put(val.s3Params);

await tx.task.upsert({
where: { id: val.task.id },
update: { label: val.task.label, done: val.task.done, imageKey: val.task.imageKey },
Expand All @@ -19,6 +17,8 @@ export const taskCommand = {
authorId: val.task.author.id,
},
});

if (val.s3Params !== undefined) await s3.put(val.s3Params);
},
delete: async (tx: Prisma.TransactionClient, val: TaskDeleteVal): Promise<void> => {
assert(val.deletable);
Expand Down

0 comments on commit a784585

Please sign in to comment.