Files
coolify/src/routes/sources/[id]/github.json.ts
Andras Bacsai 41bf6b5b86 fixes
2022-04-12 10:47:53 +02:00

19 lines
635 B
TypeScript

import { getUserDetails } from '$lib/common';
import * as db from '$lib/database';
import { ErrorHandler } from '$lib/database';
import type { RequestHandler } from '@sveltejs/kit';
export const post: RequestHandler = async (event) => {
const { teamId, status, body } = await getUserDetails(event);
if (status === 401) return { status, body };
const { id } = event.params;
try {
let { type, name, htmlUrl, apiUrl, organization } = await event.request.json();
await db.addGitHubSource({ id, teamId, type, name, htmlUrl, apiUrl, organization });
return { status: 201 };
} catch (error) {
return ErrorHandler(error);
}
};