mirror of
https://github.com/Dokploy/dokploy.git
synced 2026-07-03 21:15:23 +02:00
- Removed the unused import of the organization schema. - Introduced a new import for the getOrganizationOwnerId function to enhance license validation logic.
25 lines
621 B
TypeScript
25 lines
621 B
TypeScript
import { db } from "@dokploy/server/db";
|
|
import { user } from "@dokploy/server/db/schema";
|
|
import { eq } from "drizzle-orm";
|
|
import { getOrganizationOwnerId } from "./sso";
|
|
|
|
export const hasValidLicense = async (organizationId: string) => {
|
|
const ownerId = await getOrganizationOwnerId(organizationId);
|
|
|
|
if (!ownerId) {
|
|
return false;
|
|
}
|
|
|
|
const currentUser = await db.query.user.findFirst({
|
|
where: eq(user.id, ownerId),
|
|
columns: {
|
|
enableEnterpriseFeatures: true,
|
|
isValidEnterpriseLicense: true,
|
|
},
|
|
});
|
|
return !!(
|
|
currentUser?.enableEnterpriseFeatures &&
|
|
currentUser?.isValidEnterpriseLicense
|
|
);
|
|
};
|