mirror of
https://github.com/Dokploy/dokploy.git
synced 2026-10-20 15:35:23 +00:00
ae0cdc6456
- Updated API link conditions to allow skipping batch processing based on context. - Removed unused VECTOR_RESYNC_CRON_JOB constant from server constants. - Introduced logProviderIds field in server and webServerSettings schemas to manage log providers. - Added organization service to handle organization deletions and vector agent removals. - Enhanced server service to find servers with log management enabled and update log providers. - Updated vector setup to sync vector configurations based on organization and server log provider IDs. - Implemented Docker labels for resources to improve tracking and management. - Refactored vector agent setup and removal processes to streamline operations.
27 lines
918 B
TypeScript
27 lines
918 B
TypeScript
import { db } from "@dokploy/server/db";
|
|
import { organization } from "@dokploy/server/db/schema";
|
|
import { findServersWithLogManagementEnabled } from "@dokploy/server/services/server";
|
|
import { removeVectorAgent } from "@dokploy/server/setup/vector-setup";
|
|
import { eq } from "drizzle-orm";
|
|
|
|
const removeVectorAgents = async (organizationId: string) => {
|
|
const servers = await findServersWithLogManagementEnabled(organizationId);
|
|
await Promise.all(
|
|
servers.map((server) =>
|
|
removeVectorAgent(server.serverId).catch((error) => {
|
|
console.error(
|
|
`[Vector] Failed to remove the agent on server ${server.serverId} before deleting organization ${organizationId}:`,
|
|
error,
|
|
);
|
|
}),
|
|
),
|
|
);
|
|
};
|
|
|
|
export const deleteOrganization = async (organizationId: string) => {
|
|
await removeVectorAgents(organizationId);
|
|
return await db
|
|
.delete(organization)
|
|
.where(eq(organization.id, organizationId));
|
|
};
|