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(
41
41
return false ;
42
42
}
43
43
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';
16
16
import { ServerResponse } from '../utils' ;
17
17
import { StaffGuard } from '@/guards/staff.guard' ;
18
18
import { ApplyUser } from '@/guards/apply-user.guard' ;
19
- import { UserDecorator } from '@/decorators/UserDecorator' ;
19
+ import { UserDecorator } from '@/decorators/UserDecorator/user.decorator ' ;
20
20
21
21
@ApiTags ( 'Abrigos' )
22
22
@Controller ( 'shelters' )
@@ -40,7 +40,9 @@ export class ShelterController {
40
40
@UseGuards ( ApplyUser )
41
41
async show ( @UserDecorator ( ) user : any , @Param ( 'id' ) id : string ) {
42
42
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 ) ;
44
46
return new ServerResponse ( 200 , 'Successfully get shelter' , data ) ;
45
47
} catch ( err : any ) {
46
48
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 {
60
60
} ) ;
61
61
}
62
62
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 ) {
67
64
const data = await this . prismaService . shelter . findFirst ( {
68
65
where : {
69
66
id,
@@ -75,7 +72,7 @@ export class ShelterService {
75
72
pix : true ,
76
73
shelteredPeople : true ,
77
74
capacity : true ,
78
- contact : isLogged ,
75
+ contact : shouldShowContact ,
79
76
petFriendly : true ,
80
77
prioritySum : true ,
81
78
latitude : true ,
You can’t perform that action at this time.
0 commit comments