mirror of
https://github.com/andwati/dokploy.git
synced 2026-10-29 16:22:16 +00:00
refactor: update project structure to use environmentId instead of projectId across components and API routes; implement environment management features
This commit is contained in:
@@ -76,6 +76,7 @@ export const createApplication = async (
|
||||
});
|
||||
}
|
||||
|
||||
console.log("input", input);
|
||||
return await db.transaction(async (tx) => {
|
||||
const newApplication = await tx
|
||||
.insert(applications)
|
||||
@@ -86,6 +87,8 @@ export const createApplication = async (
|
||||
.returning()
|
||||
.then((value) => value[0]);
|
||||
|
||||
console.log("newApplication", newApplication);
|
||||
|
||||
if (!newApplication) {
|
||||
throw new TRPCError({
|
||||
code: "BAD_REQUEST",
|
||||
@@ -105,7 +108,7 @@ export const findApplicationById = async (applicationId: string) => {
|
||||
const application = await db.query.applications.findFirst({
|
||||
where: eq(applications.applicationId, applicationId),
|
||||
with: {
|
||||
project: true,
|
||||
environment: true,
|
||||
domains: true,
|
||||
deployments: true,
|
||||
mounts: true,
|
||||
|
||||
@@ -33,6 +33,16 @@ export const createEnvironment = async (
|
||||
export const findEnvironmentById = async (environmentId: string) => {
|
||||
const environment = await db.query.environments.findFirst({
|
||||
where: eq(environments.environmentId, environmentId),
|
||||
with: {
|
||||
applications: true,
|
||||
mariadb: true,
|
||||
mongo: true,
|
||||
mysql: true,
|
||||
postgres: true,
|
||||
redis: true,
|
||||
compose: true,
|
||||
project: true,
|
||||
},
|
||||
});
|
||||
if (!environment) {
|
||||
throw new TRPCError({
|
||||
|
||||
@@ -99,7 +99,7 @@ export const updateProjectById = async (
|
||||
};
|
||||
|
||||
export const validUniqueServerAppName = async (appName: string) => {
|
||||
const query = await db.query.projects.findMany({
|
||||
const query = await db.query.environments.findMany({
|
||||
with: {
|
||||
applications: {
|
||||
where: eq(applications.appName, appName),
|
||||
|
||||
Reference in New Issue
Block a user