Added types to database/gitlab
This commit is contained in:
parent
b4f98e24a1
commit
c390f82246
@ -1,7 +1,14 @@
|
|||||||
import { encrypt } from '$lib/crypto';
|
import { encrypt } from '$lib/crypto';
|
||||||
import { generateSshKeyPair, prisma } from './common';
|
import { generateSshKeyPair, prisma } from './common';
|
||||||
|
import type { GitlabApp } from '@prisma/client';
|
||||||
|
|
||||||
export async function updateDeployKey({ id, deployKeyId }) {
|
export async function updateDeployKey({
|
||||||
|
id,
|
||||||
|
deployKeyId
|
||||||
|
}: {
|
||||||
|
id: string;
|
||||||
|
deployKeyId: number;
|
||||||
|
}): Promise<GitlabApp> {
|
||||||
const application = await prisma.application.findUnique({
|
const application = await prisma.application.findUnique({
|
||||||
where: { id },
|
where: { id },
|
||||||
include: { gitSource: { include: { gitlabApp: true } } }
|
include: { gitSource: { include: { gitlabApp: true } } }
|
||||||
@ -11,14 +18,24 @@ export async function updateDeployKey({ id, deployKeyId }) {
|
|||||||
data: { deployKeyId }
|
data: { deployKeyId }
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
export async function getSshKey({ id }) {
|
export async function getSshKey({
|
||||||
|
id
|
||||||
|
}: {
|
||||||
|
id: string;
|
||||||
|
}): Promise<{ status: number; body: { publicKey: string } }> {
|
||||||
const application = await prisma.application.findUnique({
|
const application = await prisma.application.findUnique({
|
||||||
where: { id },
|
where: { id },
|
||||||
include: { gitSource: { include: { gitlabApp: true } } }
|
include: { gitSource: { include: { gitlabApp: true } } }
|
||||||
});
|
});
|
||||||
return { status: 200, body: { publicKey: application.gitSource.gitlabApp.publicSshKey } };
|
return { status: 200, body: { publicKey: application.gitSource.gitlabApp.publicSshKey } };
|
||||||
}
|
}
|
||||||
export async function generateSshKey({ id }) {
|
export async function generateSshKey({
|
||||||
|
id
|
||||||
|
}: {
|
||||||
|
id: string;
|
||||||
|
}): Promise<
|
||||||
|
{ status: number; body: { publicKey: string } } | { status: number; body?: undefined }
|
||||||
|
> {
|
||||||
const application = await prisma.application.findUnique({
|
const application = await prisma.application.findUnique({
|
||||||
where: { id },
|
where: { id },
|
||||||
include: { gitSource: { include: { gitlabApp: true } } }
|
include: { gitSource: { include: { gitlabApp: true } } }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user