mirror of
https://github.com/Dokploy/dokploy
synced 2025-06-26 18:27:59 +00:00
refactor(mount): enhance updateMount function with transaction handling and improved error management
This commit is contained in:
parent
371c6317aa
commit
5611dcccfd
@ -31,7 +31,6 @@ export const mountRouter = createTRPCRouter({
|
||||
update: protectedProcedure
|
||||
.input(apiUpdateMount)
|
||||
.mutation(async ({ input }) => {
|
||||
await updateMount(input.mountId, input);
|
||||
return true;
|
||||
return await updateMount(input.mountId, input);
|
||||
}),
|
||||
});
|
||||
|
@ -123,7 +123,8 @@ export const updateMount = async (
|
||||
mountId: string,
|
||||
mountData: Partial<Mount>,
|
||||
) => {
|
||||
const mount = await db
|
||||
return await db.transaction(async (tx) => {
|
||||
const mount = await tx
|
||||
.update(mounts)
|
||||
.set({
|
||||
...mountData,
|
||||
@ -143,7 +144,9 @@ export const updateMount = async (
|
||||
await deleteFileMount(mountId);
|
||||
await createFileMount(mountId);
|
||||
}
|
||||
return mount;
|
||||
|
||||
return await findMountById(mountId);
|
||||
});
|
||||
};
|
||||
|
||||
export const findMountsByApplicationId = async (
|
||||
|
Loading…
Reference in New Issue
Block a user