Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,19 @@ public class Team {
@Schema(description = "description of the team", nullable = true)
private String description;

@Column(name = "is_active")
@Schema(description = "whether the team is active")
private boolean active = true;

public Team(String name, @Nullable String description) {
this(null, name, description);
this(null, name, description, true);
}

public Team(UUID id, String name, @Nullable String description) {
public Team(UUID id, String name, @Nullable String description, boolean active) {
this.id = id;
this.name = name;
this.description = description;
this.active = active;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,17 @@ public class TeamCreateDTO {
@Schema(description = "description of the team")
private String description;

@NotNull
@Schema(description = "whether the team is active")
private boolean active;

@Schema(description = "members of this team")
private List<TeamMemberCreateDTO> teamMembers;

public TeamCreateDTO(String name, @Nullable String description) {
public TeamCreateDTO(String name, @Nullable String description, boolean active) {
this.name = name;
this.description = description;
this.active = active;
}

@Data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public interface TeamRepository extends CrudRepository<Team, UUID> {
@Override
<S extends Team> S save(@Valid @NotNull @NonNull S entity);

@Query(value = "SELECT t_.id, PGP_SYM_DECRYPT(cast(t_.name as bytea),'${aes.key}') as name, PGP_SYM_DECRYPT(cast(description as bytea),'${aes.key}') as description " +
@Query(value = "SELECT t_.id, PGP_SYM_DECRYPT(cast(t_.name as bytea),'${aes.key}') as name, PGP_SYM_DECRYPT(cast(description as bytea),'${aes.key}') as description, is_active " +
"FROM team t_ " +
"LEFT JOIN team_member tm_ " +
" ON t_.id = tm_.teamid " +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,21 @@ public class TeamResponseDTO {
@Schema(description = "description of the team")
private String description;

@NotNull
@Schema(description = "whether the team is active")
private boolean active;

List<TeamMemberResponseDTO> teamMembers;

public TeamResponseDTO(UUID id, String name, @Nullable String description) {
public TeamResponseDTO(UUID id, String name, @Nullable String description, boolean active) {
this.id = id;
this.name = name;
this.description = description;
this.active = active;
}

public TeamResponseDTO(String id, String name, @Nullable String description) {
this(UUID.fromString(id), name, description);
public TeamResponseDTO(String id, String name, @Nullable String description, boolean active) {
this(UUID.fromString(id), name, description, active);
}

public TeamResponseDTO() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ private Team fromDTO(TeamUpdateDTO dto) {
if (dto == null) {
return null;
}
return new Team(dto.getId(), dto.getName(), dto.getDescription());
return new Team(dto.getId(), dto.getName(), dto.getDescription(), dto.isActive());
}

private TeamMember fromMemberDTO(TeamCreateDTO.TeamMemberCreateDTO memberDTO, UUID teamId) {
Expand All @@ -183,7 +183,7 @@ private TeamResponseDTO fromEntity(Team entity, List<TeamMemberResponseDTO> memb
if (entity == null) {
return null;
}
TeamResponseDTO dto = new TeamResponseDTO(entity.getId(), entity.getName(), entity.getDescription());
TeamResponseDTO dto = new TeamResponseDTO(entity.getId(), entity.getName(), entity.getDescription(), entity.isActive());
dto.setTeamMembers(memberEntities);
return dto;
}
Expand All @@ -192,7 +192,7 @@ private Team fromDTO(TeamCreateDTO dto) {
if (dto == null) {
return null;
}
return new Team(null, dto.getName(), dto.getDescription());
return new Team(null, dto.getName(), dto.getDescription(), dto.isActive());
}

private TeamMemberResponseDTO fromMemberEntity(TeamMember teamMember, MemberProfile memberProfile) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,22 @@ public class TeamUpdateDTO {
@Schema(description = "description of the team")
private String description;

@NotNull
@Schema(description = "whether the team is active")
private boolean active;

@Schema(description = "members of this team")
private List<TeamMemberUpdateDTO> teamMembers;

public TeamUpdateDTO(UUID id, String name, @Nullable String description) {
public TeamUpdateDTO(UUID id, String name, @Nullable String description, boolean active) {
this.id = id;
this.name = name;
this.description = description;
this.active = active;
}

public TeamUpdateDTO(String id, String name, String description) {
this(nullSafeUUIDFromString(id), name, description);
public TeamUpdateDTO(String id, String name, String description, boolean active) {
this(nullSafeUUIDFromString(id), name, description, active);
}

public TeamUpdateDTO() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE team ADD COLUMN is_active BOOLEAN DEFAULT TRUE;
18 changes: 9 additions & 9 deletions server/src/main/resources/db/dev/R__Load_testing_data.sql
Original file line number Diff line number Diff line change
Expand Up @@ -320,24 +320,24 @@ VALUES

-- Teams
INSERT INTO team -- Checkins Experts
(id, name, description)
(id, name, description, is_active)
VALUES
('a8733740-cf4c-4c16-a8cf-4f928c409acc', PGP_SYM_ENCRYPT('Checkins Experts','${aeskey}'), PGP_SYM_ENCRYPT('Checkins Engineers of superior knowledge','${aeskey}'));
('a8733740-cf4c-4c16-a8cf-4f928c409acc', PGP_SYM_ENCRYPT('Checkins Experts','${aeskey}'), PGP_SYM_ENCRYPT('Checkins Engineers of superior knowledge','${aeskey}'), true);

INSERT INTO team -- JavaScript Gurus
(id, name, description)
(id, name, description, is_active)
VALUES
('e8f052a8-40b5-4fb4-9bab-8b16ed36adc7', PGP_SYM_ENCRYPT('JavaScript Gurus','${aeskey}'), PGP_SYM_ENCRYPT('JavaScript Engineers of Outstanding Skill','${aeskey}'));
('e8f052a8-40b5-4fb4-9bab-8b16ed36adc7', PGP_SYM_ENCRYPT('JavaScript Gurus','${aeskey}'), PGP_SYM_ENCRYPT('JavaScript Engineers of Outstanding Skill','${aeskey}'), true);

INSERT INTO team -- Micronaut Genii
(id, name, description)
(id, name, description, is_active)
VALUES
('036b95a5-357c-45bd-b60e-e8e2e1afec83', PGP_SYM_ENCRYPT('Micronaut Genii','${aeskey}'), PGP_SYM_ENCRYPT('Micronaut Engineers of Genius Caliber','${aeskey}'));
('036b95a5-357c-45bd-b60e-e8e2e1afec83', PGP_SYM_ENCRYPT('Micronaut Genii','${aeskey}'), PGP_SYM_ENCRYPT('Micronaut Engineers of Genius Caliber','${aeskey}'), true);

INSERT INTO team -- PMO Superness
(id, name, description)
(id, name, description, is_active)
VALUES
('e545dfa1-a07d-4099-9a5b-ed14f07b87cc', PGP_SYM_ENCRYPT('PMO Superness','${aeskey}'), PGP_SYM_ENCRYPT('Excellent PMO Artists','${aeskey}'));
('e545dfa1-a07d-4099-9a5b-ed14f07b87cc', PGP_SYM_ENCRYPT('PMO Superness','${aeskey}'), PGP_SYM_ENCRYPT('Excellent PMO Artists','${aeskey}'), true);


-- Team Members
Expand Down Expand Up @@ -1808,4 +1808,4 @@ VALUES
INSERT INTO role_documentation
(role_id, document_id, display_order)
VALUES
('d03f5f0b-e29c-4cf4-9ea4-6baa09405c56', 'b553d4c0-9b7a-4691-8fe0-e3bdda4f67ae', 3);
('d03f5f0b-e29c-4cf4-9ea4-6baa09405c56', 'b553d4c0-9b7a-4691-8fe0-e3bdda4f67ae', 3);
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,26 @@
public interface TeamFixture extends MemberProfileFixture, RepositoryFixture {

default Team createDefaultTeam() {
return getTeamRepository().save(new Team(UUID.randomUUID(), "Ninja", "Warriors"));
return getTeamRepository().save(new Team(UUID.randomUUID(), "Ninja", "Warriors", true));
}

default Team createAnotherDefaultTeam() {
return getTeamRepository().save(new Team(UUID.randomUUID(), "Coding", "Warriors"));
return getTeamRepository().save(new Team(UUID.randomUUID(), "Coding", "Warriors", true));
}

default TeamCreateDTO createFromEntity(Team entity) {
return new TeamCreateDTO(entity.getName(), entity.getDescription());
return new TeamCreateDTO(entity.getName(), entity.getDescription(), entity.isActive());
}

default TeamUpdateDTO updateFromEntity(Team entity) {
return new TeamUpdateDTO(entity.getId(), entity.getName(), entity.getDescription());
return new TeamUpdateDTO(entity.getId(), entity.getName(), entity.getDescription(), entity.isActive());
}

default TeamResponseDTO responseFromEntity(Team entity) {
return new TeamResponseDTO(entity.getId(), entity.getName(), entity.getDescription());
return new TeamResponseDTO(entity.getId(), entity.getName(), entity.getDescription(), entity.isActive());
}

default Team entityFromDTO(TeamUpdateDTO dto) {
return new Team(dto.getId(), dto.getName(), dto.getDescription());
return new Team(dto.getId(), dto.getName(), dto.getDescription(), dto.isActive());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ void testUpdateTeamSuccess() {
void testUpdateTeamNullName() {
Team teamEntity = createDefaultTeam();

TeamUpdateDTO requestBody = new TeamUpdateDTO(teamEntity.getId(), null, null);
TeamUpdateDTO requestBody = new TeamUpdateDTO(teamEntity.getId(), null, null, true);
requestBody.setTeamMembers(new ArrayList<>());

final HttpRequest<TeamUpdateDTO> request = HttpRequest.PUT("", requestBody)
Expand Down Expand Up @@ -288,7 +288,7 @@ void testUpdateTeamNotExist() {

Team teamEntity = createDefaultTeam();
UUID requestId = UUID.randomUUID();
TeamUpdateDTO requestBody = new TeamUpdateDTO(requestId.toString(), teamEntity.getName(), teamEntity.getDescription());
TeamUpdateDTO requestBody = new TeamUpdateDTO(requestId.toString(), teamEntity.getName(), teamEntity.getDescription(), teamEntity.isActive());
requestBody.setTeamMembers(new ArrayList<>());

final MutableHttpRequest<TeamUpdateDTO> request = HttpRequest.PUT("", requestBody)
Expand Down
9 changes: 9 additions & 0 deletions web-ui/src/components/team-results/EditTeamModal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
import { Button } from '@mui/material';
import Modal from '@mui/material/Modal';
import TextField from '@mui/material/TextField';
import Checkbox from '@mui/material/Checkbox';
import Autocomplete from '@mui/material/Autocomplete';
import './EditTeamModal.css';

Expand Down Expand Up @@ -173,6 +174,14 @@ const EditTeamModal = ({ team = {}, open, onSave, onClose, headerText }) => {
value={editedTeam.name ? editedTeam.name : ''}
onChange={e => setTeam({ ...editedTeam, name: e.target.value })}
/>
<Checkbox
id="team-active-input"
label="Active"
variant="outlined"
className="halfWidth"
checked={editedTeam.active ? editedTeam.active : false}
onChange={e => setTeam({ ...editedTeam, active: e.target.checked })}
/> Active
<TextField
id="team-description-input"
label="Description"
Expand Down
2 changes: 1 addition & 1 deletion web-ui/src/components/team-results/TeamSummaryCard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ const TeamSummaryCard = ({ team, index, onTeamSelect, selectedTeamId }) => {
title: classes.title,
subheader: classes.title
}}
title={team.name}
title={team.name + (team.active ? ' (Active)' : ' (Inactive)')}
subheader={
<Tooltip
open={tooltipIsOpen}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ exports[`renders correctly 1`] = `
<span
class="MuiTypography-root MuiTypography-h5 MuiCardHeader-title TeamSummaryCard-title css-1qvr50w-MuiTypography-root"
>
string
string (Inactive)
</span>
<span
class="MuiTypography-root MuiTypography-body1 MuiCardHeader-subheader TeamSummaryCard-title css-nrdprl-MuiTypography-root"
Expand Down Expand Up @@ -63,7 +63,7 @@ exports[`renders correctly for ADMIN 1`] = `
<span
class="MuiTypography-root MuiTypography-h5 MuiCardHeader-title TeamSummaryCard-title css-1qvr50w-MuiTypography-root"
>
string
string (Inactive)
</span>
<span
class="MuiTypography-root MuiTypography-body1 MuiCardHeader-subheader TeamSummaryCard-title css-nrdprl-MuiTypography-root"
Expand Down Expand Up @@ -153,7 +153,7 @@ exports[`renders correctly for team lead 1`] = `
<span
class="MuiTypography-root MuiTypography-h5 MuiCardHeader-title TeamSummaryCard-title css-1qvr50w-MuiTypography-root"
>
stuff
stuff (Inactive)
</span>
<span
class="MuiTypography-root MuiTypography-body1 MuiCardHeader-subheader TeamSummaryCard-title css-nrdprl-MuiTypography-root"
Expand Down