Refactor Notification Management and Enhance Customer Features

- Updated the notification handling logic to utilize a new SDK for sending notifications, improving the flexibility and scalability of the notification system.
- Introduced new methods in the notification service for sending notifications to users and customers based on various target audience types, enhancing the notification delivery capabilities.
- Added a new endpoint to assign companies to a customer, improving customer management functionalities.
- Refactored the customer entity and forms to replace 'CompanyIDs' with 'Companies', ensuring consistency across the data model.
- Enhanced API documentation with Swagger comments for the new endpoint and updated notification structures, ensuring clarity for API consumers.
This commit is contained in:
n.nakhostin
2025-09-20 16:54:51 +03:30
parent d2f7c6a1e5
commit 9037cb5917
18 changed files with 607 additions and 1471 deletions
+18
View File
@@ -23,6 +23,7 @@ type Service interface {
Update(ctx context.Context, id string, form *UpdateUserForm) (*UserResponse, error)
UpdateStatus(ctx context.Context, id string, form *UpdateUserStatusForm) error
GetUserByID(ctx context.Context, userID string) (*UserResponse, error)
GetUsersByIDs(ctx context.Context, userIDs []string) (*UserListResponse, error)
Search(ctx context.Context, form *SearchUsersForm, pagination *response.Pagination) (*UserListResponse, error)
Delete(ctx context.Context, id string) error
@@ -250,6 +251,23 @@ func (s *userService) GetUserByID(ctx context.Context, id string) (*UserResponse
return user.ToResponse(), nil
}
// GetUsersByIDs retrieves users by IDs
func (s *userService) GetUsersByIDs(ctx context.Context, userIDs []string) (*UserListResponse, error) {
users, err := s.repository.GetByIDs(ctx, userIDs)
if err != nil {
return nil, err
}
var userResponses []*UserResponse
for _, user := range users {
userResponses = append(userResponses, user.ToResponse())
}
return &UserListResponse{
Users: userResponses,
}, nil
}
// Search searches users with search and filters
func (s *userService) Search(ctx context.Context, form *SearchUsersForm, pagination *response.Pagination) (*UserListResponse, error) {
// Get users