Skip to content

Commit 29e2c84

Browse files
authored
Merge pull request #2736 from objectcomputing/release/0.8
Release v0.8.6
2 parents 76da953 + c3f4c73 commit 29e2c84

27 files changed

+494
-551
lines changed

server/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ plugins {
77
id "jacoco"
88
}
99

10-
version "0.8.5"
10+
version "0.8.6"
1111
group "com.objectcomputing.checkins"
1212

1313
repositories {

server/src/main/java/com/objectcomputing/checkins/services/guild/Guild.java

+13-5
Original file line numberDiff line numberDiff line change
@@ -64,16 +64,22 @@ public class Guild {
6464
@Schema(description = "Is the guild a community")
6565
private boolean community;
6666

67-
public Guild(String name, @Nullable String description, @Nullable String link, boolean community) {
68-
this(null, name, description, link, community);
67+
@NotNull
68+
@Column(name = "is_active")
69+
@Schema(description = "whether the guild is active")
70+
private boolean active = true;
71+
72+
public Guild(String name, @Nullable String description, @Nullable String link, boolean community, boolean active) {
73+
this(null, name, description, link, community, active);
6974
}
7075

71-
public Guild(UUID id, String name, @Nullable String description, @Nullable String link, boolean community) {
76+
public Guild(UUID id, String name, @Nullable String description, @Nullable String link, boolean community, boolean active) {
7277
this.id = id;
7378
this.name = name;
7479
this.description = description;
7580
this.link = link;
7681
this.community = community;
82+
this.active = active;
7783
}
7884

7985
@Override
@@ -85,13 +91,14 @@ public boolean equals(Object o) {
8591
Objects.equals(name, guild.name) &&
8692
Objects.equals(description, guild.description) &&
8793
Objects.equals(link, guild.link) &&
88-
Objects.equals(community, guild.community);
94+
Objects.equals(community, guild.community) &&
95+
Objects.equals(active, guild.active);
8996

9097
}
9198

9299
@Override
93100
public int hashCode() {
94-
return Objects.hash(id, name, description, link, community);
101+
return Objects.hash(id, name, description, link, community, active);
95102
}
96103

97104
@Override
@@ -102,6 +109,7 @@ public String toString() {
102109
", description='" + description + '\'' +
103110
", link='" + link +
104111
", community=" + community +
112+
", active=" + active +
105113
'}';
106114
}
107115
}

server/src/main/java/com/objectcomputing/checkins/services/guild/GuildCreateDTO.java

+6-1
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,16 @@ public class GuildCreateDTO {
3636
@Schema(description = "Is the guild a community")
3737
private boolean community;
3838

39-
public GuildCreateDTO(String name, @Nullable String description, @Nullable String link, boolean community) {
39+
@NotNull
40+
@Schema(description = "whether the guild is active")
41+
private boolean active;
42+
43+
public GuildCreateDTO(String name, @Nullable String description, @Nullable String link, boolean community, boolean active) {
4044
this.name = name;
4145
this.description = description;
4246
this.link =link;
4347
this.community = community;
48+
this.active = active;
4449
}
4550

4651
@Data

server/src/main/java/com/objectcomputing/checkins/services/guild/GuildRepository.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public interface GuildRepository extends CrudRepository<Guild, UUID> {
2929
@Query(value = "SELECT t_.id, PGP_SYM_DECRYPT(cast(t_.name as bytea),'${aes.key}') as name, " +
3030
"PGP_SYM_DECRYPT(cast(description as bytea),'${aes.key}') as description, " +
3131
"PGP_SYM_DECRYPT(cast(link as bytea),'${aes.key}') as link, " +
32-
"t_.community as community " +
32+
"t_.community as community, is_active " +
3333
"FROM guild t_ " +
3434
"LEFT JOIN guild_member tm_ " +
3535
" ON t_.id = tm_.guildid " +

server/src/main/java/com/objectcomputing/checkins/services/guild/GuildResponseDTO.java

+6-1
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,17 @@ public class GuildResponseDTO {
4040
@Schema(description = "Is the guild a community")
4141
private boolean community;
4242

43-
public GuildResponseDTO(UUID id, String name, @Nullable String description, @Nullable String link, boolean community) {
43+
@NotNull
44+
@Schema(description = "whether the guild is active")
45+
private boolean active;
46+
47+
public GuildResponseDTO(UUID id, String name, @Nullable String description, @Nullable String link, boolean community, boolean active) {
4448
this.id = id;
4549
this.name = name;
4650
this.description = description;
4751
this.link = link;
4852
this.community = community;
53+
this.active = active;
4954
}
5055

5156
public List<GuildMemberResponseDTO> getGuildMembers() {

server/src/main/java/com/objectcomputing/checkins/services/guild/GuildServicesImpl.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ private Guild fromDTO(GuildUpdateDTO dto) {
252252
if (dto == null) {
253253
return null;
254254
}
255-
return new Guild(dto.getId(), dto.getName(), dto.getDescription(), dto.getLink(), dto.isCommunity());
255+
return new Guild(dto.getId(), dto.getName(), dto.getDescription(), dto.getLink(), dto.isCommunity(), dto.isActive());
256256
}
257257

258258
private GuildMember fromMemberDTO(GuildCreateDTO.GuildMemberCreateDTO memberDTO, UUID guildId) {
@@ -276,7 +276,7 @@ private GuildResponseDTO fromEntity(Guild entity, List<GuildMemberResponseDTO> m
276276
return null;
277277
}
278278
GuildResponseDTO dto = new GuildResponseDTO(entity.getId(), entity.getName(), entity.getDescription(),
279-
entity.getLink(), entity.isCommunity());
279+
entity.getLink(), entity.isCommunity(), entity.isActive());
280280
dto.setGuildMembers(memberEntities);
281281
return dto;
282282
}
@@ -285,7 +285,7 @@ private Guild fromDTO(GuildCreateDTO dto) {
285285
if (dto == null) {
286286
return null;
287287
}
288-
return new Guild(null, dto.getName(), dto.getDescription(), dto.getLink(), dto.isCommunity());
288+
return new Guild(null, dto.getName(), dto.getDescription(), dto.getLink(), dto.isCommunity(), dto.isActive());
289289
}
290290

291291
private GuildMemberResponseDTO fromMemberEntity(GuildMember guildMember, MemberProfile memberProfile) {

server/src/main/java/com/objectcomputing/checkins/services/guild/GuildUpdateDTO.java

+9-4
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,21 @@ public class GuildUpdateDTO {
3737
@Schema(description = "Is the guild a community")
3838
private boolean community;
3939

40-
public GuildUpdateDTO(UUID id, String name, @Nullable String description, @Nullable String link, boolean community) {
40+
@NotNull
41+
@Schema(description = "whether the guild is active")
42+
private boolean active;
43+
44+
public GuildUpdateDTO(UUID id, String name, @Nullable String description, @Nullable String link, boolean community, boolean active) {
4145
this.id = id;
4246
this.name = name;
4347
this.description = description;
4448
this.link = link;
4549
this.community = community;
50+
this.active = active;
4651
}
4752

48-
public GuildUpdateDTO(String id, String name, String description, @Nullable String link, boolean community) {
49-
this(nullSafeUUIDFromString(id), name, description, link, community);
53+
public GuildUpdateDTO(String id, String name, String description, @Nullable String link, boolean community, boolean active) {
54+
this(nullSafeUUIDFromString(id), name, description, link, community, active);
5055
}
5156

5257
public GuildUpdateDTO() {
@@ -75,4 +80,4 @@ public GuildMemberUpdateDTO(UUID id, UUID memberId, Boolean lead) {
7580
this.lead = lead;
7681
}
7782
}
78-
}
83+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ALTER TABLE guild ADD COLUMN is_active BOOLEAN DEFAULT TRUE;

server/src/main/resources/db/dev/R__Load_testing_data.sql

+2-2
Original file line numberDiff line numberDiff line change
@@ -1291,12 +1291,12 @@ VALUES
12911291
INSERT INTO review_periods
12921292
(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)
12931293
VALUES
1294-
('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');
1294+
('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');
12951295

12961296
INSERT INTO review_periods
12971297
(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)
12981298
VALUES
1299-
('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');
1299+
('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');
13001300

13011301
INSERT INTO review_periods
13021302
(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)

server/src/test/java/com/objectcomputing/checkins/services/fixture/GuildFixture.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -12,27 +12,27 @@ public interface GuildFixture extends MemberProfileFixture, RepositoryFixture{
1212
String COMPASS_ADDRESS = "https://www.compass.objectcomputing.com/";
1313

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

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

2222
default GuildCreateDTO createFromEntity(Guild entity) {
23-
return new GuildCreateDTO(entity.getName(), entity.getDescription(), entity.getLink(), false);
23+
return new GuildCreateDTO(entity.getName(), entity.getDescription(), entity.getLink(), false, true);
2424
}
2525

2626
default GuildUpdateDTO updateFromEntity(Guild entity) {
27-
return new GuildUpdateDTO(entity.getId(), entity.getName(), entity.getDescription(),entity.getLink(), entity.isCommunity());
27+
return new GuildUpdateDTO(entity.getId(), entity.getName(), entity.getDescription(),entity.getLink(), entity.isCommunity(), entity.isActive());
2828
}
2929

3030
default GuildResponseDTO responseFromEntity(Guild entity) {
31-
return new GuildResponseDTO(entity.getId(), entity.getName(), entity.getDescription(),entity.getLink(), entity.isCommunity());
31+
return new GuildResponseDTO(entity.getId(), entity.getName(), entity.getDescription(),entity.getLink(), entity.isCommunity(), entity.isActive());
3232
}
3333

3434
default Guild entityFromDTO(GuildUpdateDTO dto) {
35-
return new Guild(dto.getId(), dto.getName(), dto.getDescription(),dto.getLink(), dto.isCommunity());
35+
return new Guild(dto.getId(), dto.getName(), dto.getDescription(),dto.getLink(), dto.isCommunity(), dto.isActive());
3636
}
3737

3838
}

server/src/test/java/com/objectcomputing/checkins/services/guild/GuildControllerTest.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ void testUpdateGuildWithExistingMembers() {
399399
void testUpdateGuildNullName() {
400400
Guild guildEntity = createDefaultGuild();
401401

402-
GuildUpdateDTO requestBody = new GuildUpdateDTO(guildEntity.getId(), null, null, null, false);
402+
GuildUpdateDTO requestBody = new GuildUpdateDTO(guildEntity.getId(), null, null, null, false, true);
403403
requestBody.setGuildMembers(new ArrayList<>());
404404

405405
final HttpRequest<GuildUpdateDTO> request = HttpRequest.PUT("", requestBody)
@@ -434,7 +434,7 @@ void testUpdateGuildNotExist() {
434434
Guild guildEntity = createDefaultGuild();
435435
UUID requestId = UUID.randomUUID();
436436
GuildUpdateDTO requestBody = new GuildUpdateDTO(requestId.toString(), guildEntity.getName(),
437-
guildEntity.getDescription(), guildEntity.getLink(), guildEntity.isCommunity());
437+
guildEntity.getDescription(), guildEntity.getLink(), guildEntity.isCommunity(), guildEntity.isActive());
438438
requestBody.setGuildMembers(new ArrayList<>());
439439

440440
MemberProfile memberProfileOfAdmin = createAnUnrelatedUser();

server/src/test/java/com/objectcomputing/checkins/services/guild/GuildTest.java

+8-8
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ void setUp() {
101101
void testGuildInstantiation() {
102102
final String name = "name";
103103
final String description = "description";
104-
Guild guild = new Guild(name, description, null, false);
104+
Guild guild = new Guild(name, description, null, false, true);
105105
assertEquals(guild.getName(), name);
106106
assertEquals(guild.getDescription(), description);
107107
}
@@ -112,7 +112,7 @@ void testGuildInstantiation2() {
112112
final String name = "name";
113113
final String description = "description";
114114
final String link = "https://www.compass.objectcomputing.com/guilds/name";
115-
Guild guild = new Guild(id, name, description, link, false);
115+
Guild guild = new Guild(id, name, description, link, false, true);
116116
assertEquals(guild.getId(), id);
117117
assertEquals(guild.getName(), name);
118118
assertEquals(guild.getDescription(), description);
@@ -126,7 +126,7 @@ void testConstraintViolation() {
126126
final UUID id = UUID.randomUUID();
127127
final String name = "name";
128128
final String description = "description";
129-
Guild guild = new Guild(id, name, description, null, false);
129+
Guild guild = new Guild(id, name, description, null, false, true);
130130

131131
guild.setName("");
132132

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

149149
assertEquals(g, g2);
150150

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

165165
map.put(g, true);
166166

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

179179
String s = g.toString();
180180
assertTrue(s.contains(name));
@@ -261,7 +261,7 @@ void testSaveGuildWithValidData() {
261261
MemberProfile memberProfile = new MemberProfile();
262262
memberProfile.setWorkEmail("[email protected]");
263263

264-
Guild guild = new Guild(UUID.randomUUID(), "test", "example", link, true);
264+
Guild guild = new Guild(UUID.randomUUID(), "test", "example", link, true, true);
265265
when(guildsRepo.search(any(), any())).thenReturn(Collections.emptyList());
266266
when(guildsRepo.save(any())).thenReturn(guild);
267267
when(memberProfileServices.getById(any())).thenReturn(memberProfile);

web-ui/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "web-ui",
3-
"version": "0.8.5",
3+
"version": "0.8.6",
44
"private": true,
55
"type": "module",
66
"dependencies": {
@@ -89,7 +89,7 @@
8989
"eslint-plugin-react-hooks": "^4.6.0",
9090
"eslint-plugin-vitest": "^0.5.4",
9191
"globals": "^15.0.0",
92-
"happy-dom": "^14.3.9",
92+
"happy-dom": "^15.10.2",
9393
"jest-fetch-mock": "^3.0.3",
9494
"jsdom": "^24.0.0",
9595
"msw": "^2.2.13",

web-ui/src/components/guild-results/EditGuildModal.jsx

+26-10
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ import {
1111
FormControlLabel,
1212
Modal,
1313
Switch,
14-
TextField
14+
TextField,
15+
Checkbox,
1516
} from '@mui/material';
1617
import Autocomplete from '@mui/material/Autocomplete';
1718
import './EditGuildModal.css';
@@ -156,15 +157,30 @@ const EditGuildModal = ({ guild = {}, open, onSave, onClose, headerText }) => {
156157
<Modal open={open} onClose={close} aria-labelledby="edit-guild-modal-title">
157158
<div className="EditGuildModal">
158159
<h2>{headerText}</h2>
159-
<TextField
160-
id="guild-name-input"
161-
label="Guild Name"
162-
required
163-
className="halfWidth"
164-
placeholder="Awesome Guild"
165-
value={editedGuild.name ? editedGuild.name : ''}
166-
onChange={e => setGuild({ ...editedGuild, name: e.target.value })}
167-
/>
160+
<div>
161+
<TextField
162+
id="guild-name-input"
163+
label="Guild Name"
164+
required
165+
className="halfWidth"
166+
placeholder="Awesome Guild"
167+
value={editedGuild.name ? editedGuild.name : ''}
168+
onChange={e => setGuild({ ...editedGuild, name: e.target.value })}
169+
/>
170+
{guild.id && (<>
171+
<Checkbox
172+
id="guild-active-input"
173+
label="Active"
174+
variant="outlined"
175+
className="halfWidth"
176+
checked={editedGuild.active ? editedGuild.active : false}
177+
onChange={event => {
178+
const { checked } = event.target;
179+
setGuild({ ...editedGuild, active: checked });
180+
}}
181+
/> Active
182+
</>)}
183+
</div>
168184
<div>
169185
<FormControlLabel
170186
control={

0 commit comments

Comments
 (0)