File tree Expand file tree Collapse file tree 2 files changed +6
-1
lines changed
Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Original file line number Diff line number Diff line change 11import { GITHUB_APP_PRIVATE_KEY , GITHUB_APP_WEBHOOK_SECRET } from "@/lib/constants" ;
22import { db } from "@/lib/db" ;
33import { getRepositoryDefaultBranch , getRepositoryReadme } from "@/lib/github/services/repo" ;
4+ import { repositoryCache } from "@/lib/repository/cache" ;
45import { App } from "octokit" ;
56
67export const sendInstallationDetails = async (
@@ -94,6 +95,7 @@ export const sendInstallationDetails = async (
9495 role : "member" ,
9596 } ,
9697 } ) ;
98+ repositoryCache . revalidate ( { userId : newUser . id , id : installationPrisma . id } ) ;
9799 console . log ( `Membership upserted for user: ${ newUser . login } ` ) ;
98100 } )
99101 ) ;
@@ -128,6 +130,7 @@ export const sendInstallationDetails = async (
128130 } ,
129131 } ) ;
130132 console . log ( `Membership upserted for user: ${ newUser . login } ` ) ;
133+ repositoryCache . revalidate ( { userId : newUser . id , id : installationPrisma . id } ) ;
131134 }
132135
133136 if ( repos ) {
Original file line number Diff line number Diff line change @@ -149,6 +149,8 @@ export const fetchRepoDetails = (id: string) =>
149149export const getRepositoriesForUser = ( userId : string ) =>
150150 unstable_cache (
151151 async ( ) : Promise < TRepository [ ] > => {
152+ console . log ( `getRepositoriesForUser called with userId: ${ userId } ` ) ;
153+ console . log ( `Starting database transaction` ) ;
152154 try {
153155 const userRepositories = await db . repository . findMany ( {
154156 where : {
@@ -161,7 +163,7 @@ export const getRepositoriesForUser = (userId: string) =>
161163 } ,
162164 } ,
163165 } ) ;
164-
166+ console . log ( `Database transaction completed successfully` ) ;
165167 return userRepositories as TRepository [ ] ;
166168 } catch ( error ) {
167169 console . error ( `Failed to get repositories for user: ${ error } ` ) ;
You can’t perform that action at this time.
0 commit comments