fixes
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- A unique constraint covering the columns `[serviceId,containerId,path]` on the table `ServicePersistentStorage` will be added. If there are existing duplicate values, this will fail.
|
||||
|
||||
*/
|
||||
-- DropIndex
|
||||
DROP INDEX "ServicePersistentStorage_serviceId_path_key";
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "ServicePersistentStorage_serviceId_containerId_path_key" ON "ServicePersistentStorage"("serviceId", "containerId", "path");
|
||||
@@ -203,7 +203,7 @@ model ServicePersistentStorage {
|
||||
updatedAt DateTime @updatedAt
|
||||
service Service @relation(fields: [serviceId], references: [id])
|
||||
|
||||
@@unique([serviceId, path])
|
||||
@@unique([serviceId, containerId, path])
|
||||
}
|
||||
|
||||
model Secret {
|
||||
|
||||
@@ -75,12 +75,12 @@ export async function startService(request: FastifyRequest<ServiceStartStop>) {
|
||||
}
|
||||
}
|
||||
}
|
||||
const customVolumes = await prisma.servicePersistentStorage.findMany({ where: { serviceId: service } })
|
||||
const customVolumes = await prisma.servicePersistentStorage.findMany({ where: { serviceId: id } })
|
||||
let volumes = arm ? template.services[service].volumesArm : template.services[service].volumes
|
||||
if (customVolumes.length > 0) {
|
||||
for (const customVolume of customVolumes) {
|
||||
const { volumeName, path } = customVolume
|
||||
if (!volumes.includes(`${volumeName}:${path}`)) {
|
||||
const { volumeName, path, containerId } = customVolume
|
||||
if (!volumes.includes(`${volumeName}:${path}`) && containerId === service) {
|
||||
volumes.push(`${volumeName}:${path}`)
|
||||
}
|
||||
}
|
||||
@@ -102,7 +102,7 @@ export async function startService(request: FastifyRequest<ServiceStartStop>) {
|
||||
labels: makeLabelForServices(type),
|
||||
...defaultComposeConfiguration(network),
|
||||
}
|
||||
|
||||
|
||||
// Generate files for builds
|
||||
if (template.services[service]?.files?.length > 0) {
|
||||
if (!template.services[service].build) {
|
||||
|
||||
@@ -613,9 +613,8 @@ export async function saveServiceStorage(request: FastifyRequest<SaveServiceStor
|
||||
|
||||
export async function deleteServiceStorage(request: FastifyRequest<DeleteServiceStorage>) {
|
||||
try {
|
||||
const { id } = request.params
|
||||
const { path } = request.body
|
||||
await prisma.servicePersistentStorage.deleteMany({ where: { serviceId: id, path } });
|
||||
const { storageId } = request.body
|
||||
await prisma.servicePersistentStorage.deleteMany({ where: { id: storageId } });
|
||||
return {}
|
||||
} catch ({ status, message }) {
|
||||
return errorHandler({ status, message })
|
||||
|
||||
@@ -74,7 +74,7 @@ export interface SaveServiceStorage extends OnlyId {
|
||||
|
||||
export interface DeleteServiceStorage extends OnlyId {
|
||||
Body: {
|
||||
path: string,
|
||||
storageId: string,
|
||||
}
|
||||
}
|
||||
export interface ServiceStartStop {
|
||||
|
||||
Reference in New Issue
Block a user