feat: Use compose instead of normal docker cmd

This commit is contained in:
Andras Bacsai
2022-03-23 10:25:32 +01:00
parent f0ab3750bd
commit 2bf73109b2
13 changed files with 131 additions and 191 deletions

View File

@@ -1,9 +1,7 @@
import { getTeam, getUserDetails } from '$lib/common';
import { getUserDetails } from '$lib/common';
import * as db from '$lib/database';
import { ErrorHandler } from '$lib/database';
import { dockerInstance } from '$lib/docker';
import type { RequestHandler } from '@sveltejs/kit';
import jsonwebtoken from 'jsonwebtoken';
export const get: RequestHandler = async (event) => {
const { status, body, teamId } = await getUserDetails(event, false);
@@ -27,11 +25,18 @@ export const post: RequestHandler = async (event) => {
if (status === 401) return { status, body };
const { id } = event.params;
const { path } = await event.request.json();
const { path, newStorage, storageId } = await event.request.json();
try {
await db.prisma.applicationPersistentStorage.create({
data: { path, application: { connect: { id } } }
});
if (newStorage) {
await db.prisma.applicationPersistentStorage.create({
data: { path, application: { connect: { id } } }
});
} else {
await db.prisma.applicationPersistentStorage.update({
where: { id: storageId },
data: { path }
});
}
return {
status: 201
};