Skip to content

Commit f8e897d

Browse files
Merge pull request #115 from somiljain2006/development
Delete Notification Added
2 parents 88f56a4 + b0be4b9 commit f8e897d

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/main/java/org/spacehub/controller/Notification/NotificationController.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,4 +90,16 @@ public ResponseEntity<ApiResponse<Long>> getUnreadCount(@RequestBody Notificatio
9090
return ResponseEntity.ok(new ApiResponse<>(200, "Unread count fetched successfully", count));
9191
}
9292

93+
@DeleteMapping("/reference/{referenceId}")
94+
public ResponseEntity<?> deleteByReference(@PathVariable UUID referenceId) {
95+
try {
96+
notificationService.deleteActionableByReference(referenceId);
97+
return ResponseEntity.ok(new ApiResponse<>(200, "Notification deleted", null));
98+
}
99+
catch (Exception e) {
100+
return ResponseEntity.internalServerError()
101+
.body(new ApiResponse<>(500, "Failed to delete: " + e.getMessage(), null));
102+
}
103+
}
104+
93105
}

src/main/resources/application.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ spring.datasource.url=${SPRING_DATASOURCE_URL}
22
spring.datasource.username=${SPRING_DATASOURCE_USERNAME}
33
spring.datasource.password=${SPRING_DATASOURCE_PASSWORD}
44
spring.datasource.driver-class-name=org.postgresql.Driver
5-
spring.jpa.hibernate.ddl-auto=create-drop
5+
spring.jpa.hibernate.ddl-auto=update
66
spring.jpa.show-sql=true
77
spring.jpa.properties.hibernate.format_sql=true
88
server.address=0.0.0.0

0 commit comments

Comments
 (0)