mirror of
https://github.com/Dokploy/dokploy.git
synced 2026-07-27 08:45:33 +02:00
feat(settings): add user subscription check to dashboard layout
This commit is contained in:
@@ -45,7 +45,7 @@ import {
|
||||
} from "@dokploy/server";
|
||||
import { generateOpenApiDocument } from "@dokploy/trpc-openapi";
|
||||
import { TRPCError } from "@trpc/server";
|
||||
import { sql } from "drizzle-orm";
|
||||
import { eq, sql } from "drizzle-orm";
|
||||
import { dump, load } from "js-yaml";
|
||||
import { scheduledJobs, scheduleJob } from "node-schedule";
|
||||
import { z } from "zod";
|
||||
@@ -60,6 +60,8 @@ import {
|
||||
apiServerSchema,
|
||||
apiTraefikConfig,
|
||||
apiUpdateDockerCleanup,
|
||||
projects,
|
||||
server,
|
||||
} from "@/server/db/schema";
|
||||
import { removeJob, schedule } from "@/server/utils/backup";
|
||||
import packageInfo from "../../../package.json";
|
||||
@@ -706,6 +708,18 @@ export const settingsRouter = createTRPCRouter({
|
||||
isCloud: publicProcedure.query(async () => {
|
||||
return IS_CLOUD;
|
||||
}),
|
||||
isUserSubscribed: publicProcedure.query(async ({ ctx }) => {
|
||||
const haveServers = await db.query.server.findMany({
|
||||
where: eq(server.organizationId, ctx.session?.activeOrganizationId || ""),
|
||||
});
|
||||
const haveProjects = await db.query.projects.findMany({
|
||||
where: eq(
|
||||
projects.organizationId,
|
||||
ctx.session?.activeOrganizationId || "",
|
||||
),
|
||||
});
|
||||
return haveServers.length > 0 || haveProjects.length > 0;
|
||||
}),
|
||||
health: publicProcedure.query(async () => {
|
||||
if (IS_CLOUD) {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user