mirror of
https://github.com/Dokploy/dokploy.git
synced 2026-07-08 23:45:22 +02:00
feat: add volume selection functionality to volume backup form
- Introduced a new query to fetch named mounts by application ID, enhancing the volume backup form. - Updated the form to allow users to select a volume from a dropdown, improving user experience. - Retained the option for manual input of volume names, ensuring flexibility in volume selection.
This commit is contained in:
@@ -3,6 +3,7 @@ import {
|
||||
apiFindOneMount,
|
||||
apiRemoveMount,
|
||||
apiUpdateMount,
|
||||
mounts,
|
||||
} from "@/server/db/schema";
|
||||
import {
|
||||
createMount,
|
||||
@@ -11,6 +12,9 @@ import {
|
||||
updateMount,
|
||||
} from "@dokploy/server";
|
||||
import { createTRPCRouter, protectedProcedure } from "../trpc";
|
||||
import { z } from "zod";
|
||||
import { and, eq } from "drizzle-orm";
|
||||
import { db } from "@dokploy/server/db";
|
||||
|
||||
export const mountRouter = createTRPCRouter({
|
||||
create: protectedProcedure
|
||||
@@ -33,4 +37,14 @@ export const mountRouter = createTRPCRouter({
|
||||
.mutation(async ({ input }) => {
|
||||
return await updateMount(input.mountId, input);
|
||||
}),
|
||||
allNamedByApplicationId: protectedProcedure
|
||||
.input(z.object({ applicationId: z.string().min(1) }))
|
||||
.query(async ({ input }) => {
|
||||
return await db.query.mounts.findMany({
|
||||
where: and(
|
||||
eq(mounts.applicationId, input.applicationId),
|
||||
eq(mounts.type, "volume"),
|
||||
),
|
||||
});
|
||||
}),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user