mirror of
https://github.com/andwati/dokploy.git
synced 2026-11-28 06:28:47 +00:00
Update packages/server/src/services/proprietary/license-key.ts
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
This commit is contained in:
co-authored by
greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
parent
4e8d37bff7
commit
605931861b
@@ -3,18 +3,12 @@ import { organization, user } from "@dokploy/server/db/schema";
|
|||||||
import { eq } from "drizzle-orm";
|
import { eq } from "drizzle-orm";
|
||||||
|
|
||||||
export const hasValidLicense = async (organizationId: string) => {
|
export const hasValidLicense = async (organizationId: string) => {
|
||||||
// we need to find the owner of the organization
|
const ownerId = await getOrganizationOwnerId(organizationId);
|
||||||
const organizationResult = await db.query.organization.findFirst({
|
|
||||||
where: eq(organization.id, organizationId),
|
|
||||||
columns: { ownerId: true },
|
|
||||||
});
|
|
||||||
|
|
||||||
if (!organizationResult) {
|
if (!ownerId) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ownerId = organizationResult?.ownerId;
|
|
||||||
|
|
||||||
const currentUser = await db.query.user.findFirst({
|
const currentUser = await db.query.user.findFirst({
|
||||||
where: eq(user.id, ownerId),
|
where: eq(user.id, ownerId),
|
||||||
columns: {
|
columns: {
|
||||||
|
|||||||
Reference in New Issue
Block a user