feat: Implement notification preferences management for both users and agents.
This commit is contained in:
@@ -133,6 +133,54 @@ export class AgentsController {
|
||||
return this.agentsService.saveFieldValues(userId, dto);
|
||||
}
|
||||
|
||||
// Notification preferences endpoints
|
||||
|
||||
@Get('preferences/notifications')
|
||||
@UseGuards(JwtAuthGuard, RolesGuard)
|
||||
@Roles(UserRole.AGENT)
|
||||
@ApiBearerAuth()
|
||||
@ApiOperation({ summary: 'Get notification preferences (Agents only)' })
|
||||
@ApiResponse({
|
||||
status: 200,
|
||||
description: 'Notification preferences retrieved',
|
||||
schema: {
|
||||
example: {
|
||||
email: {
|
||||
new_leads: true,
|
||||
messages: true,
|
||||
connection_requests: true,
|
||||
property_updates: false,
|
||||
marketing: false,
|
||||
},
|
||||
push: {
|
||||
push_messages: true,
|
||||
push_leads: true,
|
||||
push_reminders: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
async getNotificationPreferences(@CurrentUser('id') userId: string) {
|
||||
return this.agentsService.getNotificationPreferences(userId);
|
||||
}
|
||||
|
||||
@Put('preferences/notifications')
|
||||
@UseGuards(JwtAuthGuard, RolesGuard)
|
||||
@Roles(UserRole.AGENT)
|
||||
@ApiBearerAuth()
|
||||
@ApiOperation({ summary: 'Update notification preferences (Agents only)' })
|
||||
@ApiResponse({ status: 200, description: 'Notification preferences updated' })
|
||||
async updateNotificationPreferences(
|
||||
@CurrentUser('id') userId: string,
|
||||
@Body()
|
||||
data: {
|
||||
email?: Record<string, boolean>;
|
||||
push?: Record<string, boolean>;
|
||||
},
|
||||
) {
|
||||
return this.agentsService.updateNotificationPreferences(userId, data);
|
||||
}
|
||||
|
||||
// Public parameterized routes - MUST come after specific routes like profile/*
|
||||
@Get(':id')
|
||||
@Public()
|
||||
|
||||
Reference in New Issue
Block a user