feat: enhance mount API to support service type filtering and organization access checks

This commit is contained in:
Mauricio Siu
2026-02-25 22:08:05 -06:00
parent e62bb7593a
commit a467920410
3 changed files with 92 additions and 2 deletions

View File

@@ -146,12 +146,20 @@ export const apiRemoveMount = createSchema
export const apiFindMountByApplicationId = createSchema
.extend({
serviceId: z.string().min(1),
serviceType: z.enum([
"application",
"postgres",
"mysql",
"mariadb",
"mongo",
"redis",
"compose",
]),
})
.pick({
serviceId: true,
serviceType: true,
})
.required();
});
export const apiUpdateMount = createSchema.partial().extend({
mountId: z.string().min(1),

View File

@@ -263,6 +263,9 @@ export const findMountsByApplicationId = async (
case "redis":
sqlChunks.push(eq(mounts.redisId, serviceId));
break;
case "compose":
sqlChunks.push(eq(mounts.composeId, serviceId));
break;
default:
throw new Error(`Unknown service type: ${serviceType}`);
}