File tree Expand file tree Collapse file tree 4 files changed +7
-11
lines changed
Expand file tree Collapse file tree 4 files changed +7
-11
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -41,4 +41,4 @@ async function isRightSessionRole(
4141 return false ;
4242}
4343
44- export { canActivate , isRightSessionRole } ;
44+ export { canActivate } ;
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ import { ShelterService } from './shelter.service';
1616import { ServerResponse } from '../utils' ;
1717import { StaffGuard } from '@/guards/staff.guard' ;
1818import { ApplyUser } from '@/guards/apply-user.guard' ;
19- import { UserDecorator } from '@/decorators/UserDecorator' ;
19+ import { UserDecorator } from '@/decorators/UserDecorator/user.decorator ' ;
2020
2121@ApiTags ( 'Abrigos' )
2222@Controller ( 'shelters' )
@@ -40,7 +40,9 @@ export class ShelterController {
4040 @UseGuards ( ApplyUser )
4141 async show ( @UserDecorator ( ) user : any , @Param ( 'id' ) id : string ) {
4242 try {
43- const data = await this . shelterService . show ( id , user ) ;
43+ const isLogged =
44+ Boolean ( user ) && Boolean ( user ?. sessionId ) && Boolean ( user ?. userId ) ;
45+ const data = await this . shelterService . show ( id , isLogged ) ;
4446 return new ServerResponse ( 200 , 'Successfully get shelter' , data ) ;
4547 } catch ( err : any ) {
4648 this . logger . error ( `Failed to get shelter: ${ err } ` ) ;
Original file line number Diff line number Diff line change @@ -60,10 +60,7 @@ export class ShelterService {
6060 } ) ;
6161 }
6262
63- async show ( id : string , user : any ) {
64- const isLogged =
65- Boolean ( user ) && Boolean ( user ?. sessionId ) && Boolean ( user ?. userId ) ;
66-
63+ async show ( id : string , shouldShowContact : boolean ) {
6764 const data = await this . prismaService . shelter . findFirst ( {
6865 where : {
6966 id,
@@ -75,7 +72,7 @@ export class ShelterService {
7572 pix : true ,
7673 shelteredPeople : true ,
7774 capacity : true ,
78- contact : isLogged ,
75+ contact : shouldShowContact ,
7976 petFriendly : true ,
8077 prioritySum : true ,
8178 latitude : true ,
You can’t perform that action at this time.
0 commit comments