mirror of
https://github.com/ershisan99/coolify.git
synced 2026-01-23 12:34:26 +00:00
21
src/routes/sources/[id]/gitlab.json.ts
Normal file
21
src/routes/sources/[id]/gitlab.json.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { getUserDetails } from '$lib/common';
|
||||
import * as db from '$lib/database';
|
||||
import { PrismaErrorHandler } 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 { oauthId, groupName, appId, appSecret } = await event.request.json();
|
||||
|
||||
oauthId = Number(oauthId);
|
||||
|
||||
await db.addSource({ id, teamId, oauthId, groupName, appId, appSecret });
|
||||
return { status: 201 };
|
||||
} catch (error) {
|
||||
return PrismaErrorHandler(error);
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user