-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#555 Refactoring some API endpoints in backend.
- Loading branch information
Showing
4 changed files
with
52 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
resq/backend/resq/src/main/java/com/groupa1/resq/converter/NotificationConverter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.groupa1.resq.converter; | ||
|
||
import com.groupa1.resq.dto.NotificationDto; | ||
import com.groupa1.resq.entity.Notification; | ||
import org.springframework.stereotype.Service; | ||
|
||
@Service | ||
public class NotificationConverter { | ||
|
||
public NotificationDto convertToDto(Notification notification) { | ||
NotificationDto notificationDto = new NotificationDto(); | ||
notificationDto.setId(notification.getId()); | ||
notificationDto.setCreatedAt(notification.getCreatedAt()); | ||
notificationDto.setModifiedAt(notification.getModifiedAt()); | ||
notificationDto.setNotificationType(notification.getNotificationType().toString()); | ||
notificationDto.setUserId(notification.getUser().getId()); | ||
notificationDto.setTitle(notification.getTitle()); | ||
notificationDto.setBody(notification.getBody()); | ||
notificationDto.setRead(notification.isRead()); | ||
notificationDto.setRelatedEntityId(notification.getRelatedEntityId()); | ||
notificationDto.setNotificationType(notification.getNotificationType().toString()); | ||
return notificationDto; | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
resq/backend/resq/src/main/java/com/groupa1/resq/dto/NotificationDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.groupa1.resq.dto; | ||
|
||
import lombok.Data; | ||
|
||
import java.time.LocalDateTime; | ||
|
||
@Data | ||
public class NotificationDto { | ||
private Long id; | ||
private LocalDateTime createdAt; | ||
private LocalDateTime modifiedAt; | ||
private Long userId; | ||
private String title; | ||
private String body; | ||
private boolean isRead; | ||
private Long relatedEntityId; | ||
private String notificationType; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters