Merge pull request 'issue-6' (#8) from issue-6 into master
Reviewed-on: Sebastian/TimeManager#8
This commit is contained in:
		
						commit
						566140c226
					
				
							
								
								
									
										10
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								README.md
									
									
									
									
									
								
							@ -1,2 +1,12 @@
 | 
				
			|||||||
# TimeManager
 | 
					# TimeManager
 | 
				
			||||||
 | 
					Template für einen Spring-Angular-Service
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## Generate Angular Client Code with OpenAPI Generator
 | 
				
			||||||
 | 
					1. Install the latest version of "openapi-generator-cli"
 | 
				
			||||||
 | 
					```bash
 | 
				
			||||||
 | 
					npm install @openapitools/openapi-generator-cli -g
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					2. Generate Code
 | 
				
			||||||
 | 
					```bash
 | 
				
			||||||
 | 
					npx @openapitools/openapi-generator-cli generate -i openapi.yaml -g typescript-angular -o frontend/src/api/
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
@ -0,0 +1,81 @@
 | 
				
			|||||||
 | 
					package core.api.controller;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import core.api.models.auth.SimpleStatusResponse;
 | 
				
			||||||
 | 
					import core.api.models.timemanager.taskgroup.TaskgroupEntityInfo;
 | 
				
			||||||
 | 
					import core.api.models.timemanager.taskgroup.TaskgroupFieldInfo;
 | 
				
			||||||
 | 
					import core.entities.timemanager.Taskgroup;
 | 
				
			||||||
 | 
					import core.services.PermissionResult;
 | 
				
			||||||
 | 
					import core.services.ServiceExitCode;
 | 
				
			||||||
 | 
					import core.services.ServiceResult;
 | 
				
			||||||
 | 
					import core.services.TaskgroupService;
 | 
				
			||||||
 | 
					import org.springframework.beans.factory.annotation.Autowired;
 | 
				
			||||||
 | 
					import org.springframework.http.ResponseEntity;
 | 
				
			||||||
 | 
					import org.springframework.security.core.context.SecurityContextHolder;
 | 
				
			||||||
 | 
					import org.springframework.web.bind.annotation.*;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import javax.validation.Valid;
 | 
				
			||||||
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@CrossOrigin(origins = "*", maxAge = 3600)
 | 
				
			||||||
 | 
					@RestController
 | 
				
			||||||
 | 
					@RequestMapping("/api")
 | 
				
			||||||
 | 
					public class TaskgroupController {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private final TaskgroupService taskgroupService;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public TaskgroupController(@Autowired TaskgroupService taskgroupService) {
 | 
				
			||||||
 | 
					        this.taskgroupService = taskgroupService;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @PutMapping("/taskgroups")
 | 
				
			||||||
 | 
					    public ResponseEntity<?> createTaskgroup(@Valid @RequestBody TaskgroupFieldInfo fieldInfo) {
 | 
				
			||||||
 | 
					        String username = SecurityContextHolder.getContext().getAuthentication().getName();
 | 
				
			||||||
 | 
					        ServiceResult<Taskgroup> creationResult = taskgroupService.addTaskgroup(fieldInfo, username);
 | 
				
			||||||
 | 
					        if(creationResult.getExitCode() == ServiceExitCode.OK) {
 | 
				
			||||||
 | 
					            return ResponseEntity.ok(new TaskgroupEntityInfo(creationResult.getResult()));
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            return ResponseEntity.status(409).body(new SimpleStatusResponse("failed"));
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @PostMapping("/taskgroups/{taskgroupID}")
 | 
				
			||||||
 | 
					    public ResponseEntity<?> editTaskgroup(@PathVariable long taskgroupID, @Valid @RequestBody TaskgroupFieldInfo taskgroupFieldInfo) {
 | 
				
			||||||
 | 
					        PermissionResult<Taskgroup> taskgroupPermissionResult = taskgroupService.getTaskgroupByIDAndUsername(taskgroupID, SecurityContextHolder.getContext().getAuthentication().getName());
 | 
				
			||||||
 | 
					        if(!taskgroupPermissionResult.isHasPermissions()) {
 | 
				
			||||||
 | 
					           return ResponseEntity.status(403).body(new SimpleStatusResponse("failed"));
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if(taskgroupPermissionResult.getExitCode() == ServiceExitCode.MISSING_ENTITY) {
 | 
				
			||||||
 | 
					            return ResponseEntity.status(404).body(new SimpleStatusResponse("failed"));
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        ServiceExitCode serviceExitCode = taskgroupService.editTaskgroup(taskgroupPermissionResult.getResult(), taskgroupFieldInfo);
 | 
				
			||||||
 | 
					        if(serviceExitCode == ServiceExitCode.OK) {
 | 
				
			||||||
 | 
					            return ResponseEntity.ok(new SimpleStatusResponse("success"));
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            return ResponseEntity.status(409).body(new SimpleStatusResponse("failed"));
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @DeleteMapping("/taskgroups/{taskgroupID}")
 | 
				
			||||||
 | 
					    public ResponseEntity<?> deleteTaskgroup(@PathVariable long taskgroupID) {
 | 
				
			||||||
 | 
					        PermissionResult<Taskgroup> taskgroupPermissionResult = taskgroupService.getTaskgroupByIDAndUsername(taskgroupID, SecurityContextHolder.getContext().getAuthentication().getName());
 | 
				
			||||||
 | 
					        if (!taskgroupPermissionResult.isHasPermissions()) {
 | 
				
			||||||
 | 
					            return ResponseEntity.status(403).body(new SimpleStatusResponse("failed"));
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if(taskgroupPermissionResult.getExitCode() == ServiceExitCode.MISSING_ENTITY) {
 | 
				
			||||||
 | 
					            return ResponseEntity.status(404).body(new SimpleStatusResponse("failed"));
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        taskgroupService.deleteTaskgroup(taskgroupPermissionResult.getResult());
 | 
				
			||||||
 | 
					        return ResponseEntity.ok(new SimpleStatusResponse("success"));
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @GetMapping("/taskgroups")
 | 
				
			||||||
 | 
					    public ResponseEntity<List<TaskgroupEntityInfo>> listTaskgroupsOfUser() {
 | 
				
			||||||
 | 
					        List<Taskgroup> taskgroups = taskgroupService.getTaskgroupsByUser(SecurityContextHolder.getContext().getAuthentication().getName());
 | 
				
			||||||
 | 
					        List<TaskgroupEntityInfo> taskgroupEntityInfos = taskgroups.stream().map(TaskgroupEntityInfo::new).toList();
 | 
				
			||||||
 | 
					        return ResponseEntity.ok(taskgroupEntityInfos);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -0,0 +1,30 @@
 | 
				
			|||||||
 | 
					package core.api.models.timemanager.taskgroup;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import core.entities.timemanager.Taskgroup;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public class TaskgroupEntityInfo {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private long taskgroupID;
 | 
				
			||||||
 | 
					    private String taskgroupName;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public TaskgroupEntityInfo(Taskgroup taskgroup) {
 | 
				
			||||||
 | 
					        this.taskgroupID = taskgroup.getTaskgroupID();
 | 
				
			||||||
 | 
					        this.taskgroupName = taskgroup.getTaskgroupName();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public long getTaskgroupID() {
 | 
				
			||||||
 | 
					        return taskgroupID;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void setTaskgroupID(long taskgroupID) {
 | 
				
			||||||
 | 
					        this.taskgroupID = taskgroupID;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public String getTaskgroupName() {
 | 
				
			||||||
 | 
					        return taskgroupName;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void setTaskgroupName(String taskgroupName) {
 | 
				
			||||||
 | 
					        this.taskgroupName = taskgroupName;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -0,0 +1,23 @@
 | 
				
			|||||||
 | 
					package core.api.models.timemanager.taskgroup;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.fasterxml.jackson.annotation.JsonProperty;
 | 
				
			||||||
 | 
					import org.hibernate.validator.constraints.Length;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import javax.validation.constraints.Max;
 | 
				
			||||||
 | 
					import javax.validation.constraints.NotBlank;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public class TaskgroupFieldInfo {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @JsonProperty
 | 
				
			||||||
 | 
					    @NotBlank
 | 
				
			||||||
 | 
					    @Length(max = 255)
 | 
				
			||||||
 | 
					    private String name;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public String getName() {
 | 
				
			||||||
 | 
					        return name;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void setName(String name) {
 | 
				
			||||||
 | 
					        this.name = name;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -0,0 +1,55 @@
 | 
				
			|||||||
 | 
					package core.entities.timemanager;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import core.entities.User;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import javax.persistence.*;
 | 
				
			||||||
 | 
					import javax.validation.constraints.NotBlank;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@Entity
 | 
				
			||||||
 | 
					@Table(name= "taskgroups")
 | 
				
			||||||
 | 
					public class Taskgroup {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Id
 | 
				
			||||||
 | 
					    @GeneratedValue(strategy = GenerationType.AUTO)
 | 
				
			||||||
 | 
					    private long taskgroupID;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @NotBlank
 | 
				
			||||||
 | 
					    @Column(name = "name", length = 255)
 | 
				
			||||||
 | 
					    private String taskgroupName;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @OneToOne
 | 
				
			||||||
 | 
					    @JoinColumn(name = "taskgroupuser", nullable = false)
 | 
				
			||||||
 | 
					    private User user;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public Taskgroup(String taskgroupName, User user) {
 | 
				
			||||||
 | 
					        this.taskgroupName = taskgroupName;
 | 
				
			||||||
 | 
					        this.user = user;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public Taskgroup() {
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public long getTaskgroupID() {
 | 
				
			||||||
 | 
					        return taskgroupID;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void setTaskgroupID(long taskgroupID) {
 | 
				
			||||||
 | 
					        this.taskgroupID = taskgroupID;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public String getTaskgroupName() {
 | 
				
			||||||
 | 
					        return taskgroupName;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void setTaskgroupName(String taskgroupName) {
 | 
				
			||||||
 | 
					        this.taskgroupName = taskgroupName;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public User getUser() {
 | 
				
			||||||
 | 
					        return user;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void setUser(User user) {
 | 
				
			||||||
 | 
					        this.user = user;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -0,0 +1,24 @@
 | 
				
			|||||||
 | 
					package core.repositories.timemanager;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import core.entities.User;
 | 
				
			||||||
 | 
					import core.entities.timemanager.Taskgroup;
 | 
				
			||||||
 | 
					import org.springframework.data.jpa.repository.Modifying;
 | 
				
			||||||
 | 
					import org.springframework.data.jpa.repository.Query;
 | 
				
			||||||
 | 
					import org.springframework.data.repository.CrudRepository;
 | 
				
			||||||
 | 
					import org.springframework.stereotype.Repository;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import javax.transaction.Transactional;
 | 
				
			||||||
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@Repository
 | 
				
			||||||
 | 
					public interface TaskgroupRepository extends CrudRepository<Taskgroup, Long> {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    boolean existsByTaskgroupNameAndUser(String name, User user);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Query("SELECT tg FROM Taskgroup tg WHERE tg.user.username = ?1")
 | 
				
			||||||
 | 
					    List<Taskgroup> findAllByUser(String username);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Modifying
 | 
				
			||||||
 | 
					    @Transactional
 | 
				
			||||||
 | 
					    void deleteAllByUser(User user);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -1,2 +0,0 @@
 | 
				
			|||||||
package core.services;public class InvalidConfigurationException {
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
							
								
								
									
										40
									
								
								backend/src/main/java/core/services/PermissionResult.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										40
									
								
								backend/src/main/java/core/services/PermissionResult.java
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,40 @@
 | 
				
			|||||||
 | 
					package core.services;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public class PermissionResult <T> extends ServiceResult<T> {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private boolean hasPermissions;
 | 
				
			||||||
 | 
					    public PermissionResult(ServiceExitCode exitCode, T result) {
 | 
				
			||||||
 | 
					        super(exitCode, result);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public PermissionResult(T result) {
 | 
				
			||||||
 | 
					        super(result);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public PermissionResult(ServiceExitCode exitCode) {
 | 
				
			||||||
 | 
					        super(exitCode);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public PermissionResult(ServiceExitCode exitCode, T result, boolean hasPermissions) {
 | 
				
			||||||
 | 
					        super(exitCode, result);
 | 
				
			||||||
 | 
					        this.hasPermissions = hasPermissions;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public PermissionResult(T result, boolean hasPermissions) {
 | 
				
			||||||
 | 
					        super(result);
 | 
				
			||||||
 | 
					        this.hasPermissions = hasPermissions;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public PermissionResult(ServiceExitCode exitCode, boolean hasPermissions) {
 | 
				
			||||||
 | 
					        super(exitCode);
 | 
				
			||||||
 | 
					        this.hasPermissions = hasPermissions;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public boolean isHasPermissions() {
 | 
				
			||||||
 | 
					        return hasPermissions;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void setHasPermissions(boolean hasPermissions) {
 | 
				
			||||||
 | 
					        this.hasPermissions = hasPermissions;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -1,14 +1,54 @@
 | 
				
			|||||||
package core.services;
 | 
					package core.services;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import core.api.models.properties.PropertyInfo;
 | 
					import core.api.models.properties.PropertyInfo;
 | 
				
			||||||
 | 
					import core.entities.PropertiesEntity;
 | 
				
			||||||
import core.repositories.PropertyRepository;
 | 
					import core.repositories.PropertyRepository;
 | 
				
			||||||
import org.springframework.beans.factory.annotation.Autowired;
 | 
					import org.springframework.beans.factory.annotation.Autowired;
 | 
				
			||||||
 | 
					import org.springframework.beans.factory.parsing.PropertyEntry;
 | 
				
			||||||
import org.springframework.stereotype.Service;
 | 
					import org.springframework.stereotype.Service;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.util.Optional;
 | 
					import java.util.Optional;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@Service
 | 
				
			||||||
public class PropertyService {
 | 
					public class PropertyService {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Autowired
 | 
				
			||||||
 | 
					    private PropertyRepository propertyRepository;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void init() {
 | 
				
			||||||
 | 
					        PropertiesEntity registrationEntity = new PropertiesEntity(PropertyName.REGISTRATION_PROPERTY_NAME.name(), true);
 | 
				
			||||||
 | 
					        if(!propertyRepository.existsByName(registrationEntity.getName())) {
 | 
				
			||||||
 | 
					            propertyRepository.save(registrationEntity);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public Optional<PropertyInfo> getProperty(PropertyName propertyName) {
 | 
				
			||||||
 | 
					        Optional<PropertiesEntity> property = propertyRepository.findByName(propertyName.name());
 | 
				
			||||||
 | 
					        return property.map(PropertyInfo::new);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public Optional<PropertiesEntity> getPropertyEntityByName(String name) {
 | 
				
			||||||
 | 
					        return propertyRepository.findByName(name);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public boolean isPropertyEnabled(PropertyName propertyName) {
 | 
				
			||||||
 | 
					        Optional<PropertiesEntity> property = propertyRepository.findByName(propertyName.name());
 | 
				
			||||||
 | 
					        return property.map(PropertiesEntity::isStatus).orElseGet(() -> getDefaultBehaivior(propertyName));
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public boolean getDefaultBehaivior(PropertyName propertyName) {
 | 
				
			||||||
 | 
					        return switch (propertyName) {
 | 
				
			||||||
 | 
					            case REGISTRATION_PROPERTY_NAME -> true;
 | 
				
			||||||
 | 
					        };
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void savePropertyEntity(PropertiesEntity property) {
 | 
				
			||||||
 | 
					        propertyRepository.save(property);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public enum PropertyName {
 | 
				
			||||||
 | 
					        REGISTRATION_PROPERTY_NAME
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										8
									
								
								backend/src/main/java/core/services/ServiceExitCode.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								backend/src/main/java/core/services/ServiceExitCode.java
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,8 @@
 | 
				
			|||||||
 | 
					package core.services;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public enum ServiceExitCode {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    OK,
 | 
				
			||||||
 | 
					    ENTITY_ALREADY_EXIST,
 | 
				
			||||||
 | 
					    MISSING_ENTITY;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										37
									
								
								backend/src/main/java/core/services/ServiceResult.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								backend/src/main/java/core/services/ServiceResult.java
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,37 @@
 | 
				
			|||||||
 | 
					package core.services;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public class ServiceResult <T> {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private ServiceExitCode exitCode;
 | 
				
			||||||
 | 
					    private T result;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public ServiceResult(ServiceExitCode exitCode, T result) {
 | 
				
			||||||
 | 
					        this.exitCode = exitCode;
 | 
				
			||||||
 | 
					        this.result = result;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public ServiceResult(T result) {
 | 
				
			||||||
 | 
					        this.result = result;
 | 
				
			||||||
 | 
					        this.exitCode = ServiceExitCode.OK;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public ServiceResult(ServiceExitCode exitCode) {
 | 
				
			||||||
 | 
					        this.exitCode = exitCode;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public ServiceExitCode getExitCode() {
 | 
				
			||||||
 | 
					        return exitCode;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void setExitCode(ServiceExitCode exitCode) {
 | 
				
			||||||
 | 
					        this.exitCode = exitCode;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public T getResult() {
 | 
				
			||||||
 | 
					        return result;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void setResult(T result) {
 | 
				
			||||||
 | 
					        this.result = result;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										78
									
								
								backend/src/main/java/core/services/TaskgroupService.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										78
									
								
								backend/src/main/java/core/services/TaskgroupService.java
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,78 @@
 | 
				
			|||||||
 | 
					package core.services;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import core.api.models.timemanager.taskgroup.TaskgroupEntityInfo;
 | 
				
			||||||
 | 
					import core.api.models.timemanager.taskgroup.TaskgroupFieldInfo;
 | 
				
			||||||
 | 
					import core.entities.User;
 | 
				
			||||||
 | 
					import core.entities.UserRole;
 | 
				
			||||||
 | 
					import core.entities.timemanager.Taskgroup;
 | 
				
			||||||
 | 
					import core.repositories.UserRepository;
 | 
				
			||||||
 | 
					import core.repositories.timemanager.TaskgroupRepository;
 | 
				
			||||||
 | 
					import org.springframework.beans.factory.annotation.Autowired;
 | 
				
			||||||
 | 
					import org.springframework.scheduling.config.Task;
 | 
				
			||||||
 | 
					import org.springframework.security.core.parameters.P;
 | 
				
			||||||
 | 
					import org.springframework.stereotype.Service;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					import java.util.NoSuchElementException;
 | 
				
			||||||
 | 
					import java.util.Optional;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@Service
 | 
				
			||||||
 | 
					public class TaskgroupService {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private final TaskgroupRepository taskgroupRepository;
 | 
				
			||||||
 | 
					    private final UserRepository userRepository;
 | 
				
			||||||
 | 
					    public TaskgroupService(@Autowired  TaskgroupRepository taskgroupRepository,
 | 
				
			||||||
 | 
					                            @Autowired UserRepository userRepository) {
 | 
				
			||||||
 | 
					        this.taskgroupRepository = taskgroupRepository;
 | 
				
			||||||
 | 
					        this.userRepository = userRepository;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public PermissionResult<Taskgroup> getTaskgroupByIDAndUsername(long taskgroupID, String username) {
 | 
				
			||||||
 | 
					        Optional<Taskgroup> taskgroup = taskgroupRepository.findById(taskgroupID);
 | 
				
			||||||
 | 
					        return taskgroup.map(value -> new PermissionResult<>(value, value.getUser().getUsername().equals(username))).orElseGet(() ->
 | 
				
			||||||
 | 
					                new PermissionResult<>(ServiceExitCode.MISSING_ENTITY));
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public ServiceResult<Taskgroup> addTaskgroup(TaskgroupFieldInfo taskData, String username) {
 | 
				
			||||||
 | 
					        Optional<User> user = userRepository.findByUsername(username);
 | 
				
			||||||
 | 
					        if(user.isEmpty()) {
 | 
				
			||||||
 | 
					            throw new NoSuchElementException();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if(!taskgroupRepository.existsByTaskgroupNameAndUser(taskData.getName(), user.get())) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            Taskgroup taskgroup = new Taskgroup(taskData.getName(), user.get());
 | 
				
			||||||
 | 
					            taskgroupRepository.save(taskgroup);
 | 
				
			||||||
 | 
					            return new ServiceResult<>(taskgroup);
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            return new ServiceResult<>(ServiceExitCode.ENTITY_ALREADY_EXIST);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public ServiceExitCode editTaskgroup(Taskgroup taskgroup, TaskgroupFieldInfo taskgroupFieldInfo) {
 | 
				
			||||||
 | 
					        if(!taskgroup.getTaskgroupName().equals(taskgroupFieldInfo.getName())) {
 | 
				
			||||||
 | 
					            //Check if another taskgroup with the new name is already existent for the user of the taskgroup
 | 
				
			||||||
 | 
					            if(!taskgroupRepository.existsByTaskgroupNameAndUser(taskgroupFieldInfo.getName(), taskgroup.getUser())) {
 | 
				
			||||||
 | 
					                taskgroup.setTaskgroupName(taskgroupFieldInfo.getName());
 | 
				
			||||||
 | 
					                taskgroupRepository.save(taskgroup);
 | 
				
			||||||
 | 
					                return ServiceExitCode.OK;
 | 
				
			||||||
 | 
					            } else {
 | 
				
			||||||
 | 
					                return ServiceExitCode.ENTITY_ALREADY_EXIST;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            return ServiceExitCode.OK;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void deleteTaskgroup(Taskgroup taskgroup) {
 | 
				
			||||||
 | 
					        taskgroupRepository.delete(taskgroup);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public List<Taskgroup> getTaskgroupsByUser(String username) {
 | 
				
			||||||
 | 
					        return taskgroupRepository.findAllByUser(username);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void deleteTaskgroupByUser(User user) {
 | 
				
			||||||
 | 
					        taskgroupRepository.deleteAllByUser(user);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -9,6 +9,7 @@ import core.api.models.users.UserUpdateInfo;
 | 
				
			|||||||
import core.entities.RoleEntity;
 | 
					import core.entities.RoleEntity;
 | 
				
			||||||
import core.entities.User;
 | 
					import core.entities.User;
 | 
				
			||||||
import core.entities.UserRole;
 | 
					import core.entities.UserRole;
 | 
				
			||||||
 | 
					import core.entities.timemanager.Taskgroup;
 | 
				
			||||||
import core.repositories.RoleRepository;
 | 
					import core.repositories.RoleRepository;
 | 
				
			||||||
import core.repositories.UserRepository;
 | 
					import core.repositories.UserRepository;
 | 
				
			||||||
import org.springframework.beans.factory.annotation.Autowired;
 | 
					import org.springframework.beans.factory.annotation.Autowired;
 | 
				
			||||||
@ -29,6 +30,7 @@ public class UserService {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    @Autowired
 | 
					    @Autowired
 | 
				
			||||||
    private RoleRepository roleRepository;
 | 
					    private RoleRepository roleRepository;
 | 
				
			||||||
 | 
					    @Autowired private TaskgroupService taskgroupService;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public List<UserInfo> getAllUserInfos() {
 | 
					    public List<UserInfo> getAllUserInfos() {
 | 
				
			||||||
        Iterable<User> users = userRepository.findAll();
 | 
					        Iterable<User> users = userRepository.findAll();
 | 
				
			||||||
@ -146,6 +148,7 @@ public class UserService {
 | 
				
			|||||||
            return 2;
 | 
					            return 2;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        taskgroupService.deleteTaskgroupByUser(requestedUser.get());
 | 
				
			||||||
        userRepository.deleteByUsername(username);
 | 
					        userRepository.deleteByUsername(username);
 | 
				
			||||||
        return 0;
 | 
					        return 0;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
@ -5,6 +5,7 @@ api/account.service.ts
 | 
				
			|||||||
api/api.ts
 | 
					api/api.ts
 | 
				
			||||||
api/login.service.ts
 | 
					api/login.service.ts
 | 
				
			||||||
api/properties.service.ts
 | 
					api/properties.service.ts
 | 
				
			||||||
 | 
					api/taskgroup.service.ts
 | 
				
			||||||
api/users.service.ts
 | 
					api/users.service.ts
 | 
				
			||||||
configuration.ts
 | 
					configuration.ts
 | 
				
			||||||
encoder.ts
 | 
					encoder.ts
 | 
				
			||||||
@ -24,6 +25,8 @@ model/propertiesInfo.ts
 | 
				
			|||||||
model/propertyInfo.ts
 | 
					model/propertyInfo.ts
 | 
				
			||||||
model/propertyUpdateRequest.ts
 | 
					model/propertyUpdateRequest.ts
 | 
				
			||||||
model/signUpRequest.ts
 | 
					model/signUpRequest.ts
 | 
				
			||||||
 | 
					model/taskgroupEntityInfo.ts
 | 
				
			||||||
 | 
					model/taskgroupFieldInfo.ts
 | 
				
			||||||
model/userAddInfo.ts
 | 
					model/userAddInfo.ts
 | 
				
			||||||
model/userInfo.ts
 | 
					model/userInfo.ts
 | 
				
			||||||
model/userUpdateInfo.ts
 | 
					model/userUpdateInfo.ts
 | 
				
			||||||
 | 
				
			|||||||
@ -5,6 +5,7 @@ import { HttpClient } from '@angular/common/http';
 | 
				
			|||||||
import { AccountService } from './api/account.service';
 | 
					import { AccountService } from './api/account.service';
 | 
				
			||||||
import { LoginService } from './api/login.service';
 | 
					import { LoginService } from './api/login.service';
 | 
				
			||||||
import { PropertiesService } from './api/properties.service';
 | 
					import { PropertiesService } from './api/properties.service';
 | 
				
			||||||
 | 
					import { TaskgroupService } from './api/taskgroup.service';
 | 
				
			||||||
import { UsersService } from './api/users.service';
 | 
					import { UsersService } from './api/users.service';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@NgModule({
 | 
					@NgModule({
 | 
				
			||||||
 | 
				
			|||||||
@ -4,6 +4,8 @@ export * from './login.service';
 | 
				
			|||||||
import { LoginService } from './login.service';
 | 
					import { LoginService } from './login.service';
 | 
				
			||||||
export * from './properties.service';
 | 
					export * from './properties.service';
 | 
				
			||||||
import { PropertiesService } from './properties.service';
 | 
					import { PropertiesService } from './properties.service';
 | 
				
			||||||
 | 
					export * from './taskgroup.service';
 | 
				
			||||||
 | 
					import { TaskgroupService } from './taskgroup.service';
 | 
				
			||||||
export * from './users.service';
 | 
					export * from './users.service';
 | 
				
			||||||
import { UsersService } from './users.service';
 | 
					import { UsersService } from './users.service';
 | 
				
			||||||
export const APIS = [AccountService, LoginService, PropertiesService, UsersService];
 | 
					export const APIS = [AccountService, LoginService, PropertiesService, TaskgroupService, UsersService];
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										341
									
								
								frontend/src/api/api/taskgroup.service.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										341
									
								
								frontend/src/api/api/taskgroup.service.ts
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,341 @@
 | 
				
			|||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * API Title
 | 
				
			||||||
 | 
					 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * The version of the OpenAPI document: 1.0
 | 
				
			||||||
 | 
					 * 
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 | 
				
			||||||
 | 
					 * https://openapi-generator.tech
 | 
				
			||||||
 | 
					 * Do not edit the class manually.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					/* tslint:disable:no-unused-variable member-ordering */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import { Inject, Injectable, Optional }                      from '@angular/core';
 | 
				
			||||||
 | 
					import { HttpClient, HttpHeaders, HttpParams,
 | 
				
			||||||
 | 
					         HttpResponse, HttpEvent, HttpParameterCodec, HttpContext 
 | 
				
			||||||
 | 
					        }       from '@angular/common/http';
 | 
				
			||||||
 | 
					import { CustomHttpParameterCodec }                          from '../encoder';
 | 
				
			||||||
 | 
					import { Observable }                                        from 'rxjs';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import { InlineResponse200 } from '../model/models';
 | 
				
			||||||
 | 
					import { InlineResponse403 } from '../model/models';
 | 
				
			||||||
 | 
					import { TaskgroupEntityInfo } from '../model/models';
 | 
				
			||||||
 | 
					import { TaskgroupFieldInfo } from '../model/models';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import { BASE_PATH, COLLECTION_FORMATS }                     from '../variables';
 | 
				
			||||||
 | 
					import { Configuration }                                     from '../configuration';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@Injectable({
 | 
				
			||||||
 | 
					  providedIn: 'root'
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					export class TaskgroupService {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    protected basePath = 'http://localhost:8080/api';
 | 
				
			||||||
 | 
					    public defaultHeaders = new HttpHeaders();
 | 
				
			||||||
 | 
					    public configuration = new Configuration();
 | 
				
			||||||
 | 
					    public encoder: HttpParameterCodec;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
 | 
				
			||||||
 | 
					        if (configuration) {
 | 
				
			||||||
 | 
					            this.configuration = configuration;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        if (typeof this.configuration.basePath !== 'string') {
 | 
				
			||||||
 | 
					            if (typeof basePath !== 'string') {
 | 
				
			||||||
 | 
					                basePath = this.basePath;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            this.configuration.basePath = basePath;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams {
 | 
				
			||||||
 | 
					        if (typeof value === "object" && value instanceof Date === false) {
 | 
				
			||||||
 | 
					            httpParams = this.addToHttpParamsRecursive(httpParams, value);
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            httpParams = this.addToHttpParamsRecursive(httpParams, value, key);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        return httpParams;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams {
 | 
				
			||||||
 | 
					        if (value == null) {
 | 
				
			||||||
 | 
					            return httpParams;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (typeof value === "object") {
 | 
				
			||||||
 | 
					            if (Array.isArray(value)) {
 | 
				
			||||||
 | 
					                (value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
 | 
				
			||||||
 | 
					            } else if (value instanceof Date) {
 | 
				
			||||||
 | 
					                if (key != null) {
 | 
				
			||||||
 | 
					                    httpParams = httpParams.append(key,
 | 
				
			||||||
 | 
					                        (value as Date).toISOString().substr(0, 10));
 | 
				
			||||||
 | 
					                } else {
 | 
				
			||||||
 | 
					                   throw Error("key may not be null if value is Date");
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            } else {
 | 
				
			||||||
 | 
					                Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive(
 | 
				
			||||||
 | 
					                    httpParams, value[k], key != null ? `${key}.${k}` : k));
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        } else if (key != null) {
 | 
				
			||||||
 | 
					            httpParams = httpParams.append(key, value);
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            throw Error("key may not be null if value is not object or array");
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        return httpParams;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * list all taskgroups of authorized user
 | 
				
			||||||
 | 
					     * list all taskgroups of authorized user
 | 
				
			||||||
 | 
					     * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
 | 
				
			||||||
 | 
					     * @param reportProgress flag to report request and response progress.
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public taskgroupsGet(observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<Array<TaskgroupEntityInfo>>;
 | 
				
			||||||
 | 
					    public taskgroupsGet(observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpResponse<Array<TaskgroupEntityInfo>>>;
 | 
				
			||||||
 | 
					    public taskgroupsGet(observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpEvent<Array<TaskgroupEntityInfo>>>;
 | 
				
			||||||
 | 
					    public taskgroupsGet(observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<any> {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        let localVarHeaders = this.defaultHeaders;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        let localVarCredential: string | undefined;
 | 
				
			||||||
 | 
					        // authentication (API_TOKEN) required
 | 
				
			||||||
 | 
					        localVarCredential = this.configuration.lookupCredential('API_TOKEN');
 | 
				
			||||||
 | 
					        if (localVarCredential) {
 | 
				
			||||||
 | 
					            localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
 | 
				
			||||||
 | 
					        if (localVarHttpHeaderAcceptSelected === undefined) {
 | 
				
			||||||
 | 
					            // to determine the Accept header
 | 
				
			||||||
 | 
					            const httpHeaderAccepts: string[] = [
 | 
				
			||||||
 | 
					                'application/json'
 | 
				
			||||||
 | 
					            ];
 | 
				
			||||||
 | 
					            localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        if (localVarHttpHeaderAcceptSelected !== undefined) {
 | 
				
			||||||
 | 
					            localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        let localVarHttpContext: HttpContext | undefined = options && options.context;
 | 
				
			||||||
 | 
					        if (localVarHttpContext === undefined) {
 | 
				
			||||||
 | 
					            localVarHttpContext = new HttpContext();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        let responseType_: 'text' | 'json' = 'json';
 | 
				
			||||||
 | 
					        if(localVarHttpHeaderAcceptSelected && localVarHttpHeaderAcceptSelected.startsWith('text')) {
 | 
				
			||||||
 | 
					            responseType_ = 'text';
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        return this.httpClient.get<Array<TaskgroupEntityInfo>>(`${this.configuration.basePath}/taskgroups`,
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                context: localVarHttpContext,
 | 
				
			||||||
 | 
					                responseType: <any>responseType_,
 | 
				
			||||||
 | 
					                withCredentials: this.configuration.withCredentials,
 | 
				
			||||||
 | 
					                headers: localVarHeaders,
 | 
				
			||||||
 | 
					                observe: observe,
 | 
				
			||||||
 | 
					                reportProgress: reportProgress
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        );
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * creates taskgroup
 | 
				
			||||||
 | 
					     * creates taskgroup
 | 
				
			||||||
 | 
					     * @param taskgroupFieldInfo 
 | 
				
			||||||
 | 
					     * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
 | 
				
			||||||
 | 
					     * @param reportProgress flag to report request and response progress.
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public taskgroupsPut(taskgroupFieldInfo?: TaskgroupFieldInfo, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<TaskgroupEntityInfo>;
 | 
				
			||||||
 | 
					    public taskgroupsPut(taskgroupFieldInfo?: TaskgroupFieldInfo, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpResponse<TaskgroupEntityInfo>>;
 | 
				
			||||||
 | 
					    public taskgroupsPut(taskgroupFieldInfo?: TaskgroupFieldInfo, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpEvent<TaskgroupEntityInfo>>;
 | 
				
			||||||
 | 
					    public taskgroupsPut(taskgroupFieldInfo?: TaskgroupFieldInfo, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<any> {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        let localVarHeaders = this.defaultHeaders;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        let localVarCredential: string | undefined;
 | 
				
			||||||
 | 
					        // authentication (API_TOKEN) required
 | 
				
			||||||
 | 
					        localVarCredential = this.configuration.lookupCredential('API_TOKEN');
 | 
				
			||||||
 | 
					        if (localVarCredential) {
 | 
				
			||||||
 | 
					            localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
 | 
				
			||||||
 | 
					        if (localVarHttpHeaderAcceptSelected === undefined) {
 | 
				
			||||||
 | 
					            // to determine the Accept header
 | 
				
			||||||
 | 
					            const httpHeaderAccepts: string[] = [
 | 
				
			||||||
 | 
					                'application/json'
 | 
				
			||||||
 | 
					            ];
 | 
				
			||||||
 | 
					            localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        if (localVarHttpHeaderAcceptSelected !== undefined) {
 | 
				
			||||||
 | 
					            localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        let localVarHttpContext: HttpContext | undefined = options && options.context;
 | 
				
			||||||
 | 
					        if (localVarHttpContext === undefined) {
 | 
				
			||||||
 | 
					            localVarHttpContext = new HttpContext();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // to determine the Content-Type header
 | 
				
			||||||
 | 
					        const consumes: string[] = [
 | 
				
			||||||
 | 
					            'application/json'
 | 
				
			||||||
 | 
					        ];
 | 
				
			||||||
 | 
					        const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes);
 | 
				
			||||||
 | 
					        if (httpContentTypeSelected !== undefined) {
 | 
				
			||||||
 | 
					            localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        let responseType_: 'text' | 'json' = 'json';
 | 
				
			||||||
 | 
					        if(localVarHttpHeaderAcceptSelected && localVarHttpHeaderAcceptSelected.startsWith('text')) {
 | 
				
			||||||
 | 
					            responseType_ = 'text';
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        return this.httpClient.put<TaskgroupEntityInfo>(`${this.configuration.basePath}/taskgroups`,
 | 
				
			||||||
 | 
					            taskgroupFieldInfo,
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                context: localVarHttpContext,
 | 
				
			||||||
 | 
					                responseType: <any>responseType_,
 | 
				
			||||||
 | 
					                withCredentials: this.configuration.withCredentials,
 | 
				
			||||||
 | 
					                headers: localVarHeaders,
 | 
				
			||||||
 | 
					                observe: observe,
 | 
				
			||||||
 | 
					                reportProgress: reportProgress
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        );
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * deletes taskgroup
 | 
				
			||||||
 | 
					     * deletes taskgroup
 | 
				
			||||||
 | 
					     * @param taskgroupID internal id of taskgroup
 | 
				
			||||||
 | 
					     * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
 | 
				
			||||||
 | 
					     * @param reportProgress flag to report request and response progress.
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public taskgroupsTaskgroupIDDelete(taskgroupID: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<InlineResponse200>;
 | 
				
			||||||
 | 
					    public taskgroupsTaskgroupIDDelete(taskgroupID: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpResponse<InlineResponse200>>;
 | 
				
			||||||
 | 
					    public taskgroupsTaskgroupIDDelete(taskgroupID: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpEvent<InlineResponse200>>;
 | 
				
			||||||
 | 
					    public taskgroupsTaskgroupIDDelete(taskgroupID: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<any> {
 | 
				
			||||||
 | 
					        if (taskgroupID === null || taskgroupID === undefined) {
 | 
				
			||||||
 | 
					            throw new Error('Required parameter taskgroupID was null or undefined when calling taskgroupsTaskgroupIDDelete.');
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        let localVarHeaders = this.defaultHeaders;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        let localVarCredential: string | undefined;
 | 
				
			||||||
 | 
					        // authentication (API_TOKEN) required
 | 
				
			||||||
 | 
					        localVarCredential = this.configuration.lookupCredential('API_TOKEN');
 | 
				
			||||||
 | 
					        if (localVarCredential) {
 | 
				
			||||||
 | 
					            localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
 | 
				
			||||||
 | 
					        if (localVarHttpHeaderAcceptSelected === undefined) {
 | 
				
			||||||
 | 
					            // to determine the Accept header
 | 
				
			||||||
 | 
					            const httpHeaderAccepts: string[] = [
 | 
				
			||||||
 | 
					                'application/json'
 | 
				
			||||||
 | 
					            ];
 | 
				
			||||||
 | 
					            localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        if (localVarHttpHeaderAcceptSelected !== undefined) {
 | 
				
			||||||
 | 
					            localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        let localVarHttpContext: HttpContext | undefined = options && options.context;
 | 
				
			||||||
 | 
					        if (localVarHttpContext === undefined) {
 | 
				
			||||||
 | 
					            localVarHttpContext = new HttpContext();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        let responseType_: 'text' | 'json' = 'json';
 | 
				
			||||||
 | 
					        if(localVarHttpHeaderAcceptSelected && localVarHttpHeaderAcceptSelected.startsWith('text')) {
 | 
				
			||||||
 | 
					            responseType_ = 'text';
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        return this.httpClient.delete<InlineResponse200>(`${this.configuration.basePath}/taskgroups/${encodeURIComponent(String(taskgroupID))}`,
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                context: localVarHttpContext,
 | 
				
			||||||
 | 
					                responseType: <any>responseType_,
 | 
				
			||||||
 | 
					                withCredentials: this.configuration.withCredentials,
 | 
				
			||||||
 | 
					                headers: localVarHeaders,
 | 
				
			||||||
 | 
					                observe: observe,
 | 
				
			||||||
 | 
					                reportProgress: reportProgress
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        );
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * edits taskgroup
 | 
				
			||||||
 | 
					     * edits taskgroup
 | 
				
			||||||
 | 
					     * @param taskgroupID internal id of taskgroup
 | 
				
			||||||
 | 
					     * @param taskgroupFieldInfo 
 | 
				
			||||||
 | 
					     * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
 | 
				
			||||||
 | 
					     * @param reportProgress flag to report request and response progress.
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public taskgroupsTaskgroupIDPost(taskgroupID: number, taskgroupFieldInfo?: TaskgroupFieldInfo, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<InlineResponse200>;
 | 
				
			||||||
 | 
					    public taskgroupsTaskgroupIDPost(taskgroupID: number, taskgroupFieldInfo?: TaskgroupFieldInfo, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpResponse<InlineResponse200>>;
 | 
				
			||||||
 | 
					    public taskgroupsTaskgroupIDPost(taskgroupID: number, taskgroupFieldInfo?: TaskgroupFieldInfo, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpEvent<InlineResponse200>>;
 | 
				
			||||||
 | 
					    public taskgroupsTaskgroupIDPost(taskgroupID: number, taskgroupFieldInfo?: TaskgroupFieldInfo, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<any> {
 | 
				
			||||||
 | 
					        if (taskgroupID === null || taskgroupID === undefined) {
 | 
				
			||||||
 | 
					            throw new Error('Required parameter taskgroupID was null or undefined when calling taskgroupsTaskgroupIDPost.');
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        let localVarHeaders = this.defaultHeaders;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        let localVarCredential: string | undefined;
 | 
				
			||||||
 | 
					        // authentication (API_TOKEN) required
 | 
				
			||||||
 | 
					        localVarCredential = this.configuration.lookupCredential('API_TOKEN');
 | 
				
			||||||
 | 
					        if (localVarCredential) {
 | 
				
			||||||
 | 
					            localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
 | 
				
			||||||
 | 
					        if (localVarHttpHeaderAcceptSelected === undefined) {
 | 
				
			||||||
 | 
					            // to determine the Accept header
 | 
				
			||||||
 | 
					            const httpHeaderAccepts: string[] = [
 | 
				
			||||||
 | 
					                'application/json'
 | 
				
			||||||
 | 
					            ];
 | 
				
			||||||
 | 
					            localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        if (localVarHttpHeaderAcceptSelected !== undefined) {
 | 
				
			||||||
 | 
					            localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        let localVarHttpContext: HttpContext | undefined = options && options.context;
 | 
				
			||||||
 | 
					        if (localVarHttpContext === undefined) {
 | 
				
			||||||
 | 
					            localVarHttpContext = new HttpContext();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // to determine the Content-Type header
 | 
				
			||||||
 | 
					        const consumes: string[] = [
 | 
				
			||||||
 | 
					            'application/json'
 | 
				
			||||||
 | 
					        ];
 | 
				
			||||||
 | 
					        const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes);
 | 
				
			||||||
 | 
					        if (httpContentTypeSelected !== undefined) {
 | 
				
			||||||
 | 
					            localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        let responseType_: 'text' | 'json' = 'json';
 | 
				
			||||||
 | 
					        if(localVarHttpHeaderAcceptSelected && localVarHttpHeaderAcceptSelected.startsWith('text')) {
 | 
				
			||||||
 | 
					            responseType_ = 'text';
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        return this.httpClient.post<InlineResponse200>(`${this.configuration.basePath}/taskgroups/${encodeURIComponent(String(taskgroupID))}`,
 | 
				
			||||||
 | 
					            taskgroupFieldInfo,
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                context: localVarHttpContext,
 | 
				
			||||||
 | 
					                responseType: <any>responseType_,
 | 
				
			||||||
 | 
					                withCredentials: this.configuration.withCredentials,
 | 
				
			||||||
 | 
					                headers: localVarHeaders,
 | 
				
			||||||
 | 
					                observe: observe,
 | 
				
			||||||
 | 
					                reportProgress: reportProgress
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        );
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -11,6 +11,8 @@ export * from './propertiesInfo';
 | 
				
			|||||||
export * from './propertyInfo';
 | 
					export * from './propertyInfo';
 | 
				
			||||||
export * from './propertyUpdateRequest';
 | 
					export * from './propertyUpdateRequest';
 | 
				
			||||||
export * from './signUpRequest';
 | 
					export * from './signUpRequest';
 | 
				
			||||||
 | 
					export * from './taskgroupEntityInfo';
 | 
				
			||||||
 | 
					export * from './taskgroupFieldInfo';
 | 
				
			||||||
export * from './userAddInfo';
 | 
					export * from './userAddInfo';
 | 
				
			||||||
export * from './userInfo';
 | 
					export * from './userInfo';
 | 
				
			||||||
export * from './userUpdateInfo';
 | 
					export * from './userUpdateInfo';
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										24
									
								
								frontend/src/api/model/taskgroupEntityInfo.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								frontend/src/api/model/taskgroupEntityInfo.ts
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,24 @@
 | 
				
			|||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * API Title
 | 
				
			||||||
 | 
					 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * The version of the OpenAPI document: 1.0
 | 
				
			||||||
 | 
					 * 
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 | 
				
			||||||
 | 
					 * https://openapi-generator.tech
 | 
				
			||||||
 | 
					 * Do not edit the class manually.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export interface TaskgroupEntityInfo { 
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * internal id of taskgroup
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    taskgroupID: number;
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * name of taskgroup
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    taskgroupName: string;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
							
								
								
									
										20
									
								
								frontend/src/api/model/taskgroupFieldInfo.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								frontend/src/api/model/taskgroupFieldInfo.ts
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,20 @@
 | 
				
			|||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * API Title
 | 
				
			||||||
 | 
					 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * The version of the OpenAPI document: 1.0
 | 
				
			||||||
 | 
					 * 
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 | 
				
			||||||
 | 
					 * https://openapi-generator.tech
 | 
				
			||||||
 | 
					 * Do not edit the class manually.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export interface TaskgroupFieldInfo { 
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * name of taskgroup
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    name: string;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -4,11 +4,13 @@ import {AppComponent} from "./app.component";
 | 
				
			|||||||
import {AdminDashboardComponent} from "./admin-dashboard/admin-dashboard.component";
 | 
					import {AdminDashboardComponent} from "./admin-dashboard/admin-dashboard.component";
 | 
				
			||||||
import {MainComponent} from "./main/main.component";
 | 
					import {MainComponent} from "./main/main.component";
 | 
				
			||||||
import {UserSettingsComponent} from "./user-settings/user-settings.component";
 | 
					import {UserSettingsComponent} from "./user-settings/user-settings.component";
 | 
				
			||||||
 | 
					import {TaskgroupDashboardComponent} from "./taskgroups/taskgroup-dashboard/taskgroup-dashboard.component";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const routes: Routes = [
 | 
					const routes: Routes = [
 | 
				
			||||||
  {path: '', component: MainComponent},
 | 
					  {path: '', component: MainComponent},
 | 
				
			||||||
  {path: 'admin', component: AdminDashboardComponent},
 | 
					  {path: 'admin', component: AdminDashboardComponent},
 | 
				
			||||||
  {path: 'user/settings', component: UserSettingsComponent}
 | 
					  {path: 'user/settings', component: UserSettingsComponent},
 | 
				
			||||||
 | 
					  {path: 'taskgroups', component: TaskgroupDashboardComponent}
 | 
				
			||||||
];
 | 
					];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@NgModule({
 | 
					@NgModule({
 | 
				
			||||||
 | 
				
			|||||||
@ -1,5 +1,10 @@
 | 
				
			|||||||
<mat-toolbar color="primary">
 | 
					<mat-toolbar color="primary">
 | 
				
			||||||
  <span>Spring Angular Demo</span>
 | 
					  <span>TimeManager</span>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  <button mat-button aria-label="Organize" *ngIf="authService.hasKey" [matMenuTriggerFor]="organizeMenu">Organize ▾</button>
 | 
				
			||||||
 | 
					  <mat-menu #organizeMenu=matMenu>
 | 
				
			||||||
 | 
					    <button mat-menu-item routerLink="taskgroups/" aria-label="Task groups">Taskgroups</button>
 | 
				
			||||||
 | 
					  </mat-menu>
 | 
				
			||||||
  <span class="example-spacer"></span>
 | 
					  <span class="example-spacer"></span>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -36,6 +36,9 @@ import { DeleteAccountComponent } from './user-settings/account-settings/delete-
 | 
				
			|||||||
import { RegistrationComponent } from './auth/registration/registration.component';
 | 
					import { RegistrationComponent } from './auth/registration/registration.component';
 | 
				
			||||||
import { SettingsComponent } from './admin-dashboard/settings/settings.component';
 | 
					import { SettingsComponent } from './admin-dashboard/settings/settings.component';
 | 
				
			||||||
import {MatListModule} from "@angular/material/list";
 | 
					import {MatListModule} from "@angular/material/list";
 | 
				
			||||||
 | 
					import { TaskgroupDashboardComponent } from './taskgroups/taskgroup-dashboard/taskgroup-dashboard.component';
 | 
				
			||||||
 | 
					import { TaskgroupCreationComponent } from './taskgroups/taskgroup-creation/taskgroup-creation.component';
 | 
				
			||||||
 | 
					import { TaskgroupDeletionComponent } from './taskgroups/taskgroup-deletion/taskgroup-deletion.component';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@NgModule({
 | 
					@NgModule({
 | 
				
			||||||
  declarations: [
 | 
					  declarations: [
 | 
				
			||||||
@ -52,7 +55,10 @@ import {MatListModule} from "@angular/material/list";
 | 
				
			|||||||
    ManageEmailComponent,
 | 
					    ManageEmailComponent,
 | 
				
			||||||
    DeleteAccountComponent,
 | 
					    DeleteAccountComponent,
 | 
				
			||||||
    RegistrationComponent,
 | 
					    RegistrationComponent,
 | 
				
			||||||
    SettingsComponent
 | 
					    SettingsComponent,
 | 
				
			||||||
 | 
					    TaskgroupDashboardComponent,
 | 
				
			||||||
 | 
					    TaskgroupCreationComponent,
 | 
				
			||||||
 | 
					    TaskgroupDeletionComponent
 | 
				
			||||||
  ],
 | 
					  ],
 | 
				
			||||||
  imports: [
 | 
					  imports: [
 | 
				
			||||||
    BrowserModule,
 | 
					    BrowserModule,
 | 
				
			||||||
 | 
				
			|||||||
@ -0,0 +1,3 @@
 | 
				
			|||||||
 | 
					.mat-form-field {
 | 
				
			||||||
 | 
					  width: 100%;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -0,0 +1,13 @@
 | 
				
			|||||||
 | 
					<h1 mat-dialog-title>Create New Taskgroup</h1>
 | 
				
			||||||
 | 
					<div mat-dialog-content>
 | 
				
			||||||
 | 
					  <mat-form-field appearance="outline">
 | 
				
			||||||
 | 
					    <mat-label>Name</mat-label>
 | 
				
			||||||
 | 
					    <input matInput [formControl]="nameCtrl">
 | 
				
			||||||
 | 
					    <mat-hint align="end">{{nameCtrl.value.length}} / 255</mat-hint>
 | 
				
			||||||
 | 
					  </mat-form-field>
 | 
				
			||||||
 | 
					</div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					<div mat-dialog-actions align="end">
 | 
				
			||||||
 | 
					  <button mat-raised-button (click)="cancel()">Cancel</button>
 | 
				
			||||||
 | 
					  <button mat-raised-button color="primary" (click)="save()" [disabled]="nameCtrl.invalid"><mat-icon>save</mat-icon>Save<mat-icon *ngIf="pending"><mat-spinner diameter="20" style="margin-left: 10px"></mat-spinner></mat-icon></button>
 | 
				
			||||||
 | 
					</div>
 | 
				
			||||||
@ -0,0 +1,25 @@
 | 
				
			|||||||
 | 
					import { ComponentFixture, TestBed } from '@angular/core/testing';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import { TaskgroupCreationComponent } from './taskgroup-creation.component';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					describe('TaskgroupCreationComponent', () => {
 | 
				
			||||||
 | 
					  let component: TaskgroupCreationComponent;
 | 
				
			||||||
 | 
					  let fixture: ComponentFixture<TaskgroupCreationComponent>;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  beforeEach(async () => {
 | 
				
			||||||
 | 
					    await TestBed.configureTestingModule({
 | 
				
			||||||
 | 
					      declarations: [ TaskgroupCreationComponent ]
 | 
				
			||||||
 | 
					    })
 | 
				
			||||||
 | 
					    .compileComponents();
 | 
				
			||||||
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  beforeEach(() => {
 | 
				
			||||||
 | 
					    fixture = TestBed.createComponent(TaskgroupCreationComponent);
 | 
				
			||||||
 | 
					    component = fixture.componentInstance;
 | 
				
			||||||
 | 
					    fixture.detectChanges();
 | 
				
			||||||
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  it('should create', () => {
 | 
				
			||||||
 | 
					    expect(component).toBeTruthy();
 | 
				
			||||||
 | 
					  });
 | 
				
			||||||
 | 
					});
 | 
				
			||||||
@ -0,0 +1,76 @@
 | 
				
			|||||||
 | 
					import {Component, Inject, OnInit} from '@angular/core';
 | 
				
			||||||
 | 
					import {FormControl, Validators} from "@angular/forms";
 | 
				
			||||||
 | 
					import {MAT_DIALOG_DATA, MatDialogRef} from "@angular/material/dialog";
 | 
				
			||||||
 | 
					import {TaskgroupEntityInfo, TaskgroupService} from "../../../api";
 | 
				
			||||||
 | 
					import {error} from "@angular/compiler/src/util";
 | 
				
			||||||
 | 
					import {MatSnackBar} from "@angular/material/snack-bar";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@Component({
 | 
				
			||||||
 | 
					  selector: 'app-taskgroup-creation',
 | 
				
			||||||
 | 
					  templateUrl: './taskgroup-creation.component.html',
 | 
				
			||||||
 | 
					  styleUrls: ['./taskgroup-creation.component.css']
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					export class TaskgroupCreationComponent implements OnInit {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  nameCtrl = new FormControl('', [Validators.required, Validators.maxLength(255)])
 | 
				
			||||||
 | 
					  pending: boolean = false
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  constructor(private dialogRef: MatDialogRef<TaskgroupCreationComponent>,
 | 
				
			||||||
 | 
					              private taskgroupService: TaskgroupService,
 | 
				
			||||||
 | 
					              private snackbar: MatSnackBar,
 | 
				
			||||||
 | 
					              @Inject(MAT_DIALOG_DATA) public data: TaskgroupEntityInfo | undefined) { }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  ngOnInit(): void {
 | 
				
			||||||
 | 
					    if(this.data != undefined) {
 | 
				
			||||||
 | 
					      this.nameCtrl.setValue(this.data!.taskgroupName)
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  cancel() {
 | 
				
			||||||
 | 
					    this.dialogRef.close();
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  save() {
 | 
				
			||||||
 | 
					    this.pending = true;
 | 
				
			||||||
 | 
					    if(this.data == undefined) {
 | 
				
			||||||
 | 
					      this.taskgroupService.taskgroupsPut({
 | 
				
			||||||
 | 
					        name: this.nameCtrl.value
 | 
				
			||||||
 | 
					      }).subscribe({
 | 
				
			||||||
 | 
					        next: resp => {
 | 
				
			||||||
 | 
					          this.pending = false;
 | 
				
			||||||
 | 
					          this.dialogRef.close(resp);
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
 | 
					        error: err => {
 | 
				
			||||||
 | 
					          this.pending = false;
 | 
				
			||||||
 | 
					          if(err.status == 409) {
 | 
				
			||||||
 | 
					            this.snackbar.open("Taskgroup already exists", "", {duration: 2000});
 | 
				
			||||||
 | 
					          } else {
 | 
				
			||||||
 | 
					            this.snackbar.open("An unexpected error occured", "");
 | 
				
			||||||
 | 
					          }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					      })
 | 
				
			||||||
 | 
					    } else {
 | 
				
			||||||
 | 
					      this.taskgroupService.taskgroupsTaskgroupIDPost(this.data.taskgroupID, {
 | 
				
			||||||
 | 
					        name: this.nameCtrl.value
 | 
				
			||||||
 | 
					      }).subscribe({
 | 
				
			||||||
 | 
					        next: resp => {
 | 
				
			||||||
 | 
					          this.pending = false;
 | 
				
			||||||
 | 
					          this.data!.taskgroupName = this.nameCtrl.value
 | 
				
			||||||
 | 
					          this.dialogRef.close(true);
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
 | 
					        error: err => {
 | 
				
			||||||
 | 
					          this.pending = false;
 | 
				
			||||||
 | 
					          if(err.status == 409) {
 | 
				
			||||||
 | 
					            this.snackbar.open("Taskgroup already exists", "", {duration: 2000});
 | 
				
			||||||
 | 
					          } else if(err.status == 403) {
 | 
				
			||||||
 | 
					            this.snackbar.open("No permission", "", {duration: 2000})
 | 
				
			||||||
 | 
					          } else if(err.status == 404) {
 | 
				
			||||||
 | 
					            this.snackbar.open("Not found", "", {duration: 2000});
 | 
				
			||||||
 | 
					          } else {
 | 
				
			||||||
 | 
					            this.snackbar.open("An unexpected error occured", "");
 | 
				
			||||||
 | 
					          }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					      })
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -0,0 +1,41 @@
 | 
				
			|||||||
 | 
					.container {
 | 
				
			||||||
 | 
					  margin: 20px auto;
 | 
				
			||||||
 | 
					  width: 60%;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.spacer {
 | 
				
			||||||
 | 
					  margin-bottom: 2.5%;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@media screen and (max-width: 600px) {
 | 
				
			||||||
 | 
					  .container {
 | 
				
			||||||
 | 
					    width: 100%;
 | 
				
			||||||
 | 
					    margin: 20px 10px;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.navLink {
 | 
				
			||||||
 | 
					  text-decoration: underline;
 | 
				
			||||||
 | 
					  color: black;
 | 
				
			||||||
 | 
					  margin-right: 5px;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.navLink-disabled {
 | 
				
			||||||
 | 
					  text-decoration: none;
 | 
				
			||||||
 | 
					  color: grey;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.navLink-bar {
 | 
				
			||||||
 | 
					  margin-bottom: 20px;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#addTaskgroupBtn {
 | 
				
			||||||
 | 
					  margin-top: 20px;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.edit-btn {
 | 
				
			||||||
 | 
					  background-color: #6e6e6e;
 | 
				
			||||||
 | 
					  color: white;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -0,0 +1,19 @@
 | 
				
			|||||||
 | 
					<div class="container">
 | 
				
			||||||
 | 
					  <mat-card class="navLink-bar">
 | 
				
			||||||
 | 
					    <mat-card-content>
 | 
				
			||||||
 | 
					      <a class="navLink" routerLink="/">Dashboard</a>
 | 
				
			||||||
 | 
					      <a class="navLink-disabled">/ Taskgroups</a>
 | 
				
			||||||
 | 
					    </mat-card-content>
 | 
				
			||||||
 | 
					  </mat-card>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  <mat-card *ngFor="let taskgroup of taskgroups">
 | 
				
			||||||
 | 
					    <mat-card-content>
 | 
				
			||||||
 | 
					      <h1>{{taskgroup.taskgroupName}}</h1>
 | 
				
			||||||
 | 
					      <button mat-raised-button color="primary">Detail</button>
 | 
				
			||||||
 | 
					      <button mat-raised-button class="edit-btn" (click)="openTaskgroupEditor(taskgroup)">Rename</button>
 | 
				
			||||||
 | 
					      <button mat-raised-button color="warn" (click)="openTaskgroupDeletion(taskgroup)">Delete</button>
 | 
				
			||||||
 | 
					    </mat-card-content>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  </mat-card>
 | 
				
			||||||
 | 
					  <button id="addTaskgroupBtn" mat-raised-button color="primary" (click)="openTaskgroupCreation()">Create new Taskgroup</button>
 | 
				
			||||||
 | 
					</div>
 | 
				
			||||||
@ -0,0 +1,25 @@
 | 
				
			|||||||
 | 
					import { ComponentFixture, TestBed } from '@angular/core/testing';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import { TaskgroupDashboardComponent } from './taskgroup-dashboard.component';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					describe('TaskgroupDashboardComponent', () => {
 | 
				
			||||||
 | 
					  let component: TaskgroupDashboardComponent;
 | 
				
			||||||
 | 
					  let fixture: ComponentFixture<TaskgroupDashboardComponent>;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  beforeEach(async () => {
 | 
				
			||||||
 | 
					    await TestBed.configureTestingModule({
 | 
				
			||||||
 | 
					      declarations: [ TaskgroupDashboardComponent ]
 | 
				
			||||||
 | 
					    })
 | 
				
			||||||
 | 
					    .compileComponents();
 | 
				
			||||||
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  beforeEach(() => {
 | 
				
			||||||
 | 
					    fixture = TestBed.createComponent(TaskgroupDashboardComponent);
 | 
				
			||||||
 | 
					    component = fixture.componentInstance;
 | 
				
			||||||
 | 
					    fixture.detectChanges();
 | 
				
			||||||
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  it('should create', () => {
 | 
				
			||||||
 | 
					    expect(component).toBeTruthy();
 | 
				
			||||||
 | 
					  });
 | 
				
			||||||
 | 
					});
 | 
				
			||||||
@ -0,0 +1,53 @@
 | 
				
			|||||||
 | 
					import { Component, OnInit } from '@angular/core';
 | 
				
			||||||
 | 
					import {MatDialog} from "@angular/material/dialog";
 | 
				
			||||||
 | 
					import {TaskgroupCreationComponent} from "../taskgroup-creation/taskgroup-creation.component";
 | 
				
			||||||
 | 
					import {TaskgroupEntityInfo, TaskgroupService} from "../../../api";
 | 
				
			||||||
 | 
					import {TaskgroupDeletionComponent} from "../taskgroup-deletion/taskgroup-deletion.component";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@Component({
 | 
				
			||||||
 | 
					  selector: 'app-taskgroup-dashboard',
 | 
				
			||||||
 | 
					  templateUrl: './taskgroup-dashboard.component.html',
 | 
				
			||||||
 | 
					  styleUrls: ['./taskgroup-dashboard.component.css']
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					export class TaskgroupDashboardComponent implements OnInit {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  constructor(private dialog: MatDialog,
 | 
				
			||||||
 | 
					              private taskgroupService: TaskgroupService) { }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  taskgroups: TaskgroupEntityInfo[] = []
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  ngOnInit(): void {
 | 
				
			||||||
 | 
					    this.taskgroupService.taskgroupsGet().subscribe({
 | 
				
			||||||
 | 
					      next: resp => {
 | 
				
			||||||
 | 
					        this.taskgroups = resp;
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					    })
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  openTaskgroupCreation() {
 | 
				
			||||||
 | 
					    const dialogRef = this.dialog.open(TaskgroupCreationComponent, {minWidth: "400px"})
 | 
				
			||||||
 | 
					    dialogRef.afterClosed().subscribe(res => {
 | 
				
			||||||
 | 
					      if(res != undefined) {
 | 
				
			||||||
 | 
					        this.taskgroups.push(res);
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					    })
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  openTaskgroupEditor(taskgroup: TaskgroupEntityInfo) {
 | 
				
			||||||
 | 
					    const dialogRef = this.dialog.open(TaskgroupCreationComponent, {data: taskgroup, minWidth: "400px"});
 | 
				
			||||||
 | 
					    dialogRef.afterClosed().subscribe(res => {
 | 
				
			||||||
 | 
					      if(res) {
 | 
				
			||||||
 | 
					        const data = this.taskgroups
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					    })
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  openTaskgroupDeletion(taskgroup: TaskgroupEntityInfo) {
 | 
				
			||||||
 | 
					    const dialogRef = this.dialog.open(TaskgroupDeletionComponent, {data: taskgroup, minWidth: "400px"});
 | 
				
			||||||
 | 
					    dialogRef.afterClosed().subscribe(res => {
 | 
				
			||||||
 | 
					      if(res) {
 | 
				
			||||||
 | 
					       this.taskgroups = this.taskgroups.filter(ctg => ctg.taskgroupID != taskgroup.taskgroupID)
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					    })
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -0,0 +1,8 @@
 | 
				
			|||||||
 | 
					<h1 mat-dialog-title>Delete Taskgroup</h1>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					<p>Are you sure, you want to delete your taskgroup {{data.taskgroupName}}? This <b>cannot</b> be <b>undone!</b></p>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					<div mat-dialog-actions align="end">
 | 
				
			||||||
 | 
					  <button mat-raised-button (click)="cancel()">Cancel</button>
 | 
				
			||||||
 | 
					  <button mat-raised-button color="warn" (click)="confirm()">Confirm <mat-icon *ngIf="pending"><mat-spinner diameter="20" style="margin-left: 10px"></mat-spinner></mat-icon></button>
 | 
				
			||||||
 | 
					</div>
 | 
				
			||||||
@ -0,0 +1,25 @@
 | 
				
			|||||||
 | 
					import { ComponentFixture, TestBed } from '@angular/core/testing';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import { TaskgroupDeletionComponent } from './taskgroup-deletion.component';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					describe('TaskgroupDeletionComponent', () => {
 | 
				
			||||||
 | 
					  let component: TaskgroupDeletionComponent;
 | 
				
			||||||
 | 
					  let fixture: ComponentFixture<TaskgroupDeletionComponent>;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  beforeEach(async () => {
 | 
				
			||||||
 | 
					    await TestBed.configureTestingModule({
 | 
				
			||||||
 | 
					      declarations: [ TaskgroupDeletionComponent ]
 | 
				
			||||||
 | 
					    })
 | 
				
			||||||
 | 
					    .compileComponents();
 | 
				
			||||||
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  beforeEach(() => {
 | 
				
			||||||
 | 
					    fixture = TestBed.createComponent(TaskgroupDeletionComponent);
 | 
				
			||||||
 | 
					    component = fixture.componentInstance;
 | 
				
			||||||
 | 
					    fixture.detectChanges();
 | 
				
			||||||
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  it('should create', () => {
 | 
				
			||||||
 | 
					    expect(component).toBeTruthy();
 | 
				
			||||||
 | 
					  });
 | 
				
			||||||
 | 
					});
 | 
				
			||||||
@ -0,0 +1,46 @@
 | 
				
			|||||||
 | 
					import {Component, Inject, OnInit} from '@angular/core';
 | 
				
			||||||
 | 
					import {MAT_DIALOG_DATA, MatDialogRef} from "@angular/material/dialog";
 | 
				
			||||||
 | 
					import {TaskgroupEntityInfo, TaskgroupService} from "../../../api";
 | 
				
			||||||
 | 
					import {MatSnackBar} from "@angular/material/snack-bar";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@Component({
 | 
				
			||||||
 | 
					  selector: 'app-taskgroup-deletion',
 | 
				
			||||||
 | 
					  templateUrl: './taskgroup-deletion.component.html',
 | 
				
			||||||
 | 
					  styleUrls: ['./taskgroup-deletion.component.css']
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					export class TaskgroupDeletionComponent implements OnInit {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  constructor(@Inject(MAT_DIALOG_DATA) public data: TaskgroupEntityInfo,
 | 
				
			||||||
 | 
					              private dialogRef: MatDialogRef<TaskgroupDeletionComponent>,
 | 
				
			||||||
 | 
					              private taskgroupService: TaskgroupService,
 | 
				
			||||||
 | 
					              private snackbar: MatSnackBar) { }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  pending: boolean = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  ngOnInit(): void {
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  cancel() {
 | 
				
			||||||
 | 
					    this.dialogRef.close(false);
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  confirm() {
 | 
				
			||||||
 | 
					    this.pending = true;
 | 
				
			||||||
 | 
					    this.taskgroupService.taskgroupsTaskgroupIDDelete(this.data.taskgroupID).subscribe({
 | 
				
			||||||
 | 
					      next: resp => {
 | 
				
			||||||
 | 
					        this.pending = false;
 | 
				
			||||||
 | 
					        this.dialogRef.close(true);
 | 
				
			||||||
 | 
					      },
 | 
				
			||||||
 | 
					      error: err => {
 | 
				
			||||||
 | 
					        this.pending = false;
 | 
				
			||||||
 | 
					        if(err.stats == 403) {
 | 
				
			||||||
 | 
					          this.snackbar.open("No permission", "", {duration: 2000});
 | 
				
			||||||
 | 
					        } else if(err.status == 404) {
 | 
				
			||||||
 | 
					          this.snackbar.open("Not found", "", {duration: 2000});
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					          this.snackbar.open("Unexpected error", "");
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					    })
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										221
									
								
								openapi.yaml
									
									
									
									
									
								
							
							
						
						
									
										221
									
								
								openapi.yaml
									
									
									
									
									
								
							@ -564,6 +564,200 @@ paths:
 | 
				
			|||||||
                    example: "failed"
 | 
					                    example: "failed"
 | 
				
			||||||
                    enum:
 | 
					                    enum:
 | 
				
			||||||
                      - "failed"
 | 
					                      - "failed"
 | 
				
			||||||
 | 
					  /taskgroups:
 | 
				
			||||||
 | 
					    get:
 | 
				
			||||||
 | 
					      security:
 | 
				
			||||||
 | 
					        - API_TOKEN: []
 | 
				
			||||||
 | 
					      tags:
 | 
				
			||||||
 | 
					        - taskgroup
 | 
				
			||||||
 | 
					      summary: list all taskgroups of authorized user
 | 
				
			||||||
 | 
					      description: list all taskgroups of authorized user
 | 
				
			||||||
 | 
					      responses:
 | 
				
			||||||
 | 
					        200: 
 | 
				
			||||||
 | 
					          description: Anfrage erfolgreich
 | 
				
			||||||
 | 
					          content:
 | 
				
			||||||
 | 
					            'application/json':
 | 
				
			||||||
 | 
					              schema:
 | 
				
			||||||
 | 
					                type: array
 | 
				
			||||||
 | 
					                items:
 | 
				
			||||||
 | 
					                  $ref: '#/components/schemas/TaskgroupEntityInfo'
 | 
				
			||||||
 | 
					    put:
 | 
				
			||||||
 | 
					      security:
 | 
				
			||||||
 | 
					        - API_TOKEN: []
 | 
				
			||||||
 | 
					      tags:
 | 
				
			||||||
 | 
					        - taskgroup
 | 
				
			||||||
 | 
					      summary: creates taskgroup
 | 
				
			||||||
 | 
					      description: creates taskgroup
 | 
				
			||||||
 | 
					      requestBody:
 | 
				
			||||||
 | 
					        content:
 | 
				
			||||||
 | 
					          application/json:
 | 
				
			||||||
 | 
					            schema:
 | 
				
			||||||
 | 
					              $ref: '#/components/schemas/TaskgroupFieldInfo'
 | 
				
			||||||
 | 
					      responses:
 | 
				
			||||||
 | 
					        200: 
 | 
				
			||||||
 | 
					          description: Anfrage erfolgreich
 | 
				
			||||||
 | 
					          content:
 | 
				
			||||||
 | 
					            'application/json':
 | 
				
			||||||
 | 
					              schema:
 | 
				
			||||||
 | 
					                $ref: '#/components/schemas/TaskgroupEntityInfo'
 | 
				
			||||||
 | 
					        409:
 | 
				
			||||||
 | 
					          description: Taskgroup already exists
 | 
				
			||||||
 | 
					          content:
 | 
				
			||||||
 | 
					            application/json:
 | 
				
			||||||
 | 
					              schema:
 | 
				
			||||||
 | 
					                type: object
 | 
				
			||||||
 | 
					                required:
 | 
				
			||||||
 | 
					                  - status
 | 
				
			||||||
 | 
					                properties:
 | 
				
			||||||
 | 
					                  status:
 | 
				
			||||||
 | 
					                    type: string
 | 
				
			||||||
 | 
					                    description: Status
 | 
				
			||||||
 | 
					                    example: "failed"
 | 
				
			||||||
 | 
					                    enum:
 | 
				
			||||||
 | 
					                      - "failed"
 | 
				
			||||||
 | 
					  /taskgroups/{taskgroupID}:
 | 
				
			||||||
 | 
					    post:
 | 
				
			||||||
 | 
					      security:
 | 
				
			||||||
 | 
					        - API_TOKEN: []
 | 
				
			||||||
 | 
					      tags:
 | 
				
			||||||
 | 
					        - taskgroup
 | 
				
			||||||
 | 
					      summary: edits taskgroup
 | 
				
			||||||
 | 
					      description: edits taskgroup
 | 
				
			||||||
 | 
					      parameters:
 | 
				
			||||||
 | 
					        - name: taskgroupID
 | 
				
			||||||
 | 
					          in: path
 | 
				
			||||||
 | 
					          description: internal id of taskgroup
 | 
				
			||||||
 | 
					          required: true
 | 
				
			||||||
 | 
					          schema:
 | 
				
			||||||
 | 
					            type: number
 | 
				
			||||||
 | 
					            example: 1
 | 
				
			||||||
 | 
					      requestBody:
 | 
				
			||||||
 | 
					        content:
 | 
				
			||||||
 | 
					          application/json:
 | 
				
			||||||
 | 
					            schema:
 | 
				
			||||||
 | 
					              $ref: '#/components/schemas/TaskgroupFieldInfo'
 | 
				
			||||||
 | 
					      responses:
 | 
				
			||||||
 | 
					        200: 
 | 
				
			||||||
 | 
					          description: Anfrage erfolgreich
 | 
				
			||||||
 | 
					          content:
 | 
				
			||||||
 | 
					            'application/json':
 | 
				
			||||||
 | 
					              schema:
 | 
				
			||||||
 | 
					                type: object
 | 
				
			||||||
 | 
					                required:
 | 
				
			||||||
 | 
					                  - status
 | 
				
			||||||
 | 
					                properties:
 | 
				
			||||||
 | 
					                  status:
 | 
				
			||||||
 | 
					                    type: string
 | 
				
			||||||
 | 
					                    description: Status
 | 
				
			||||||
 | 
					                    example: "success"
 | 
				
			||||||
 | 
					                    enum:
 | 
				
			||||||
 | 
					                      - "success"
 | 
				
			||||||
 | 
					        403:
 | 
				
			||||||
 | 
					          description: No permission
 | 
				
			||||||
 | 
					          content:
 | 
				
			||||||
 | 
					            'application/json':
 | 
				
			||||||
 | 
					              schema:
 | 
				
			||||||
 | 
					                type: object
 | 
				
			||||||
 | 
					                required:
 | 
				
			||||||
 | 
					                  - status
 | 
				
			||||||
 | 
					                properties:
 | 
				
			||||||
 | 
					                  status:
 | 
				
			||||||
 | 
					                    type: string
 | 
				
			||||||
 | 
					                    description: Status
 | 
				
			||||||
 | 
					                    example: "failed"
 | 
				
			||||||
 | 
					                    enum:
 | 
				
			||||||
 | 
					                      - "failed"
 | 
				
			||||||
 | 
					        404:
 | 
				
			||||||
 | 
					          description: Taskgroup does not exist
 | 
				
			||||||
 | 
					          content:
 | 
				
			||||||
 | 
					            'application/json':
 | 
				
			||||||
 | 
					              schema:
 | 
				
			||||||
 | 
					                type: object
 | 
				
			||||||
 | 
					                required:
 | 
				
			||||||
 | 
					                  - status
 | 
				
			||||||
 | 
					                properties:
 | 
				
			||||||
 | 
					                  status:
 | 
				
			||||||
 | 
					                    type: string
 | 
				
			||||||
 | 
					                    description: Status
 | 
				
			||||||
 | 
					                    example: "failed"
 | 
				
			||||||
 | 
					                    enum:
 | 
				
			||||||
 | 
					                      - "failed"
 | 
				
			||||||
 | 
					        409:
 | 
				
			||||||
 | 
					          description: Taskgroup with that new name already exists
 | 
				
			||||||
 | 
					          content:
 | 
				
			||||||
 | 
					            'application/json':
 | 
				
			||||||
 | 
					              schema:
 | 
				
			||||||
 | 
					                type: object
 | 
				
			||||||
 | 
					                required:
 | 
				
			||||||
 | 
					                  - status
 | 
				
			||||||
 | 
					                properties:
 | 
				
			||||||
 | 
					                  status:
 | 
				
			||||||
 | 
					                    type: string
 | 
				
			||||||
 | 
					                    description: Status
 | 
				
			||||||
 | 
					                    example: "failed"
 | 
				
			||||||
 | 
					                    enum:
 | 
				
			||||||
 | 
					                      - "failed"
 | 
				
			||||||
 | 
					    delete:
 | 
				
			||||||
 | 
					      security:
 | 
				
			||||||
 | 
					        - API_TOKEN: []
 | 
				
			||||||
 | 
					      tags:
 | 
				
			||||||
 | 
					        - taskgroup
 | 
				
			||||||
 | 
					      summary: deletes taskgroup
 | 
				
			||||||
 | 
					      description: deletes taskgroup
 | 
				
			||||||
 | 
					      parameters:
 | 
				
			||||||
 | 
					        - name: taskgroupID
 | 
				
			||||||
 | 
					          in: path
 | 
				
			||||||
 | 
					          description: internal id of taskgroup
 | 
				
			||||||
 | 
					          required: true
 | 
				
			||||||
 | 
					          schema:
 | 
				
			||||||
 | 
					            type: number
 | 
				
			||||||
 | 
					            example: 1
 | 
				
			||||||
 | 
					      responses:
 | 
				
			||||||
 | 
					        200: 
 | 
				
			||||||
 | 
					          description: Anfrage erfolgreich
 | 
				
			||||||
 | 
					          content:
 | 
				
			||||||
 | 
					            'application/json':
 | 
				
			||||||
 | 
					              schema:
 | 
				
			||||||
 | 
					                type: object
 | 
				
			||||||
 | 
					                required:
 | 
				
			||||||
 | 
					                  - status
 | 
				
			||||||
 | 
					                properties:
 | 
				
			||||||
 | 
					                  status:
 | 
				
			||||||
 | 
					                    type: string
 | 
				
			||||||
 | 
					                    description: Status
 | 
				
			||||||
 | 
					                    example: "success"
 | 
				
			||||||
 | 
					                    enum:
 | 
				
			||||||
 | 
					                      - "success"
 | 
				
			||||||
 | 
					        403:
 | 
				
			||||||
 | 
					          description: No permission
 | 
				
			||||||
 | 
					          content:
 | 
				
			||||||
 | 
					            'application/json':
 | 
				
			||||||
 | 
					              schema:
 | 
				
			||||||
 | 
					                type: object
 | 
				
			||||||
 | 
					                required:
 | 
				
			||||||
 | 
					                  - status
 | 
				
			||||||
 | 
					                properties:
 | 
				
			||||||
 | 
					                  status:
 | 
				
			||||||
 | 
					                    type: string
 | 
				
			||||||
 | 
					                    description: Status
 | 
				
			||||||
 | 
					                    example: "failed"
 | 
				
			||||||
 | 
					                    enum:
 | 
				
			||||||
 | 
					                      - "failed"
 | 
				
			||||||
 | 
					        404:
 | 
				
			||||||
 | 
					          description: Taskgroup does not exist
 | 
				
			||||||
 | 
					          content:
 | 
				
			||||||
 | 
					            'application/json':
 | 
				
			||||||
 | 
					              schema:
 | 
				
			||||||
 | 
					                type: object
 | 
				
			||||||
 | 
					                required:
 | 
				
			||||||
 | 
					                  - status
 | 
				
			||||||
 | 
					                properties:
 | 
				
			||||||
 | 
					                  status:
 | 
				
			||||||
 | 
					                    type: string
 | 
				
			||||||
 | 
					                    description: Status
 | 
				
			||||||
 | 
					                    example: "failed"
 | 
				
			||||||
 | 
					                    enum:
 | 
				
			||||||
 | 
					                      - "failed"
 | 
				
			||||||
components:
 | 
					components:
 | 
				
			||||||
  securitySchemes:
 | 
					  securitySchemes:
 | 
				
			||||||
   API_TOKEN:
 | 
					   API_TOKEN:
 | 
				
			||||||
@ -750,3 +944,30 @@ components:
 | 
				
			|||||||
          type: array
 | 
					          type: array
 | 
				
			||||||
          items:
 | 
					          items:
 | 
				
			||||||
            $ref: '#/components/schemas/PropertyInfo'
 | 
					            $ref: '#/components/schemas/PropertyInfo'
 | 
				
			||||||
 | 
					    TaskgroupEntityInfo:
 | 
				
			||||||
 | 
					      required:
 | 
				
			||||||
 | 
					        - taskgroupID
 | 
				
			||||||
 | 
					        - taskgroupName
 | 
				
			||||||
 | 
					      additionalProperties: false
 | 
				
			||||||
 | 
					      properties:
 | 
				
			||||||
 | 
					        taskgroupID:
 | 
				
			||||||
 | 
					          type: number
 | 
				
			||||||
 | 
					          description: internal id of taskgroup
 | 
				
			||||||
 | 
					          example: 1
 | 
				
			||||||
 | 
					        taskgroupName:
 | 
				
			||||||
 | 
					          type: string
 | 
				
			||||||
 | 
					          description: name of taskgroup
 | 
				
			||||||
 | 
					          example: Taskgroup 1
 | 
				
			||||||
 | 
					          maxLength: 255
 | 
				
			||||||
 | 
					          minLength: 1
 | 
				
			||||||
 | 
					    TaskgroupFieldInfo:
 | 
				
			||||||
 | 
					      required:
 | 
				
			||||||
 | 
					        - name
 | 
				
			||||||
 | 
					      additionalProperties: false
 | 
				
			||||||
 | 
					      properties:
 | 
				
			||||||
 | 
					        name:
 | 
				
			||||||
 | 
					          type: string
 | 
				
			||||||
 | 
					          description: name of taskgroup
 | 
				
			||||||
 | 
					          example: Taskgroup 1
 | 
				
			||||||
 | 
					          maxLength: 255
 | 
				
			||||||
 | 
					          minLength: 1
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user