mirror of
https://github.com/andwati/dokploy.git
synced 2026-11-21 19:38:47 +00:00
feat(libsql): enhance libsql service integration in user permissions and project router
- Added 'libsql' to the Services type in add-permissions.tsx for improved service management. - Implemented extraction logic for 'libsql' services in the extractServices function. - Updated project router to include 'libsql' in service filters and response columns, ensuring comprehensive data handling for libsql services.
This commit is contained in:
@@ -46,7 +46,8 @@ export type Services = {
|
|||||||
| "mysql"
|
| "mysql"
|
||||||
| "mongo"
|
| "mongo"
|
||||||
| "redis"
|
| "redis"
|
||||||
| "compose";
|
| "compose"
|
||||||
|
| "libsql";
|
||||||
description?: string | null;
|
description?: string | null;
|
||||||
id: string;
|
id: string;
|
||||||
createdAt: string;
|
createdAt: string;
|
||||||
@@ -136,6 +137,18 @@ export const extractServices = (data: Environment | undefined) => {
|
|||||||
serverId: item.serverId,
|
serverId: item.serverId,
|
||||||
})) ?? []) as Services[];
|
})) ?? []) as Services[];
|
||||||
|
|
||||||
|
const libsql: Services[] =
|
||||||
|
data?.libsql?.map((item) => ({
|
||||||
|
appName: item.appName,
|
||||||
|
name: item.name,
|
||||||
|
type: "libsql" as const,
|
||||||
|
id: item.libsqlId,
|
||||||
|
createdAt: item.createdAt,
|
||||||
|
status: item.applicationStatus,
|
||||||
|
description: item.description,
|
||||||
|
serverId: item.serverId,
|
||||||
|
})) || [];
|
||||||
|
|
||||||
applications.push(
|
applications.push(
|
||||||
...mysql,
|
...mysql,
|
||||||
...redis,
|
...redis,
|
||||||
@@ -143,6 +156,7 @@ export const extractServices = (data: Environment | undefined) => {
|
|||||||
...postgres,
|
...postgres,
|
||||||
...mariadb,
|
...mariadb,
|
||||||
...compose,
|
...compose,
|
||||||
|
...libsql,
|
||||||
);
|
);
|
||||||
|
|
||||||
applications.sort((a, b) => {
|
applications.sort((a, b) => {
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ import {
|
|||||||
IS_CLOUD,
|
IS_CLOUD,
|
||||||
updateProjectById,
|
updateProjectById,
|
||||||
} from "@dokploy/server";
|
} from "@dokploy/server";
|
||||||
|
import { db } from "@dokploy/server/db";
|
||||||
import {
|
import {
|
||||||
addNewEnvironment,
|
addNewEnvironment,
|
||||||
addNewProject,
|
addNewProject,
|
||||||
@@ -37,17 +38,16 @@ import {
|
|||||||
checkProjectAccess,
|
checkProjectAccess,
|
||||||
findMemberByUserId,
|
findMemberByUserId,
|
||||||
} from "@dokploy/server/services/permission";
|
} from "@dokploy/server/services/permission";
|
||||||
import { db } from "@dokploy/server/db";
|
|
||||||
import { TRPCError } from "@trpc/server";
|
import { TRPCError } from "@trpc/server";
|
||||||
import { and, desc, eq, ilike, or, sql } from "drizzle-orm";
|
import { and, desc, eq, ilike, or, sql } from "drizzle-orm";
|
||||||
import type { AnyPgColumn } from "drizzle-orm/pg-core";
|
import type { AnyPgColumn } from "drizzle-orm/pg-core";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { audit } from "@/server/api/utils/audit";
|
|
||||||
import {
|
import {
|
||||||
createTRPCRouter,
|
createTRPCRouter,
|
||||||
protectedProcedure,
|
protectedProcedure,
|
||||||
withPermission,
|
withPermission,
|
||||||
} from "@/server/api/trpc";
|
} from "@/server/api/trpc";
|
||||||
|
import { audit } from "@/server/api/utils/audit";
|
||||||
import {
|
import {
|
||||||
apiCreateProject,
|
apiCreateProject,
|
||||||
apiFindOneProject,
|
apiFindOneProject,
|
||||||
@@ -233,12 +233,13 @@ export const projectRouter = createTRPCRouter({
|
|||||||
applicationStatus: true,
|
applicationStatus: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
compose: {
|
|
||||||
where: buildServiceFilter(compose.composeId, accessedServices),
|
|
||||||
with: { domains: true },
|
|
||||||
},
|
|
||||||
libsql: {
|
libsql: {
|
||||||
where: buildServiceFilter(libsql.libsqlId, accessedServices),
|
where: buildServiceFilter(libsql.libsqlId, accessedServices),
|
||||||
|
columns: {
|
||||||
|
libsqlId: true,
|
||||||
|
name: true,
|
||||||
|
applicationStatus: true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
mariadb: {
|
mariadb: {
|
||||||
where: buildServiceFilter(mariadb.mariadbId, accessedServices),
|
where: buildServiceFilter(mariadb.mariadbId, accessedServices),
|
||||||
@@ -351,12 +352,11 @@ export const projectRouter = createTRPCRouter({
|
|||||||
composeStatus: true,
|
composeStatus: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
libsql: true,
|
libsql: {
|
||||||
mariadb: true,
|
columns: {
|
||||||
mongo: true,
|
libsqlId: true,
|
||||||
mysql: true,
|
},
|
||||||
postgres: true,
|
},
|
||||||
redis: true,
|
|
||||||
},
|
},
|
||||||
columns: {
|
columns: {
|
||||||
name: true,
|
name: true,
|
||||||
@@ -469,6 +469,17 @@ export const projectRouter = createTRPCRouter({
|
|||||||
serverId: true,
|
serverId: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
libsql: {
|
||||||
|
columns: {
|
||||||
|
libsqlId: true,
|
||||||
|
appName: true,
|
||||||
|
name: true,
|
||||||
|
createdAt: true,
|
||||||
|
applicationStatus: true,
|
||||||
|
description: true,
|
||||||
|
serverId: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user