@@ -38,6 +38,7 @@ import { AllExceptionsFilter } from '../../utils/utils';
3838import { AppError , GetAppList } from '../dtos/fetch-app.dto' ;
3939import { PaginationDto } from 'src/utils/pagination.dto' ;
4040import { TransformResponseInterceptor } from '../interceptors/transformResponse.interseptor' ;
41+ import { UserRole } from 'src/user/schema/user.schema' ;
4142@UseFilters ( AllExceptionsFilter )
4243@ApiTags ( 'Application' )
4344@Controller ( '/api/v1/app' )
@@ -77,10 +78,12 @@ export class AppAuthController {
7778 @Query ( ) pageOption : PaginationDto ,
7879 ) : Promise < App [ ] > {
7980 Logger . log ( 'getApps() method: starts' , 'AppAuthController' ) ;
81+ const userRole = req . user ?. role ?? UserRole . ADMIN ;
8082 const userId = req . user . userId ;
8183 const appList : any = await this . appAuthService . getAllApps (
8284 userId ,
8385 pageOption ,
86+ userRole ,
8487 ) ;
8588 if ( appList . length === 0 ) {
8689 throw new AppNotFoundException ( ) ;
@@ -198,7 +201,7 @@ export class AppAuthController {
198201
199202 const app = await this . appAuthService . getAppById ( appId , userId ) ;
200203 if ( app ) {
201- return this . appAuthService . updateAnApp ( appId , updateAppDto , userId ) ;
204+ return this . appAuthService . updateAnApp ( appId , updateAppDto , req . user ) ;
202205 } else throw new AppNotFoundException ( ) ;
203206 }
204207
0 commit comments