File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -256,16 +256,6 @@ websitesRouter.get('/', async (c) => {
256256 return c . json ( { success : false , error : "Unauthorized" } , 401 ) ;
257257 }
258258
259- if ( user . role === 'ADMIN' ) {
260- const allWebsites = await db . query . websites . findMany ( {
261- orderBy : ( websites , { desc } ) => [ desc ( websites . createdAt ) ]
262- } ) ;
263- return c . json ( {
264- success : true ,
265- data : allWebsites
266- } ) ;
267- }
268-
269259 try {
270260 const userWebsites = await db . query . websites . findMany ( {
271261 where : eq ( websites . userId , user . id ) ,
@@ -365,6 +355,16 @@ websitesRouter.get('/:id', async (c) => {
365355 }
366356
367357 try {
358+ if ( user . role === 'ADMIN' ) {
359+ const website = await db . query . websites . findFirst ( {
360+ where : eq ( websites . id , id )
361+ } ) ;
362+ return c . json ( {
363+ success : true ,
364+ data : website
365+ } ) ;
366+ }
367+
368368 const projectIds = await getUserProjectIds ( user . id ) ;
369369
370370 const website = await db . query . websites . findFirst ( {
You can’t perform that action at this time.
0 commit comments