mirror of
https://github.com/Dokploy/dokploy
synced 2025-06-26 18:27:59 +00:00
feat: init multi server feature
This commit is contained in:
@@ -34,6 +34,7 @@ import {
|
||||
checkProjectAccess,
|
||||
findUserByAuthId,
|
||||
} from "../services/user";
|
||||
import { findAdmin, findAdminByAuthId } from "../services/admin";
|
||||
|
||||
export const projectRouter = createTRPCRouter({
|
||||
create: protectedProcedure
|
||||
@@ -43,7 +44,8 @@ export const projectRouter = createTRPCRouter({
|
||||
if (ctx.user.rol === "user") {
|
||||
await checkProjectAccess(ctx.user.authId, "create");
|
||||
}
|
||||
const project = await createProject(input);
|
||||
|
||||
const project = await createProject(input, ctx.user.adminId);
|
||||
if (ctx.user.rol === "user") {
|
||||
await addNewProject(ctx.user.authId, project.projectId);
|
||||
}
|
||||
@@ -153,6 +155,7 @@ export const projectRouter = createTRPCRouter({
|
||||
|
||||
return query;
|
||||
}
|
||||
|
||||
return await db.query.projects.findMany({
|
||||
with: {
|
||||
applications: true,
|
||||
@@ -163,6 +166,7 @@ export const projectRouter = createTRPCRouter({
|
||||
redis: true,
|
||||
compose: true,
|
||||
},
|
||||
where: eq(projects.adminId, ctx.user.adminId),
|
||||
orderBy: desc(projects.createdAt),
|
||||
});
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user