refactor: remove findAdmin

This commit is contained in:
Mauricio Siu 2024-10-06 15:04:54 -06:00
parent e995d894d8
commit 5b88af6158
2 changed files with 5 additions and 8 deletions

View File

@ -3,7 +3,7 @@ import { applications, compose, github } from "@/server/db/schema";
import type { DeploymentJob } from "@/server/queues/deployments-queue";
import { myQueue } from "@/server/queues/queueSetup";
import { deploy } from "@/server/utils/deploy";
import { IS_CLOUD, findAdmin } from "@dokploy/server";
import { IS_CLOUD } from "@dokploy/server";
import { Webhooks } from "@octokit/webhooks";
import { and, eq } from "drizzle-orm";
import type { NextApiRequest, NextApiResponse } from "next";
@ -13,13 +13,6 @@ export default async function handler(
req: NextApiRequest,
res: NextApiResponse,
) {
const admin = await findAdmin();
if (!admin) {
res.status(200).json({ message: "Could not find admin" });
return;
}
const signature = req.headers["x-hub-signature-256"];
const githubBody = req.body;

View File

@ -9,6 +9,7 @@ import {
import { TRPCError } from "@trpc/server";
import * as bcrypt from "bcrypt";
import { eq } from "drizzle-orm";
import { IS_CLOUD } from "../constants";
export type Admin = typeof admins.$inferSelect;
export const createInvitation = async (
@ -141,6 +142,9 @@ export const removeUserByAuthId = async (authId: string) => {
};
export const getDokployUrl = async () => {
if (IS_CLOUD) {
return "https://app.dokploy.com";
}
const admin = await findAdmin();
if (admin.host) {