mirror of
https://github.com/andwati/dokploy.git
synced 2026-11-26 13:48:46 +00:00
feat: enhance project and environment services with additional column selections
Updated project and environment services to include specific column selections for various database entities. This improves data retrieval efficiency and allows for more granular control over the returned data structure. Added columns for application, mariadb, mongo, mysql, postgres, redis, and compose entities, as well as enhancements to the environment query structure.
This commit is contained in:
@@ -220,30 +220,55 @@ export const projectRouter = createTRPCRouter({
|
|||||||
accessedServices,
|
accessedServices,
|
||||||
),
|
),
|
||||||
with: { domains: true },
|
with: { domains: true },
|
||||||
|
columns: {
|
||||||
|
applicationId: true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
mariadb: {
|
mariadb: {
|
||||||
where: buildServiceFilter(mariadb.mariadbId, accessedServices),
|
where: buildServiceFilter(mariadb.mariadbId, accessedServices),
|
||||||
|
columns: {
|
||||||
|
mariadbId: true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
mongo: {
|
mongo: {
|
||||||
where: buildServiceFilter(mongo.mongoId, accessedServices),
|
where: buildServiceFilter(mongo.mongoId, accessedServices),
|
||||||
|
columns: {
|
||||||
|
mongoId: true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
mysql: {
|
mysql: {
|
||||||
where: buildServiceFilter(mysql.mysqlId, accessedServices),
|
where: buildServiceFilter(mysql.mysqlId, accessedServices),
|
||||||
|
columns: {
|
||||||
|
mysqlId: true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
postgres: {
|
postgres: {
|
||||||
where: buildServiceFilter(
|
where: buildServiceFilter(
|
||||||
postgres.postgresId,
|
postgres.postgresId,
|
||||||
accessedServices,
|
accessedServices,
|
||||||
),
|
),
|
||||||
|
columns: {
|
||||||
|
postgresId: true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
redis: {
|
redis: {
|
||||||
where: buildServiceFilter(redis.redisId, accessedServices),
|
where: buildServiceFilter(redis.redisId, accessedServices),
|
||||||
|
columns: {
|
||||||
|
redisId: true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
compose: {
|
compose: {
|
||||||
where: buildServiceFilter(compose.composeId, accessedServices),
|
where: buildServiceFilter(compose.composeId, accessedServices),
|
||||||
with: { domains: true },
|
with: { domains: true },
|
||||||
|
columns: {
|
||||||
|
composeId: true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
columns: {
|
||||||
|
environmentId: true,
|
||||||
|
isDefault: true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
orderBy: desc(projects.createdAt),
|
orderBy: desc(projects.createdAt),
|
||||||
@@ -258,18 +283,48 @@ export const projectRouter = createTRPCRouter({
|
|||||||
with: {
|
with: {
|
||||||
domains: true,
|
domains: true,
|
||||||
},
|
},
|
||||||
|
columns: {
|
||||||
|
applicationId: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
mariadb: {
|
||||||
|
columns: {
|
||||||
|
mariadbId: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
mongo: {
|
||||||
|
columns: {
|
||||||
|
mongoId: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
mysql: {
|
||||||
|
columns: {
|
||||||
|
mysqlId: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
postgres: {
|
||||||
|
columns: {
|
||||||
|
postgresId: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
redis: {
|
||||||
|
columns: {
|
||||||
|
redisId: true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
mariadb: true,
|
|
||||||
mongo: true,
|
|
||||||
mysql: true,
|
|
||||||
postgres: true,
|
|
||||||
redis: true,
|
|
||||||
compose: {
|
compose: {
|
||||||
with: {
|
with: {
|
||||||
domains: true,
|
domains: true,
|
||||||
},
|
},
|
||||||
|
columns: {
|
||||||
|
composeId: true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
columns: {
|
||||||
|
environmentId: true,
|
||||||
|
isDefault: true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
where: eq(projects.organizationId, ctx.session.activeOrganizationId),
|
where: eq(projects.organizationId, ctx.session.activeOrganizationId),
|
||||||
|
|||||||
@@ -34,42 +34,134 @@ export const createEnvironment = async (
|
|||||||
export const findEnvironmentById = async (environmentId: string) => {
|
export const findEnvironmentById = async (environmentId: string) => {
|
||||||
const environment = await db.query.environments.findFirst({
|
const environment = await db.query.environments.findFirst({
|
||||||
where: eq(environments.environmentId, environmentId),
|
where: eq(environments.environmentId, environmentId),
|
||||||
|
columns: {
|
||||||
|
name: true,
|
||||||
|
description: true,
|
||||||
|
environmentId: true,
|
||||||
|
isDefault: true,
|
||||||
|
projectId: true,
|
||||||
|
env: true,
|
||||||
|
},
|
||||||
with: {
|
with: {
|
||||||
applications: {
|
applications: {
|
||||||
with: {
|
with: {
|
||||||
deployments: true,
|
server: {
|
||||||
server: true,
|
columns: {
|
||||||
|
name: true,
|
||||||
|
serverId: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
columns: {
|
||||||
|
name: true,
|
||||||
|
applicationId: true,
|
||||||
|
createdAt: true,
|
||||||
|
applicationStatus: true,
|
||||||
|
description: true,
|
||||||
|
serverId: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
mariadb: {
|
mariadb: {
|
||||||
with: {
|
with: {
|
||||||
server: true,
|
server: {
|
||||||
|
columns: {
|
||||||
|
name: true,
|
||||||
|
serverId: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
columns: {
|
||||||
|
mariadbId: true,
|
||||||
|
name: true,
|
||||||
|
createdAt: true,
|
||||||
|
applicationStatus: true,
|
||||||
|
description: true,
|
||||||
|
serverId: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
mongo: {
|
mongo: {
|
||||||
with: {
|
with: {
|
||||||
server: true,
|
server: {
|
||||||
|
columns: {
|
||||||
|
name: true,
|
||||||
|
serverId: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
columns: {
|
||||||
|
mongoId: true,
|
||||||
|
name: true,
|
||||||
|
createdAt: true,
|
||||||
|
applicationStatus: true,
|
||||||
|
description: true,
|
||||||
|
serverId: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
mysql: {
|
mysql: {
|
||||||
with: {
|
with: {
|
||||||
server: true,
|
server: true,
|
||||||
},
|
},
|
||||||
|
columns: {
|
||||||
|
mysqlId: true,
|
||||||
|
name: true,
|
||||||
|
createdAt: true,
|
||||||
|
applicationStatus: true,
|
||||||
|
description: true,
|
||||||
|
serverId: true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
postgres: {
|
postgres: {
|
||||||
with: {
|
with: {
|
||||||
server: true,
|
server: {
|
||||||
|
columns: {
|
||||||
|
name: true,
|
||||||
|
serverId: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
columns: {
|
||||||
|
postgresId: true,
|
||||||
|
name: true,
|
||||||
|
description: true,
|
||||||
|
createdAt: true,
|
||||||
|
applicationStatus: true,
|
||||||
|
serverId: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
redis: {
|
redis: {
|
||||||
with: {
|
with: {
|
||||||
server: true,
|
server: {
|
||||||
|
columns: {
|
||||||
|
name: true,
|
||||||
|
serverId: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
columns: {
|
||||||
|
redisId: true,
|
||||||
|
name: true,
|
||||||
|
createdAt: true,
|
||||||
|
applicationStatus: true,
|
||||||
|
description: true,
|
||||||
|
serverId: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
compose: {
|
compose: {
|
||||||
with: {
|
with: {
|
||||||
deployments: true,
|
server: {
|
||||||
server: true,
|
columns: {
|
||||||
|
name: true,
|
||||||
|
serverId: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
columns: {
|
||||||
|
composeId: true,
|
||||||
|
name: true,
|
||||||
|
createdAt: true,
|
||||||
|
composeStatus: true,
|
||||||
|
description: true,
|
||||||
|
serverId: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
project: true,
|
project: true,
|
||||||
@@ -98,6 +190,12 @@ export const findEnvironmentsByProjectId = async (projectId: string) => {
|
|||||||
compose: true,
|
compose: true,
|
||||||
project: true,
|
project: true,
|
||||||
},
|
},
|
||||||
|
columns: {
|
||||||
|
name: true,
|
||||||
|
description: true,
|
||||||
|
environmentId: true,
|
||||||
|
isDefault: true,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
return projectEnvironments;
|
return projectEnvironments;
|
||||||
};
|
};
|
||||||
@@ -169,6 +267,7 @@ export const duplicateEnvironment = async (
|
|||||||
name: input.name,
|
name: input.name,
|
||||||
description: input.description || originalEnvironment.description,
|
description: input.description || originalEnvironment.description,
|
||||||
projectId: originalEnvironment.projectId,
|
projectId: originalEnvironment.projectId,
|
||||||
|
env: originalEnvironment.env,
|
||||||
})
|
})
|
||||||
.returning()
|
.returning()
|
||||||
.then((value) => value[0]);
|
.then((value) => value[0]);
|
||||||
|
|||||||
Reference in New Issue
Block a user