Skip to content

Commit

Permalink
Merge pull request #2736 from objectcomputing/release/0.8
Browse files Browse the repository at this point in the history
Release v0.8.6
  • Loading branch information
mkimberlin authored Nov 7, 2024
2 parents 76da953 + c3f4c73 commit 29e2c84
Show file tree
Hide file tree
Showing 27 changed files with 494 additions and 551 deletions.
2 changes: 1 addition & 1 deletion server/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ plugins {
id "jacoco"
}

version "0.8.5"
version "0.8.6"
group "com.objectcomputing.checkins"

repositories {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,16 +64,22 @@ public class Guild {
@Schema(description = "Is the guild a community")
private boolean community;

public Guild(String name, @Nullable String description, @Nullable String link, boolean community) {
this(null, name, description, link, community);
@NotNull
@Column(name = "is_active")
@Schema(description = "whether the guild is active")
private boolean active = true;

public Guild(String name, @Nullable String description, @Nullable String link, boolean community, boolean active) {
this(null, name, description, link, community, active);
}

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

@Override
Expand All @@ -85,13 +91,14 @@ public boolean equals(Object o) {
Objects.equals(name, guild.name) &&
Objects.equals(description, guild.description) &&
Objects.equals(link, guild.link) &&
Objects.equals(community, guild.community);
Objects.equals(community, guild.community) &&
Objects.equals(active, guild.active);

}

@Override
public int hashCode() {
return Objects.hash(id, name, description, link, community);
return Objects.hash(id, name, description, link, community, active);
}

@Override
Expand All @@ -102,6 +109,7 @@ public String toString() {
", description='" + description + '\'' +
", link='" + link +
", community=" + community +
", active=" + active +
'}';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,16 @@ public class GuildCreateDTO {
@Schema(description = "Is the guild a community")
private boolean community;

public GuildCreateDTO(String name, @Nullable String description, @Nullable String link, boolean community) {
@NotNull
@Schema(description = "whether the guild is active")
private boolean active;

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

@Data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public interface GuildRepository extends CrudRepository<Guild, UUID> {
@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, " +
"PGP_SYM_DECRYPT(cast(link as bytea),'${aes.key}') as link, " +
"t_.community as community " +
"t_.community as community, is_active " +
"FROM guild t_ " +
"LEFT JOIN guild_member tm_ " +
" ON t_.id = tm_.guildid " +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,17 @@ public class GuildResponseDTO {
@Schema(description = "Is the guild a community")
private boolean community;

public GuildResponseDTO(UUID id, String name, @Nullable String description, @Nullable String link, boolean community) {
@NotNull
@Schema(description = "whether the guild is active")
private boolean active;

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

public List<GuildMemberResponseDTO> getGuildMembers() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ private Guild fromDTO(GuildUpdateDTO dto) {
if (dto == null) {
return null;
}
return new Guild(dto.getId(), dto.getName(), dto.getDescription(), dto.getLink(), dto.isCommunity());
return new Guild(dto.getId(), dto.getName(), dto.getDescription(), dto.getLink(), dto.isCommunity(), dto.isActive());
}

private GuildMember fromMemberDTO(GuildCreateDTO.GuildMemberCreateDTO memberDTO, UUID guildId) {
Expand All @@ -276,7 +276,7 @@ private GuildResponseDTO fromEntity(Guild entity, List<GuildMemberResponseDTO> m
return null;
}
GuildResponseDTO dto = new GuildResponseDTO(entity.getId(), entity.getName(), entity.getDescription(),
entity.getLink(), entity.isCommunity());
entity.getLink(), entity.isCommunity(), entity.isActive());
dto.setGuildMembers(memberEntities);
return dto;
}
Expand All @@ -285,7 +285,7 @@ private Guild fromDTO(GuildCreateDTO dto) {
if (dto == null) {
return null;
}
return new Guild(null, dto.getName(), dto.getDescription(), dto.getLink(), dto.isCommunity());
return new Guild(null, dto.getName(), dto.getDescription(), dto.getLink(), dto.isCommunity(), dto.isActive());
}

private GuildMemberResponseDTO fromMemberEntity(GuildMember guildMember, MemberProfile memberProfile) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,21 @@ public class GuildUpdateDTO {
@Schema(description = "Is the guild a community")
private boolean community;

public GuildUpdateDTO(UUID id, String name, @Nullable String description, @Nullable String link, boolean community) {
@NotNull
@Schema(description = "whether the guild is active")
private boolean active;

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

public GuildUpdateDTO(String id, String name, String description, @Nullable String link, boolean community) {
this(nullSafeUUIDFromString(id), name, description, link, community);
public GuildUpdateDTO(String id, String name, String description, @Nullable String link, boolean community, boolean active) {
this(nullSafeUUIDFromString(id), name, description, link, community, active);
}

public GuildUpdateDTO() {
Expand Down Expand Up @@ -75,4 +80,4 @@ public GuildMemberUpdateDTO(UUID id, UUID memberId, Boolean lead) {
this.lead = lead;
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE guild ADD COLUMN is_active BOOLEAN DEFAULT TRUE;
4 changes: 2 additions & 2 deletions server/src/main/resources/db/dev/R__Load_testing_data.sql
Original file line number Diff line number Diff line change
Expand Up @@ -1291,12 +1291,12 @@ VALUES
INSERT INTO review_periods
(id, name, review_status, review_template_id, self_review_template_id, launch_date, self_review_close_date, close_date, period_start_date, period_end_date)
VALUES
('12345678-e29c-4cf4-9ea4-6baa09405c57', 'Review Period 1', 'PLANNING', 'd1e94b60-47c4-4945-87d1-4dc88f088e57', '926a37a4-4ded-4633-8900-715b0383aecc', '2024-09-01 06:00:00', '2024-09-02 06:00:00', '2024-09-03 06:00:00', '2024-01-01 06:00:00', '2024-08-31 06:00:00');
('12345678-e29c-4cf4-9ea4-6baa09405c57', 'Review Period 1', 'PLANNING', 'd1e94b60-47c4-4945-87d1-4dc88f088e57', '926a37a4-4ded-4633-8900-715b0383aecc', CURRENT_DATE + TIME '06:00:00', CURRENT_DATE + INTERVAL '1' DAY + TIME '06:00:00', CURRENT_DATE + INTERVAL '2' DAY + TIME '06:00:00', date_trunc('year', CURRENT_DATE) + TIME '06:00:00', CURRENT_DATE + INTERVAL '-1' DAY + TIME '06:00:00');

INSERT INTO review_periods
(id, name, review_status, review_template_id, self_review_template_id, launch_date, self_review_close_date, close_date, period_start_date, period_end_date)
VALUES
('12345678-e29c-4cf4-9ea4-6baa09405c58', 'Review Period 2', 'PLANNING', 'd1e94b60-47c4-4945-87d1-4dc88f088e57', '926a37a4-4ded-4633-8900-715b0383aecc', '2024-09-10 06:00:00', '2024-09-11 06:00:00', '2024-09-12 06:00:00', '2024-01-01 06:00:00', '2024-08-31 06:00:00');
('12345678-e29c-4cf4-9ea4-6baa09405c58', 'Review Period 2', 'PLANNING', 'd1e94b60-47c4-4945-87d1-4dc88f088e57', '926a37a4-4ded-4633-8900-715b0383aecc', CURRENT_DATE + TIME '06:00:00', CURRENT_DATE + INTERVAL '1' DAY + TIME '06:00:00', CURRENT_DATE + INTERVAL '2' DAY + TIME '06:00:00', date_trunc('year', CURRENT_DATE) + TIME '06:00:00', CURRENT_DATE + INTERVAL '-1' DAY + TIME '06:00:00');

INSERT INTO review_periods
(id, name, review_status, review_template_id, self_review_template_id, launch_date, self_review_close_date, close_date, period_start_date, period_end_date)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,27 @@ public interface GuildFixture extends MemberProfileFixture, RepositoryFixture{
String COMPASS_ADDRESS = "https://www.compass.objectcomputing.com/";

default Guild createDefaultGuild() {
return getGuildRepository().save(new Guild(UUID.randomUUID(), "Ninja", "Warriors", COMPASS_ADDRESS+"ninja_warriors/", false));
return getGuildRepository().save(new Guild(UUID.randomUUID(), "Ninja", "Warriors", COMPASS_ADDRESS+"ninja_warriors/", false, true));
}

default Guild createAnotherDefaultGuild() {
return getGuildRepository().save(new Guild(UUID.randomUUID(), "Coding", "Warriors", COMPASS_ADDRESS+"coding_warriors/", false));
return getGuildRepository().save(new Guild(UUID.randomUUID(), "Coding", "Warriors", COMPASS_ADDRESS+"coding_warriors/", false, true));
}

default GuildCreateDTO createFromEntity(Guild entity) {
return new GuildCreateDTO(entity.getName(), entity.getDescription(), entity.getLink(), false);
return new GuildCreateDTO(entity.getName(), entity.getDescription(), entity.getLink(), false, true);
}

default GuildUpdateDTO updateFromEntity(Guild entity) {
return new GuildUpdateDTO(entity.getId(), entity.getName(), entity.getDescription(),entity.getLink(), entity.isCommunity());
return new GuildUpdateDTO(entity.getId(), entity.getName(), entity.getDescription(),entity.getLink(), entity.isCommunity(), entity.isActive());
}

default GuildResponseDTO responseFromEntity(Guild entity) {
return new GuildResponseDTO(entity.getId(), entity.getName(), entity.getDescription(),entity.getLink(), entity.isCommunity());
return new GuildResponseDTO(entity.getId(), entity.getName(), entity.getDescription(),entity.getLink(), entity.isCommunity(), entity.isActive());
}

default Guild entityFromDTO(GuildUpdateDTO dto) {
return new Guild(dto.getId(), dto.getName(), dto.getDescription(),dto.getLink(), dto.isCommunity());
return new Guild(dto.getId(), dto.getName(), dto.getDescription(),dto.getLink(), dto.isCommunity(), dto.isActive());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ void testUpdateGuildWithExistingMembers() {
void testUpdateGuildNullName() {
Guild guildEntity = createDefaultGuild();

GuildUpdateDTO requestBody = new GuildUpdateDTO(guildEntity.getId(), null, null, null, false);
GuildUpdateDTO requestBody = new GuildUpdateDTO(guildEntity.getId(), null, null, null, false, true);
requestBody.setGuildMembers(new ArrayList<>());

final HttpRequest<GuildUpdateDTO> request = HttpRequest.PUT("", requestBody)
Expand Down Expand Up @@ -434,7 +434,7 @@ void testUpdateGuildNotExist() {
Guild guildEntity = createDefaultGuild();
UUID requestId = UUID.randomUUID();
GuildUpdateDTO requestBody = new GuildUpdateDTO(requestId.toString(), guildEntity.getName(),
guildEntity.getDescription(), guildEntity.getLink(), guildEntity.isCommunity());
guildEntity.getDescription(), guildEntity.getLink(), guildEntity.isCommunity(), guildEntity.isActive());
requestBody.setGuildMembers(new ArrayList<>());

MemberProfile memberProfileOfAdmin = createAnUnrelatedUser();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ void setUp() {
void testGuildInstantiation() {
final String name = "name";
final String description = "description";
Guild guild = new Guild(name, description, null, false);
Guild guild = new Guild(name, description, null, false, true);
assertEquals(guild.getName(), name);
assertEquals(guild.getDescription(), description);
}
Expand All @@ -112,7 +112,7 @@ void testGuildInstantiation2() {
final String name = "name";
final String description = "description";
final String link = "https://www.compass.objectcomputing.com/guilds/name";
Guild guild = new Guild(id, name, description, link, false);
Guild guild = new Guild(id, name, description, link, false, true);
assertEquals(guild.getId(), id);
assertEquals(guild.getName(), name);
assertEquals(guild.getDescription(), description);
Expand All @@ -126,7 +126,7 @@ void testConstraintViolation() {
final UUID id = UUID.randomUUID();
final String name = "name";
final String description = "description";
Guild guild = new Guild(id, name, description, null, false);
Guild guild = new Guild(id, name, description, null, false, true);

guild.setName("");

Expand All @@ -143,8 +143,8 @@ void testEquals() {
final String name = "name";
final String description = "description";
final String link = "https://www.compass.objectcomputing.com/guilds/name";
Guild g = new Guild(id, name, description, link, false);
Guild g2 = new Guild(id, name, description, link, false);
Guild g = new Guild(id, name, description, link, false, true);
Guild g2 = new Guild(id, name, description, link, false, true);

assertEquals(g, g2);

Expand All @@ -160,7 +160,7 @@ void testHash() {
final String name = "name";
final String description = "description";
final String link = "https://www.compass.objectcomputing.com/guilds/name";
Guild g = new Guild(id, name, description, link, false);
Guild g = new Guild(id, name, description, link, false, true);

map.put(g, true);

Expand All @@ -174,7 +174,7 @@ void testToString() {
final String description = "description------description";
final String link = "https://www.compass.objectcomputing.com/guilds/name";
final String isCommunity = "false";
Guild g = new Guild(id, name, description,link, false);
Guild g = new Guild(id, name, description,link, false, true);

String s = g.toString();
assertTrue(s.contains(name));
Expand Down Expand Up @@ -261,7 +261,7 @@ void testSaveGuildWithValidData() {
MemberProfile memberProfile = new MemberProfile();
memberProfile.setWorkEmail("[email protected]");

Guild guild = new Guild(UUID.randomUUID(), "test", "example", link, true);
Guild guild = new Guild(UUID.randomUUID(), "test", "example", link, true, true);
when(guildsRepo.search(any(), any())).thenReturn(Collections.emptyList());
when(guildsRepo.save(any())).thenReturn(guild);
when(memberProfileServices.getById(any())).thenReturn(memberProfile);
Expand Down
4 changes: 2 additions & 2 deletions web-ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "web-ui",
"version": "0.8.5",
"version": "0.8.6",
"private": true,
"type": "module",
"dependencies": {
Expand Down Expand Up @@ -89,7 +89,7 @@
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-vitest": "^0.5.4",
"globals": "^15.0.0",
"happy-dom": "^14.3.9",
"happy-dom": "^15.10.2",
"jest-fetch-mock": "^3.0.3",
"jsdom": "^24.0.0",
"msw": "^2.2.13",
Expand Down
36 changes: 26 additions & 10 deletions web-ui/src/components/guild-results/EditGuildModal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import {
FormControlLabel,
Modal,
Switch,
TextField
TextField,
Checkbox,
} from '@mui/material';
import Autocomplete from '@mui/material/Autocomplete';
import './EditGuildModal.css';
Expand Down Expand Up @@ -156,15 +157,30 @@ const EditGuildModal = ({ guild = {}, open, onSave, onClose, headerText }) => {
<Modal open={open} onClose={close} aria-labelledby="edit-guild-modal-title">
<div className="EditGuildModal">
<h2>{headerText}</h2>
<TextField
id="guild-name-input"
label="Guild Name"
required
className="halfWidth"
placeholder="Awesome Guild"
value={editedGuild.name ? editedGuild.name : ''}
onChange={e => setGuild({ ...editedGuild, name: e.target.value })}
/>
<div>
<TextField
id="guild-name-input"
label="Guild Name"
required
className="halfWidth"
placeholder="Awesome Guild"
value={editedGuild.name ? editedGuild.name : ''}
onChange={e => setGuild({ ...editedGuild, name: e.target.value })}
/>
{guild.id && (<>
<Checkbox
id="guild-active-input"
label="Active"
variant="outlined"
className="halfWidth"
checked={editedGuild.active ? editedGuild.active : false}
onChange={event => {
const { checked } = event.target;
setGuild({ ...editedGuild, active: checked });
}}
/> Active
</>)}
</div>
<div>
<FormControlLabel
control={
Expand Down
Loading

0 comments on commit 29e2c84

Please sign in to comment.