diff --git a/apps/dokploy/pages/dashboard/project/[projectId]/environment/[environmentId]/services/mariadb/[mariadbId].tsx b/apps/dokploy/pages/dashboard/project/[projectId]/environment/[environmentId]/services/mariadb/[mariadbId].tsx index 543f5b914..da10ade14 100644 --- a/apps/dokploy/pages/dashboard/project/[projectId]/environment/[environmentId]/services/mariadb/[mariadbId].tsx +++ b/apps/dokploy/pages/dashboard/project/[projectId]/environment/[environmentId]/services/mariadb/[mariadbId].tsx @@ -69,7 +69,7 @@ const Mariadb = ( list={[ { name: "Projects", href: "/dashboard/projects" }, { - name: data?.project?.name || "", + name: data?.environment?.project?.name || "", href: `/dashboard/project/${projectId}`, }, { @@ -81,7 +81,7 @@ const Mariadb = (
- Database: {data?.name} - {data?.project.name} | Dokploy + Database: {data?.name} - {data?.environment?.project?.name} | Dokploy diff --git a/apps/dokploy/pages/dashboard/project/[projectId]/environment/[environmentId]/services/mongo/[mongoId].tsx b/apps/dokploy/pages/dashboard/project/[projectId]/environment/[environmentId]/services/mongo/[mongoId].tsx index 65a7729c1..ae74b1e9e 100644 --- a/apps/dokploy/pages/dashboard/project/[projectId]/environment/[environmentId]/services/mongo/[mongoId].tsx +++ b/apps/dokploy/pages/dashboard/project/[projectId]/environment/[environmentId]/services/mongo/[mongoId].tsx @@ -69,7 +69,7 @@ const Mongo = ( list={[ { name: "Projects", href: "/dashboard/projects" }, { - name: data?.project?.name || "", + name: data?.environment?.project?.name || "", href: `/dashboard/project/${projectId}`, }, { @@ -80,7 +80,7 @@ const Mongo = ( /> - Database: {data?.name} - {data?.project.name} | Dokploy + Database: {data?.name} - {data?.environment?.project?.name} | Dokploy
diff --git a/apps/dokploy/pages/dashboard/project/[projectId]/environment/[environmentId]/services/mysql/[mysqlId].tsx b/apps/dokploy/pages/dashboard/project/[projectId]/environment/[environmentId]/services/mysql/[mysqlId].tsx index 5d2b88c9a..cddc022e0 100644 --- a/apps/dokploy/pages/dashboard/project/[projectId]/environment/[environmentId]/services/mysql/[mysqlId].tsx +++ b/apps/dokploy/pages/dashboard/project/[projectId]/environment/[environmentId]/services/mysql/[mysqlId].tsx @@ -68,7 +68,7 @@ const MySql = ( list={[ { name: "Projects", href: "/dashboard/projects" }, { - name: data?.project?.name || "", + name: data?.environment?.project?.name || "", href: `/dashboard/project/${projectId}`, }, { @@ -80,7 +80,7 @@ const MySql = (
- Database: {data?.name} - {data?.project.name} | Dokploy + Database: {data?.name} - {data?.environment?.project?.name} | Dokploy
diff --git a/apps/dokploy/pages/dashboard/project/[projectId]/environment/[environmentId]/services/postgres/[postgresId].tsx b/apps/dokploy/pages/dashboard/project/[projectId]/environment/[environmentId]/services/postgres/[postgresId].tsx index 5efe4b69f..3cb5134c9 100644 --- a/apps/dokploy/pages/dashboard/project/[projectId]/environment/[environmentId]/services/postgres/[postgresId].tsx +++ b/apps/dokploy/pages/dashboard/project/[projectId]/environment/[environmentId]/services/postgres/[postgresId].tsx @@ -68,7 +68,7 @@ const Postgresql = ( list={[ { name: "Projects", href: "/dashboard/projects" }, { - name: data?.project?.name || "", + name: data?.environment?.project?.name || "", href: `/dashboard/project/${projectId}`, }, { @@ -79,7 +79,7 @@ const Postgresql = ( /> - Database: {data?.name} - {data?.project.name} | Dokploy + Database: {data?.name} - {data?.environment?.project?.name} | Dokploy
diff --git a/apps/dokploy/pages/dashboard/project/[projectId]/environment/[environmentId]/services/redis/[redisId].tsx b/apps/dokploy/pages/dashboard/project/[projectId]/environment/[environmentId]/services/redis/[redisId].tsx index 86ffb0db5..9039a9711 100644 --- a/apps/dokploy/pages/dashboard/project/[projectId]/environment/[environmentId]/services/redis/[redisId].tsx +++ b/apps/dokploy/pages/dashboard/project/[projectId]/environment/[environmentId]/services/redis/[redisId].tsx @@ -68,7 +68,7 @@ const Redis = ( list={[ { name: "Projects", href: "/dashboard/projects" }, { - name: data?.project?.name || "", + name: data?.environment?.project?.name || "", href: `/dashboard/project/${projectId}`, }, { @@ -79,7 +79,7 @@ const Redis = ( /> - Database: {data?.name} - {data?.project.name} | Dokploy + Database: {data?.name} - {data?.environment?.project?.name} | Dokploy
diff --git a/apps/dokploy/server/api/routers/redis.ts b/apps/dokploy/server/api/routers/redis.ts index 016241f2b..2061fe881 100644 --- a/apps/dokploy/server/api/routers/redis.ts +++ b/apps/dokploy/server/api/routers/redis.ts @@ -104,7 +104,7 @@ export const redisRouter = createTRPCRouter({ } const redis = await findRedisById(input.redisId); - if (redis.project.organizationId !== ctx.session.activeOrganizationId) { + if (redis.environment.project.organizationId !== ctx.session.activeOrganizationId) { throw new TRPCError({ code: "UNAUTHORIZED", message: "You are not authorized to access this Redis", @@ -117,7 +117,7 @@ export const redisRouter = createTRPCRouter({ .input(apiFindOneRedis) .mutation(async ({ input, ctx }) => { const redis = await findRedisById(input.redisId); - if (redis.project.organizationId !== ctx.session.activeOrganizationId) { + if (redis.environment.project.organizationId !== ctx.session.activeOrganizationId) { throw new TRPCError({ code: "UNAUTHORIZED", message: "You are not authorized to start this Redis", @@ -139,7 +139,7 @@ export const redisRouter = createTRPCRouter({ .input(apiResetRedis) .mutation(async ({ input, ctx }) => { const redis = await findRedisById(input.redisId); - if (redis.project.organizationId !== ctx.session.activeOrganizationId) { + if (redis.environment.project.organizationId !== ctx.session.activeOrganizationId) { throw new TRPCError({ code: "UNAUTHORIZED", message: "You are not authorized to reload this Redis", @@ -169,7 +169,7 @@ export const redisRouter = createTRPCRouter({ .input(apiFindOneRedis) .mutation(async ({ input, ctx }) => { const redis = await findRedisById(input.redisId); - if (redis.project.organizationId !== ctx.session.activeOrganizationId) { + if (redis.environment.project.organizationId !== ctx.session.activeOrganizationId) { throw new TRPCError({ code: "UNAUTHORIZED", message: "You are not authorized to stop this Redis", @@ -190,7 +190,7 @@ export const redisRouter = createTRPCRouter({ .input(apiSaveExternalPortRedis) .mutation(async ({ input, ctx }) => { const mongo = await findRedisById(input.redisId); - if (mongo.project.organizationId !== ctx.session.activeOrganizationId) { + if (mongo.environment.project.organizationId !== ctx.session.activeOrganizationId) { throw new TRPCError({ code: "UNAUTHORIZED", message: "You are not authorized to save this external port", @@ -206,7 +206,7 @@ export const redisRouter = createTRPCRouter({ .input(apiDeployRedis) .mutation(async ({ input, ctx }) => { const redis = await findRedisById(input.redisId); - if (redis.project.organizationId !== ctx.session.activeOrganizationId) { + if (redis.environment.project.organizationId !== ctx.session.activeOrganizationId) { throw new TRPCError({ code: "UNAUTHORIZED", message: "You are not authorized to deploy this Redis", @@ -226,7 +226,7 @@ export const redisRouter = createTRPCRouter({ .input(apiDeployRedis) .subscription(async ({ input, ctx }) => { const redis = await findRedisById(input.redisId); - if (redis.project.organizationId !== ctx.session.activeOrganizationId) { + if (redis.environment.project.organizationId !== ctx.session.activeOrganizationId) { throw new TRPCError({ code: "UNAUTHORIZED", message: "You are not authorized to deploy this Redis", @@ -242,7 +242,7 @@ export const redisRouter = createTRPCRouter({ .input(apiChangeRedisStatus) .mutation(async ({ input, ctx }) => { const mongo = await findRedisById(input.redisId); - if (mongo.project.organizationId !== ctx.session.activeOrganizationId) { + if (mongo.environment.project.organizationId !== ctx.session.activeOrganizationId) { throw new TRPCError({ code: "UNAUTHORIZED", message: "You are not authorized to change this Redis status", @@ -267,7 +267,7 @@ export const redisRouter = createTRPCRouter({ const redis = await findRedisById(input.redisId); - if (redis.project.organizationId !== ctx.session.activeOrganizationId) { + if (redis.environment.project.organizationId !== ctx.session.activeOrganizationId) { throw new TRPCError({ code: "UNAUTHORIZED", message: "You are not authorized to delete this Redis", @@ -290,7 +290,7 @@ export const redisRouter = createTRPCRouter({ .input(apiSaveEnvironmentVariablesRedis) .mutation(async ({ input, ctx }) => { const redis = await findRedisById(input.redisId); - if (redis.project.organizationId !== ctx.session.activeOrganizationId) { + if (redis.environment.project.organizationId !== ctx.session.activeOrganizationId) { throw new TRPCError({ code: "UNAUTHORIZED", message: "You are not authorized to save this environment", @@ -335,7 +335,7 @@ export const redisRouter = createTRPCRouter({ ) .mutation(async ({ input, ctx }) => { const redis = await findRedisById(input.redisId); - if (redis.project.organizationId !== ctx.session.activeOrganizationId) { + if (redis.environment.project.organizationId !== ctx.session.activeOrganizationId) { throw new TRPCError({ code: "UNAUTHORIZED", message: "You are not authorized to move this redis", @@ -373,7 +373,7 @@ export const redisRouter = createTRPCRouter({ .input(apiRebuildRedis) .mutation(async ({ input, ctx }) => { const redis = await findRedisById(input.redisId); - if (redis.project.organizationId !== ctx.session.activeOrganizationId) { + if (redis.environment.project.organizationId !== ctx.session.activeOrganizationId) { throw new TRPCError({ code: "UNAUTHORIZED", message: "You are not authorized to rebuild this Redis database", diff --git a/packages/server/src/services/redis.ts b/packages/server/src/services/redis.ts index 7b9721cb8..b382cbfd1 100644 --- a/packages/server/src/services/redis.ts +++ b/packages/server/src/services/redis.ts @@ -52,7 +52,11 @@ export const findRedisById = async (redisId: string) => { const result = await db.query.redis.findFirst({ where: eq(redis.redisId, redisId), with: { - project: true, + environment: { + with: { + project: true, + }, + }, mounts: true, server: true, },