-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
improve: add user custom config for notification dispatchers
- Loading branch information
Showing
32 changed files
with
947 additions
and
179 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
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
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
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
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
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
63 changes: 63 additions & 0 deletions
63
...mdeluise/plantit/notification/dispatcher/config/AbstractNotificationDispatcherConfig.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,63 @@ | ||
package com.github.mdeluise.plantit.notification.dispatcher.config; | ||
|
||
import com.github.mdeluise.plantit.authentication.User; | ||
import com.github.mdeluise.plantit.notification.dispatcher.NotificationDispatcherName; | ||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.EnumType; | ||
import jakarta.persistence.Enumerated; | ||
import jakarta.persistence.GeneratedValue; | ||
import jakarta.persistence.Id; | ||
import jakarta.persistence.Inheritance; | ||
import jakarta.persistence.InheritanceType; | ||
import jakarta.persistence.JoinColumn; | ||
import jakarta.persistence.ManyToOne; | ||
import jakarta.validation.constraints.NotNull; | ||
|
||
@Entity | ||
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS) | ||
public abstract class AbstractNotificationDispatcherConfig implements NotificationDispatcherConfig { | ||
@Id | ||
@GeneratedValue | ||
private Long id; | ||
@NotNull | ||
@ManyToOne | ||
@JoinColumn(name = "user_id", nullable = false) | ||
private User user; | ||
@NotNull | ||
@Enumerated(EnumType.STRING) | ||
private NotificationDispatcherName service; | ||
|
||
|
||
public Long getId() { | ||
return id; | ||
} | ||
|
||
|
||
public void setId(Long id) { | ||
this.id = id; | ||
} | ||
|
||
|
||
@Override | ||
public User getUser() { | ||
return user; | ||
} | ||
|
||
|
||
@Override | ||
public void setUser(User user) { | ||
this.user = user; | ||
} | ||
|
||
|
||
@Override | ||
public NotificationDispatcherName getServiceName() { | ||
return service; | ||
} | ||
|
||
|
||
@Override | ||
public void setServiceName(NotificationDispatcherName name) { | ||
this.service = name; | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
.../github/mdeluise/plantit/notification/dispatcher/config/NotificationDispatcherConfig.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,16 @@ | ||
package com.github.mdeluise.plantit.notification.dispatcher.config; | ||
|
||
import com.github.mdeluise.plantit.authentication.User; | ||
import com.github.mdeluise.plantit.notification.dispatcher.NotificationDispatcherName; | ||
|
||
public interface NotificationDispatcherConfig { | ||
User getUser(); | ||
|
||
void setUser(User user); | ||
|
||
NotificationDispatcherName getServiceName(); | ||
|
||
void setServiceName(NotificationDispatcherName name); | ||
|
||
void update(NotificationDispatcherConfig updated); | ||
} |
13 changes: 13 additions & 0 deletions
13
...se/plantit/notification/dispatcher/config/NotificationDispatcherConfigImplRepository.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,13 @@ | ||
package com.github.mdeluise.plantit.notification.dispatcher.config; | ||
|
||
import java.util.Optional; | ||
|
||
import com.github.mdeluise.plantit.authentication.User; | ||
import com.github.mdeluise.plantit.notification.dispatcher.NotificationDispatcherName; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.stereotype.Repository; | ||
|
||
@Repository | ||
public interface NotificationDispatcherConfigImplRepository extends JpaRepository<AbstractNotificationDispatcherConfig, Long> { | ||
Optional<AbstractNotificationDispatcherConfig> findByServiceAndUser(NotificationDispatcherName service, User user); | ||
} |
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
Oops, something went wrong.