Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

Added types to database/github

dominicbachmannb4f98e24a18b
diff --git a/src/lib/database/github.ts b/src/lib/database/github.ts
index 339b8e0080..182ad45291 100644
--- a/src/lib/database/github.ts
+++ b/src/lib/database/github.ts
@@ -1,7 +1,15 @@
import { decrypt, encrypt } from '$lib/crypto';
import { prisma } from './common';
+import type { GithubApp } from '@prisma/client';
-export async function addInstallation({ gitSourceId, installation_id }) {
+// TODO: We should change installation_id to be camelCase
+export async function addInstallation({
+ gitSourceId,
+ installation_id
+}: {
+ gitSourceId: string;
+ installation_id: string;
+}): Promise<GithubApp> {
const source = await prisma.gitSource.findUnique({
where: { id: gitSourceId },
include: { githubApp: true }
@@ -12,8 +20,12 @@ export async function addInstallation({ gitSourceId, installation_id }) {
});
}
-export async function getUniqueGithubApp({ githubAppId }) {
- let body = await prisma.githubApp.findUnique({ where: { id: githubAppId } });
+export async function getUniqueGithubApp({
+ githubAppId
+}: {
+ githubAppId: string;
+}): Promise<GithubApp> {
+ const body = await prisma.githubApp.findUnique({ where: { id: githubAppId } });
if (body.privateKey) body.privateKey = decrypt(body.privateKey);
return body;
}
@@ -26,7 +38,15 @@ export async function createGithubApp({
pem,
webhook_secret,
state
-}) {
+}: {
+ id: number;
+ client_id: string;
+ slug: string;
+ client_secret: string;
+ pem: string;
+ webhook_secret: string;
+ state: string;
+}): Promise<GithubApp> {
const encryptedClientSecret = encrypt(client_secret);
const encryptedWebhookSecret = encrypt(webhook_secret);
const encryptedPem = encrypt(pem);