@@ -17,11 +17,12 @@ import { ApiReq, userRoles, userStatuses } from 'src/shared/interfaces';
17
17
import { CreateUserDto } from 'src/shared/dtos/create-user.dto' ;
18
18
import { UserChangePasswordDto } from './dto/user-change-password.dto' ;
19
19
import { UserAddPhotoDto } from './dto/user-add-photo.dto' ;
20
+ import { CreateNotificationDto } from './dto/create-notification.dto' ;
20
21
21
22
@ApiTags ( 'users' )
22
23
@Controller ( 'users' )
23
24
export class UsersController {
24
- constructor ( private readonly usersService : UsersService ) { }
25
+ constructor ( private readonly usersService : UsersService ) { }
25
26
26
27
@Post ( )
27
28
create ( @Request ( ) req : ApiReq , @Body ( ) createUserDto : CreateUserDto ) {
@@ -127,4 +128,33 @@ export class UsersController {
127
128
) {
128
129
return this . usersService . requestVerification ( req , userId ) ;
129
130
}
131
+
132
+ @ApiBearerAuth ( )
133
+ @UseGuards ( JwtUsersGuard )
134
+ @Post ( ':userId/create-notification' )
135
+ async createNotification (
136
+ @Param ( 'userId' ) userId : string ,
137
+ @Body ( ) createNotificationDto : CreateNotificationDto ,
138
+
139
+ ) {
140
+ const { message } = createNotificationDto ;
141
+ return this . usersService . createNotification ( userId , message )
142
+ }
143
+
144
+ @ApiBearerAuth ( )
145
+ @UseGuards ( JwtUsersGuard )
146
+ @Get ( ':userId/get-notifications' )
147
+ async getAllNotificationsForUser (
148
+ @Param ( 'userId' ) userId : string
149
+ ) {
150
+ return this . usersService . getAllNotificationsForUser ( userId ) ;
151
+ }
152
+
153
+ @Patch ( ':userId/is-read-notifications/:notificationId' )
154
+ async markNotificationAsRead (
155
+ @Param ( 'userId' ) userId : string ,
156
+ @Param ( 'notificationId' ) notificationId : string ,
157
+ ) {
158
+ return this . usersService . markNotificationAsRead ( userId , notificationId ) ;
159
+ }
130
160
}
0 commit comments