Skip to content

Commit

Permalink
Update notification entity implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
hhdqirui committed Feb 10, 2023
1 parent dc2d24c commit 84b2314
Showing 1 changed file with 0 additions and 32 deletions.
32 changes: 0 additions & 32 deletions src/main/java/teammates/storage/sqlentity/Notification.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,31 +64,6 @@ public class Notification extends BaseEntity {
@Column
private Instant updatedAt;

/**
* Instantiates a new notification, with ID randomly generated and time fields filled automatically.
*
* @param startTime start time for the notification to be shown to users
* @param endTime notifications are hidden from users after endTime
* @param style style of the notification (e.g. success, warning, etc.)
* @param targetUser student or instructor
* @param title title of the notification
* @param message message body of the notification
*/
public Notification(Instant startTime, Instant endTime, NotificationStyle style, NotificationTargetUser targetUser,
String title, String message) {
this.setStartTime(startTime);
this.setEndTime(endTime);
this.setStyle(style);
this.setTargetUser(targetUser);
this.setTitle(title);
this.setMessage(message);
this.setCreatedAt(Instant.now());

UUID uuid = UUID.randomUUID();
this.notificationId = uuid.toString();
this.shown = false;
}

/**
* Instantiates a new notification from {@code NotificationBuilder}.
*/
Expand All @@ -99,16 +74,9 @@ public Notification(NotificationBuilder builder) {
this.setTargetUser(builder.targetUser);
this.setTitle(builder.title);
this.setMessage(builder.message);
if (createdAt == null) {
this.setCreatedAt(Instant.now());
} else {
this.setCreatedAt(createdAt);
}
this.setUpdatedAt(updatedAt);
this.notificationId = builder.notificationId;
this.shown = builder.shown;

assert this.createdAt != null;
}

protected Notification() {
Expand Down

0 comments on commit 84b2314

Please sign in to comment.