Skip to content

Commit

Permalink
bla
Browse files Browse the repository at this point in the history
  • Loading branch information
Marc Gorzala committed Dec 26, 2023
1 parent 8e52c2d commit d6a360f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
5 changes: 2 additions & 3 deletions src/main/java/net/dancier/dancer/core/ProfileService.java
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,10 @@ public void updateProfileForUserId(UUID userId, ProfileOfCurrentUserDto profileO
handleDancerProfiles(dancer, profileOfCurrentUserDto);
dancer.setUpdatedAt(Instant.now());
dancerRepository.save(dancer);
// hack, to retrieve the version, how can I achieve this with less effort?
dancer = dancerRepository.findById(dancer.getId()).get();

log.info("{}/{}", dancer.getVersion(), oldVersion);
if (!dancer.getVersion().equals(oldVersion)) {
// this hould be unequal but it does not work then
if (dancer.getVersion().equals(oldVersion)) {
log.info("Profile-Change detected");
applicationEventPublisher.publishEvent(
ProfileUpdatedEvent
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
package net.dancier.dancer.eventlog.service;

import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import net.dancier.dancer.authentication.model.Role;
import net.dancier.dancer.core.exception.ApplicationException;
import net.dancier.dancer.eventlog.model.Eventlog;
import net.dancier.dancer.eventlog.repository.EventlogDAO;
Expand All @@ -17,8 +21,10 @@ public class EventlogService {

private final EventlogDAO eventlogDAO;

private final static Set ALL_ALLOWED_TOPICS = Set.of("Foo");
private final static Set TOPICS_THAT_REQUIRE_A_USER = Set.of();
private final static Set<String> DEFAULT_AUTHENTICATED = Set.of();
private final static Set<EventlogConfig> allowedEvents = Set.of(
EventlogConfig.of("profile-updated", DEFAULT_AUTHENTICATED)
);

public void appendNew(Eventlog eventlog) {

Expand All @@ -38,4 +44,13 @@ private void authorize(Eventlog eventlog) {
String topic = eventlog.getTopic();
}

@AllArgsConstructor(access = AccessLevel.PRIVATE)
@Getter
private static class EventlogConfig {
public static EventlogConfig of(String name, Set<String> roles) {
return new EventlogConfig(name, roles);
}
private String name;
private Set<String> neededRoles;
}
}

0 comments on commit d6a360f

Please sign in to comment.