-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat (super admin dashboard): adds functionality for super admin dashboard --------- Co-authored-by: john-tco <[email protected]> Co-authored-by: Dylan Wright <[email protected]> Co-authored-by: Dominic West <[email protected]>
- Loading branch information
1 parent
c393bab
commit 92ef925
Showing
40 changed files
with
903 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
src/main/java/gov/cabinetofice/gapuserservice/dto/ChangeDepartmentPageDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package gov.cabinetofice.gapuserservice.dto; | ||
|
||
import gov.cabinetofice.gapuserservice.model.User; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
|
||
import java.util.List; | ||
|
||
@Data | ||
@Builder | ||
public class ChangeDepartmentPageDto { | ||
private User user; | ||
private List<DepartmentDto> departments; | ||
} |
12 changes: 12 additions & 0 deletions
12
src/main/java/gov/cabinetofice/gapuserservice/dto/DepartmentDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package gov.cabinetofice.gapuserservice.dto; | ||
|
||
import lombok.Builder; | ||
import lombok.Data; | ||
|
||
@Data | ||
@Builder | ||
public class DepartmentDto { | ||
private String id; | ||
private String name; | ||
private String ggisID; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
src/main/java/gov/cabinetofice/gapuserservice/dto/RoleDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package gov.cabinetofice.gapuserservice.dto; | ||
|
||
import lombok.Builder; | ||
import lombok.Data; | ||
|
||
@Data | ||
@Builder | ||
public class RoleDto { | ||
private String id; | ||
private String name; | ||
private String description; | ||
} |
15 changes: 15 additions & 0 deletions
15
src/main/java/gov/cabinetofice/gapuserservice/dto/SuperAdminDashboardPageDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package gov.cabinetofice.gapuserservice.dto; | ||
|
||
import lombok.Builder; | ||
import lombok.Data; | ||
|
||
import java.util.List; | ||
|
||
@Data | ||
@Builder | ||
public class SuperAdminDashboardPageDto { | ||
private List<RoleDto> roles; | ||
private List<DepartmentDto> departments; | ||
private List<UserDto> users; | ||
private long userCount; | ||
} |
17 changes: 17 additions & 0 deletions
17
src/main/java/gov/cabinetofice/gapuserservice/dto/UserDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package gov.cabinetofice.gapuserservice.dto; | ||
|
||
import gov.cabinetofice.gapuserservice.model.Department; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
|
||
import java.util.List; | ||
|
||
@Builder | ||
@Data | ||
public class UserDto { | ||
private String gapUserId; | ||
private String emailAddress; | ||
private String sub; | ||
private List<RoleDto> roles; | ||
private Department department; | ||
} |
11 changes: 11 additions & 0 deletions
11
src/main/java/gov/cabinetofice/gapuserservice/exceptions/DepartmentNotFoundException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package gov.cabinetofice.gapuserservice.exceptions; | ||
|
||
import org.springframework.http.HttpStatus; | ||
import org.springframework.web.bind.annotation.ResponseStatus; | ||
|
||
@ResponseStatus(HttpStatus.NOT_FOUND) | ||
public class DepartmentNotFoundException extends RuntimeException { | ||
public DepartmentNotFoundException(String message) { | ||
super(message); | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
src/main/java/gov/cabinetofice/gapuserservice/exceptions/UserNotFoundException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
src/main/java/gov/cabinetofice/gapuserservice/mappers/DepartmentMapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package gov.cabinetofice.gapuserservice.mappers; | ||
|
||
import gov.cabinetofice.gapuserservice.dto.DepartmentDto; | ||
import gov.cabinetofice.gapuserservice.model.Department; | ||
import org.mapstruct.Mapper; | ||
|
||
@Mapper(componentModel = "spring") | ||
public interface DepartmentMapper { | ||
DepartmentDto departmentToDepartmentDto(Department dept); | ||
} |
10 changes: 10 additions & 0 deletions
10
src/main/java/gov/cabinetofice/gapuserservice/mappers/RoleMapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package gov.cabinetofice.gapuserservice.mappers; | ||
import gov.cabinetofice.gapuserservice.model.Role; | ||
|
||
import gov.cabinetofice.gapuserservice.dto.RoleDto; | ||
import org.mapstruct.Mapper; | ||
|
||
@Mapper(componentModel = "spring") | ||
public interface RoleMapper { | ||
RoleDto roleToRoleDto(Role role); | ||
} |
10 changes: 10 additions & 0 deletions
10
src/main/java/gov/cabinetofice/gapuserservice/mappers/UserMapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package gov.cabinetofice.gapuserservice.mappers; | ||
|
||
import gov.cabinetofice.gapuserservice.dto.UserDto; | ||
import gov.cabinetofice.gapuserservice.model.User; | ||
import org.mapstruct.Mapper; | ||
|
||
@Mapper(componentModel = "spring") | ||
public interface UserMapper { | ||
UserDto userToUserDto(User user); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
src/main/java/gov/cabinetofice/gapuserservice/repository/DepartmentRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package gov.cabinetofice.gapuserservice.repository; | ||
|
||
import gov.cabinetofice.gapuserservice.model.Department; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.stereotype.Repository; | ||
|
||
@Repository | ||
public interface DepartmentRepository extends JpaRepository<Department, Integer> { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 8 additions & 1 deletion
9
src/main/java/gov/cabinetofice/gapuserservice/repository/UserRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,21 @@ | ||
package gov.cabinetofice.gapuserservice.repository; | ||
|
||
import gov.cabinetofice.gapuserservice.model.User; | ||
import org.springframework.data.jpa.repository.EntityGraph; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.stereotype.Repository; | ||
|
||
import java.util.Optional; | ||
|
||
@Repository | ||
public interface UserRepository extends JpaRepository<User, Integer> { | ||
Optional<User> findByEmail(String email); | ||
|
||
@EntityGraph(attributePaths = {"department", "roles"}) | ||
Optional<User> findByEmailAddress(String email); | ||
@EntityGraph(attributePaths = {"department", "roles"}) | ||
Optional<User> findBySub(String sub); | ||
|
||
@EntityGraph(attributePaths = {"department", "roles"}) | ||
Optional<User> findById(int id); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.