Merge refactor into error-handling + fix merge errors
Co-authored-by: [Mahgs] <maxoerter@gmx.de> Co-authored-by: Christoph <tobi@urpost.de>
This commit is contained in:
@ -1,12 +1,11 @@
|
||||
package mops.gruppen2.controller;
|
||||
|
||||
import mops.gruppen2.config.Gruppen2Config;
|
||||
import mops.gruppen2.domain.Exceptions.EventException;
|
||||
import mops.gruppen2.domain.Exceptions.GroupNotFoundException;
|
||||
import mops.gruppen2.domain.Group;
|
||||
import mops.gruppen2.domain.Role;
|
||||
import mops.gruppen2.domain.User;
|
||||
import mops.gruppen2.domain.exception.EventException;
|
||||
import mops.gruppen2.domain.exception.GroupNotFoundException;
|
||||
import mops.gruppen2.security.Account;
|
||||
import mops.gruppen2.service.ControllerService;
|
||||
import mops.gruppen2.service.CsvService;
|
||||
|
@ -1,10 +0,0 @@
|
||||
package mops.gruppen2.domain.Exceptions;
|
||||
|
||||
import org.springframework.http.HttpStatus;
|
||||
|
||||
public class UserAlreadyExistsException extends EventException {
|
||||
|
||||
public UserAlreadyExistsException(String info) {
|
||||
super(HttpStatus.INTERNAL_SERVER_ERROR, "Der User existiert bereits.", info);
|
||||
}
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
package mops.gruppen2.domain.Exceptions;
|
||||
|
||||
import org.springframework.http.HttpStatus;
|
||||
|
||||
public class UserNotFoundException extends EventException {
|
||||
|
||||
public UserNotFoundException(String info) {
|
||||
super(HttpStatus.NOT_FOUND, "Der User wurde nicht gefunden.", info);
|
||||
}
|
||||
}
|
@ -24,7 +24,7 @@ public class CreateGroupEvent extends Event {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply(Group group) {
|
||||
public void applyEvent(Group group) {
|
||||
group.setId(this.groupId);
|
||||
group.setParent(this.groupParent);
|
||||
group.setType(this.groupType);
|
||||
|
@ -7,6 +7,7 @@ import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import mops.gruppen2.domain.Group;
|
||||
import mops.gruppen2.domain.exception.EventException;
|
||||
import mops.gruppen2.domain.exception.GroupIdMismatchException;
|
||||
|
||||
|
||||
@JsonTypeInfo(
|
||||
@ -37,7 +38,7 @@ public abstract class Event {
|
||||
protected abstract void applyEvent(Group group) throws EventException;
|
||||
|
||||
private void checkGroupIdMatch(Long groupId) {
|
||||
if (groupId == null || this.group_id.equals(groupId)) {
|
||||
if (groupId == null || this.groupId.equals(groupId)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -3,8 +3,8 @@ package mops.gruppen2.domain.event;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import mops.gruppen2.domain.Exceptions.NoValueException;
|
||||
import mops.gruppen2.domain.Group;
|
||||
import mops.gruppen2.domain.exception.NoValueException;
|
||||
|
||||
/**
|
||||
* Ändert nur die Gruppenbeschreibung.
|
||||
|
@ -3,8 +3,8 @@ package mops.gruppen2.domain.event;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import mops.gruppen2.domain.Exceptions.NoValueException;
|
||||
import mops.gruppen2.domain.Group;
|
||||
import mops.gruppen2.domain.exception.NoValueException;
|
||||
|
||||
/**
|
||||
* Ändert nur den Gruppentitel.
|
||||
|
@ -1,4 +1,4 @@
|
||||
package mops.gruppen2.domain.Exceptions;
|
||||
package mops.gruppen2.domain.exception;
|
||||
|
||||
import org.springframework.http.HttpStatus;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
package mops.gruppen2.domain.Exceptions;
|
||||
package mops.gruppen2.domain.exception;
|
||||
|
||||
import org.springframework.http.HttpStatus;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
package mops.gruppen2.domain.Exceptions;
|
||||
package mops.gruppen2.domain.exception;
|
||||
|
||||
import org.springframework.http.HttpStatus;
|
||||
|
||||
|
@ -1,8 +1,10 @@
|
||||
package mops.gruppen2.domain.exception;
|
||||
|
||||
import org.springframework.http.HttpStatus;
|
||||
|
||||
public class UserAlreadyExistsException extends EventException {
|
||||
|
||||
public UserAlreadyExistsException(String msg) {
|
||||
super(msg);
|
||||
public UserAlreadyExistsException(String info) {
|
||||
super(HttpStatus.INTERNAL_SERVER_ERROR, "Der User existiert bereits.", info);
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,10 @@
|
||||
package mops.gruppen2.domain.exception;
|
||||
|
||||
import org.springframework.http.HttpStatus;
|
||||
|
||||
public class UserNotFoundException extends EventException {
|
||||
|
||||
public UserNotFoundException(String msg) {
|
||||
super(msg);
|
||||
public UserNotFoundException(String info) {
|
||||
super(HttpStatus.NOT_FOUND, "Der User wurde nicht gefunden.", info);
|
||||
}
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import mops.gruppen2.domain.Group;
|
||||
import mops.gruppen2.domain.User;
|
||||
import mops.gruppen2.domain.event.Event;
|
||||
import mops.gruppen2.domain.exception.EventException;
|
||||
import mops.gruppen2.domain.exception.GroupNotFoundException;
|
||||
import mops.gruppen2.repository.EventRepository;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@ -39,7 +40,7 @@ public class UserService {
|
||||
|
||||
public Group getGroupById(Long groupId) throws EventException {
|
||||
List<Long> groupIds = new ArrayList<>();
|
||||
group_ids.add(groupId);
|
||||
groupIds.add(groupId);
|
||||
|
||||
try {
|
||||
List<Event> events = groupService.getGroupEvents(groupIds);
|
||||
|
Reference in New Issue
Block a user