File tree Expand file tree Collapse file tree
application/general/generic Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -55,7 +55,7 @@ interface Props {
5555
5656export const SaveGitProvider = ( { applicationId } : Props ) => {
5757 const { data, refetch } = api . application . one . useQuery ( { applicationId } ) ;
58- const { data : sshKeys } = api . sshKey . all . useQuery ( ) ;
58+ const { data : sshKeys } = api . sshKey . allForApps . useQuery ( ) ;
5959 const router = useRouter ( ) ;
6060
6161 const { mutateAsync, isPending } =
Original file line number Diff line number Diff line change @@ -55,7 +55,7 @@ interface Props {
5555
5656export const SaveGitProviderCompose = ( { composeId } : Props ) => {
5757 const { data, refetch } = api . compose . one . useQuery ( { composeId } ) ;
58- const { data : sshKeys } = api . sshKey . all . useQuery ( ) ;
58+ const { data : sshKeys } = api . sshKey . allForApps . useQuery ( ) ;
5959 const router = useRouter ( ) ;
6060
6161 const { mutateAsync, isPending } = api . compose . update . useMutation ( ) ;
Original file line number Diff line number Diff line change @@ -8,7 +8,11 @@ import {
88import { db } from "@dokploy/server/db" ;
99import { TRPCError } from "@trpc/server" ;
1010import { desc , eq } from "drizzle-orm" ;
11- import { createTRPCRouter , withPermission } from "@/server/api/trpc" ;
11+ import {
12+ createTRPCRouter ,
13+ protectedProcedure ,
14+ withPermission ,
15+ } from "@/server/api/trpc" ;
1216import { audit } from "@/server/api/utils/audit" ;
1317import {
1418 apiCreateSshKey ,
@@ -83,6 +87,16 @@ export const sshRouter = createTRPCRouter({
8387 orderBy : desc ( sshKeys . createdAt ) ,
8488 } ) ;
8589 } ) ,
90+ allForApps : protectedProcedure . query ( async ( { ctx } ) => {
91+ return await db . query . sshKeys . findMany ( {
92+ columns : {
93+ sshKeyId : true ,
94+ name : true ,
95+ } ,
96+ where : eq ( sshKeys . organizationId , ctx . session . activeOrganizationId ) ,
97+ orderBy : desc ( sshKeys . createdAt ) ,
98+ } ) ;
99+ } ) ,
86100 generate : withPermission ( "sshKeys" , "read" )
87101 . input ( apiGenerateSSHKey )
88102 . mutation ( async ( { input } ) => {
You can’t perform that action at this time.
0 commit comments