From e9aa548ad5c1befdcb338208dae6c2de15d3a951 Mon Sep 17 00:00:00 2001 From: sayoungestguy Date: Fri, 1 Nov 2024 19:44:11 +0800 Subject: [PATCH 1/6] System Cleanup (hide/delete stuff not in the proposal) --- .github/workflows/main.yml | 2 +- .jhipster/ActivityInvite.json | 4 - .../scaleup/domain/ActivityInvite.java | 17 ---- .../com/teamsixnus/scaleup/domain/User.java | 70 +++++++------- .../service/ActivityInviteQueryService.java | 3 - .../scaleup/service/UserService.java | 29 +++--- .../service/dto/ActivityInviteDTO.java | 11 --- .../scaleup/service/dto/AdminUserDTO.java | 70 +++++++------- .../scaleup/service/mapper/UserMapper.java | 6 +- .../scaleup/web/rest/AccountResource.java | 8 +- src/main/resources/.h2.server.properties | 2 +- .../00000000000000_initial_schema.xml | 3 - ...0825084259_added_entity_ActivityInvite.xml | 3 - .../resources/config/liquibase/data/user.csv | 6 +- .../liquibase/fake-data/activity_invite.csv | 22 ++--- .../activity-invite-update.tsx | 2 +- .../user-management-update.tsx | 46 ++++----- .../app/shared/layout/menus/account.tsx | 12 +-- .../webapp/app/shared/layout/menus/admin.tsx | 48 +++++----- .../scaleup/domain/ActivityInviteAsserts.java | 24 ++--- .../scaleup/service/UserServiceIT.java | 6 +- .../criteria/ActivityInviteCriteriaTest.java | 3 - .../service/mapper/UserMapperTest.java | 18 ++-- .../scaleup/web/rest/AccountResourceIT.java | 96 +++++++++---------- .../web/rest/ActivityInviteResourceIT.java | 82 +++------------- .../scaleup/web/rest/UserResourceIT.java | 96 +++++++++---------- 26 files changed, 295 insertions(+), 394 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9b4d56a..bd28920 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -216,7 +216,7 @@ jobs: elif [ "$(sudo docker ps -a -q -f name=scaleUp)" ]; then sudo docker rm scaleUp fi - sudo docker run -d -p 8080:8080 --name scaleUp ${{ secrets.DOCKER_USERNAME }}/scaleup:latest + sudo docker run -d -p 80:80 --name scaleUp ${{ secrets.DOCKER_USERNAME }}/scaleup:latest deploy-to-main: name: Deploy to Production diff --git a/.jhipster/ActivityInvite.json b/.jhipster/ActivityInvite.json index 3434b55..5e8d9dc 100644 --- a/.jhipster/ActivityInvite.json +++ b/.jhipster/ActivityInvite.json @@ -6,10 +6,6 @@ "dto": "mapstruct", "enableAudit": true, "fields": [ - { - "fieldName": "willParticipate", - "fieldType": "Boolean" - }, { "auditField": true, "autoGenerate": true, diff --git a/src/main/java/com/teamsixnus/scaleup/domain/ActivityInvite.java b/src/main/java/com/teamsixnus/scaleup/domain/ActivityInvite.java index 94ce19b..bb013b6 100644 --- a/src/main/java/com/teamsixnus/scaleup/domain/ActivityInvite.java +++ b/src/main/java/com/teamsixnus/scaleup/domain/ActivityInvite.java @@ -26,9 +26,6 @@ public class ActivityInvite extends AbstractAuditingEntity implements Seri @Column(name = "id") private Long id; - @Column(name = "will_participate") - private Boolean willParticipate; - // Inherited createdBy definition // Inherited createdDate definition // Inherited lastModifiedBy definition @@ -62,19 +59,6 @@ public void setId(Long id) { this.id = id; } - public Boolean getWillParticipate() { - return this.willParticipate; - } - - public ActivityInvite willParticipate(Boolean willParticipate) { - this.setWillParticipate(willParticipate); - return this; - } - - public void setWillParticipate(Boolean willParticipate) { - this.willParticipate = willParticipate; - } - // Inherited createdBy methods public ActivityInvite createdBy(String createdBy) { this.setCreatedBy(createdBy); @@ -179,7 +163,6 @@ public int hashCode() { public String toString() { return "ActivityInvite{" + "id=" + getId() + - ", willParticipate='" + getWillParticipate() + "'" + ", createdBy='" + getCreatedBy() + "'" + ", createdDate='" + getCreatedDate() + "'" + ", lastModifiedBy='" + getLastModifiedBy() + "'" + diff --git a/src/main/java/com/teamsixnus/scaleup/domain/User.java b/src/main/java/com/teamsixnus/scaleup/domain/User.java index ec93c88..c72a886 100644 --- a/src/main/java/com/teamsixnus/scaleup/domain/User.java +++ b/src/main/java/com/teamsixnus/scaleup/domain/User.java @@ -43,13 +43,13 @@ public class User extends AbstractAuditingEntity implements Serializable { @Column(name = "password_hash", length = 60, nullable = false) private String password; - @Size(max = 50) - @Column(name = "first_name", length = 50) - private String firstName; - - @Size(max = 50) - @Column(name = "last_name", length = 50) - private String lastName; + // @Size(max = 50) + // @Column(name = "first_name", length = 50) + // private String firstName; + // + // @Size(max = 50) + // @Column(name = "last_name", length = 50) + // private String lastName; @Email @Size(min = 5, max = 254) @@ -64,9 +64,9 @@ public class User extends AbstractAuditingEntity implements Serializable { @Column(name = "lang_key", length = 10) private String langKey; - @Size(max = 256) - @Column(name = "image_url", length = 256) - private String imageUrl; + // @Size(max = 256) + // @Column(name = "image_url", length = 256) + // private String imageUrl; @Size(max = 20) @Column(name = "activation_key", length = 20) @@ -117,21 +117,21 @@ public void setPassword(String password) { this.password = password; } - public String getFirstName() { - return firstName; - } - - public void setFirstName(String firstName) { - this.firstName = firstName; - } - - public String getLastName() { - return lastName; - } - - public void setLastName(String lastName) { - this.lastName = lastName; - } + // public String getFirstName() { + // return firstName; + // } + // + // public void setFirstName(String firstName) { + // this.firstName = firstName; + // } + // + // public String getLastName() { + // return lastName; + // } + // + // public void setLastName(String lastName) { + // this.lastName = lastName; + // } public String getEmail() { return email; @@ -141,13 +141,13 @@ public void setEmail(String email) { this.email = email; } - public String getImageUrl() { - return imageUrl; - } - - public void setImageUrl(String imageUrl) { - this.imageUrl = imageUrl; - } + // public String getImageUrl() { + // return imageUrl; + // } + // + // public void setImageUrl(String imageUrl) { + // this.imageUrl = imageUrl; + // } public boolean isActivated() { return activated; @@ -219,10 +219,10 @@ public int hashCode() { public String toString() { return "User{" + "login='" + login + '\'' + - ", firstName='" + firstName + '\'' + - ", lastName='" + lastName + '\'' + +// ", firstName='" + firstName + '\'' + +// ", lastName='" + lastName + '\'' + ", email='" + email + '\'' + - ", imageUrl='" + imageUrl + '\'' + +// ", imageUrl='" + imageUrl + '\'' + ", activated='" + activated + '\'' + ", langKey='" + langKey + '\'' + ", activationKey='" + activationKey + '\'' + diff --git a/src/main/java/com/teamsixnus/scaleup/service/ActivityInviteQueryService.java b/src/main/java/com/teamsixnus/scaleup/service/ActivityInviteQueryService.java index 08b637c..7b07f1f 100644 --- a/src/main/java/com/teamsixnus/scaleup/service/ActivityInviteQueryService.java +++ b/src/main/java/com/teamsixnus/scaleup/service/ActivityInviteQueryService.java @@ -99,9 +99,6 @@ protected Specification createSpecification(ActivityInviteCriter if (criteria.getId() != null) { specification = specification.and(buildRangeSpecification(criteria.getId(), ActivityInvite_.id)); } - if (criteria.getWillParticipate() != null) { - specification = specification.and(buildSpecification(criteria.getWillParticipate(), ActivityInvite_.willParticipate)); - } if (criteria.getCreatedBy() != null) { specification = specification.and(buildStringSpecification(criteria.getCreatedBy(), ActivityInvite_.createdBy)); } diff --git a/src/main/java/com/teamsixnus/scaleup/service/UserService.java b/src/main/java/com/teamsixnus/scaleup/service/UserService.java index 80bb85a..c9e0c8b 100644 --- a/src/main/java/com/teamsixnus/scaleup/service/UserService.java +++ b/src/main/java/com/teamsixnus/scaleup/service/UserService.java @@ -122,12 +122,12 @@ public User registerUser(AdminUserDTO userDTO, String password) { newUser.setLogin(userDTO.getLogin().toLowerCase()); // new user gets initially a generated password newUser.setPassword(encryptedPassword); - newUser.setFirstName(userDTO.getFirstName()); - newUser.setLastName(userDTO.getLastName()); + // newUser.setFirstName(userDTO.getFirstName()); + // newUser.setLastName(userDTO.getLastName()); if (userDTO.getEmail() != null) { newUser.setEmail(userDTO.getEmail().toLowerCase()); } - newUser.setImageUrl(userDTO.getImageUrl()); + // newUser.setImageUrl(userDTO.getImageUrl()); newUser.setLangKey(userDTO.getLangKey()); // new user is not active newUser.setActivated(false); @@ -155,12 +155,12 @@ private boolean removeNonActivatedUser(User existingUser) { public User createUser(AdminUserDTO userDTO) { User user = new User(); user.setLogin(userDTO.getLogin().toLowerCase()); - user.setFirstName(userDTO.getFirstName()); - user.setLastName(userDTO.getLastName()); + // user.setFirstName(userDTO.getFirstName()); + // user.setLastName(userDTO.getLastName()); if (userDTO.getEmail() != null) { user.setEmail(userDTO.getEmail().toLowerCase()); } - user.setImageUrl(userDTO.getImageUrl()); + // user.setImageUrl(userDTO.getImageUrl()); if (userDTO.getLangKey() == null) { user.setLangKey(Constants.DEFAULT_LANGUAGE); // default language } else { @@ -201,12 +201,12 @@ public Optional updateUser(AdminUserDTO userDTO) { .map(user -> { this.clearUserCaches(user); user.setLogin(userDTO.getLogin().toLowerCase()); - user.setFirstName(userDTO.getFirstName()); - user.setLastName(userDTO.getLastName()); + // user.setFirstName(userDTO.getFirstName()); + // user.setLastName(userDTO.getLastName()); if (userDTO.getEmail() != null) { user.setEmail(userDTO.getEmail().toLowerCase()); } - user.setImageUrl(userDTO.getImageUrl()); + // user.setImageUrl(userDTO.getImageUrl()); user.setActivated(userDTO.isActivated()); user.setLangKey(userDTO.getLangKey()); Set managedAuthorities = user.getAuthorities(); @@ -239,23 +239,20 @@ public void deleteUser(String login) { /** * Update basic information (first name, last name, email, language) for the current user. * - * @param firstName first name of user. - * @param lastName last name of user. * @param email email id of user. * @param langKey language key. - * @param imageUrl image URL of user. */ - public void updateUser(String firstName, String lastName, String email, String langKey, String imageUrl) { + public void updateUser(String email, String langKey) { SecurityUtils.getCurrentUserLogin() .flatMap(userRepository::findOneByLogin) .ifPresent(user -> { - user.setFirstName(firstName); - user.setLastName(lastName); + // user.setFirstName(firstName); + // user.setLastName(lastName); if (email != null) { user.setEmail(email.toLowerCase()); } user.setLangKey(langKey); - user.setImageUrl(imageUrl); + // user.setImageUrl(imageUrl); userRepository.save(user); this.clearUserCaches(user); log.debug("Changed Information for User: {}", user); diff --git a/src/main/java/com/teamsixnus/scaleup/service/dto/ActivityInviteDTO.java b/src/main/java/com/teamsixnus/scaleup/service/dto/ActivityInviteDTO.java index c42b8ca..bfa22c0 100644 --- a/src/main/java/com/teamsixnus/scaleup/service/dto/ActivityInviteDTO.java +++ b/src/main/java/com/teamsixnus/scaleup/service/dto/ActivityInviteDTO.java @@ -12,8 +12,6 @@ public class ActivityInviteDTO implements Serializable { private Long id; - private Boolean willParticipate; - private String createdBy; private Instant createdDate; @@ -36,14 +34,6 @@ public void setId(Long id) { this.id = id; } - public Boolean getWillParticipate() { - return willParticipate; - } - - public void setWillParticipate(Boolean willParticipate) { - this.willParticipate = willParticipate; - } - public String getCreatedBy() { return createdBy; } @@ -126,7 +116,6 @@ public int hashCode() { public String toString() { return "ActivityInviteDTO{" + "id=" + getId() + - ", willParticipate='" + getWillParticipate() + "'" + ", createdBy='" + getCreatedBy() + "'" + ", createdDate='" + getCreatedDate() + "'" + ", lastModifiedBy='" + getLastModifiedBy() + "'" + diff --git a/src/main/java/com/teamsixnus/scaleup/service/dto/AdminUserDTO.java b/src/main/java/com/teamsixnus/scaleup/service/dto/AdminUserDTO.java index c88fea1..f6e36c7 100644 --- a/src/main/java/com/teamsixnus/scaleup/service/dto/AdminUserDTO.java +++ b/src/main/java/com/teamsixnus/scaleup/service/dto/AdminUserDTO.java @@ -23,18 +23,18 @@ public class AdminUserDTO implements Serializable { @Size(min = 1, max = 50) private String login; - @Size(max = 50) - private String firstName; - - @Size(max = 50) - private String lastName; + // @Size(max = 50) + // private String firstName; + // + // @Size(max = 50) + // private String lastName; @Email @Size(min = 5, max = 254) private String email; - @Size(max = 256) - private String imageUrl; + // @Size(max = 256) + // private String imageUrl; private boolean activated = false; @@ -58,11 +58,11 @@ public AdminUserDTO() { public AdminUserDTO(User user) { this.id = user.getId(); this.login = user.getLogin(); - this.firstName = user.getFirstName(); - this.lastName = user.getLastName(); + // this.firstName = user.getFirstName(); + // this.lastName = user.getLastName(); this.email = user.getEmail(); this.activated = user.isActivated(); - this.imageUrl = user.getImageUrl(); + // this.imageUrl = user.getImageUrl(); this.langKey = user.getLangKey(); this.createdBy = user.getCreatedBy(); this.createdDate = user.getCreatedDate(); @@ -87,21 +87,21 @@ public void setLogin(String login) { this.login = login; } - public String getFirstName() { - return firstName; - } - - public void setFirstName(String firstName) { - this.firstName = firstName; - } - - public String getLastName() { - return lastName; - } - - public void setLastName(String lastName) { - this.lastName = lastName; - } + // public String getFirstName() { + // return firstName; + // } + // + // public void setFirstName(String firstName) { + // this.firstName = firstName; + // } + // + // public String getLastName() { + // return lastName; + // } + // + // public void setLastName(String lastName) { + // this.lastName = lastName; + // } public String getEmail() { return email; @@ -111,13 +111,13 @@ public void setEmail(String email) { this.email = email; } - public String getImageUrl() { - return imageUrl; - } - - public void setImageUrl(String imageUrl) { - this.imageUrl = imageUrl; - } + // public String getImageUrl() { + // return imageUrl; + // } + // + // public void setImageUrl(String imageUrl) { + // this.imageUrl = imageUrl; + // } public boolean isActivated() { return activated; @@ -180,10 +180,10 @@ public void setAuthorities(Set authorities) { public String toString() { return "AdminUserDTO{" + "login='" + login + '\'' + - ", firstName='" + firstName + '\'' + - ", lastName='" + lastName + '\'' + +// ", firstName='" + firstName + '\'' + +// ", lastName='" + lastName + '\'' + ", email='" + email + '\'' + - ", imageUrl='" + imageUrl + '\'' + +// ", imageUrl='" + imageUrl + '\'' + ", activated=" + activated + ", langKey='" + langKey + '\'' + ", createdBy=" + createdBy + diff --git a/src/main/java/com/teamsixnus/scaleup/service/mapper/UserMapper.java b/src/main/java/com/teamsixnus/scaleup/service/mapper/UserMapper.java index 4305421..1ddc99b 100644 --- a/src/main/java/com/teamsixnus/scaleup/service/mapper/UserMapper.java +++ b/src/main/java/com/teamsixnus/scaleup/service/mapper/UserMapper.java @@ -47,10 +47,10 @@ public User userDTOToUser(AdminUserDTO userDTO) { User user = new User(); user.setId(userDTO.getId()); user.setLogin(userDTO.getLogin()); - user.setFirstName(userDTO.getFirstName()); - user.setLastName(userDTO.getLastName()); + // user.setFirstName(userDTO.getFirstName()); + // user.setLastName(userDTO.getLastName()); user.setEmail(userDTO.getEmail()); - user.setImageUrl(userDTO.getImageUrl()); + // user.setImageUrl(userDTO.getImageUrl()); user.setCreatedBy(userDTO.getCreatedBy()); user.setCreatedDate(userDTO.getCreatedDate()); user.setLastModifiedBy(userDTO.getLastModifiedBy()); diff --git a/src/main/java/com/teamsixnus/scaleup/web/rest/AccountResource.java b/src/main/java/com/teamsixnus/scaleup/web/rest/AccountResource.java index b6f08f1..46e1613 100644 --- a/src/main/java/com/teamsixnus/scaleup/web/rest/AccountResource.java +++ b/src/main/java/com/teamsixnus/scaleup/web/rest/AccountResource.java @@ -112,11 +112,11 @@ public void saveAccount(@Valid @RequestBody AdminUserDTO userDTO) { throw new AccountResourceException("User could not be found"); } userService.updateUser( - userDTO.getFirstName(), - userDTO.getLastName(), + // userDTO.getFirstName(), + // userDTO.getLastName(), userDTO.getEmail(), - userDTO.getLangKey(), - userDTO.getImageUrl() + userDTO.getLangKey() + // userDTO.getImageUrl() ); } diff --git a/src/main/resources/.h2.server.properties b/src/main/resources/.h2.server.properties index 1a7ce59..79df871 100644 --- a/src/main/resources/.h2.server.properties +++ b/src/main/resources/.h2.server.properties @@ -1,5 +1,5 @@ #H2 Server Properties -#Wed Oct 30 23:33:01 SGT 2024 +#Fri Nov 01 19:39:52 SGT 2024 0=JHipster H2 (Disk)|org.h2.Driver|jdbc\:h2\:file\:./target/h2db/db/scaleup|scaleup webAllowOthers=true webPort=8092 diff --git a/src/main/resources/config/liquibase/changelog/00000000000000_initial_schema.xml b/src/main/resources/config/liquibase/changelog/00000000000000_initial_schema.xml index d69a41b..30bdddb 100644 --- a/src/main/resources/config/liquibase/changelog/00000000000000_initial_schema.xml +++ b/src/main/resources/config/liquibase/changelog/00000000000000_initial_schema.xml @@ -19,12 +19,9 @@ - - - diff --git a/src/main/resources/config/liquibase/changelog/20240825084259_added_entity_ActivityInvite.xml b/src/main/resources/config/liquibase/changelog/20240825084259_added_entity_ActivityInvite.xml index fb5f05b..b1f4508 100644 --- a/src/main/resources/config/liquibase/changelog/20240825084259_added_entity_ActivityInvite.xml +++ b/src/main/resources/config/liquibase/changelog/20240825084259_added_entity_ActivityInvite.xml @@ -14,9 +14,6 @@ - - - diff --git a/src/main/resources/config/liquibase/data/user.csv b/src/main/resources/config/liquibase/data/user.csv index 0e4294a..ed698ad 100644 --- a/src/main/resources/config/liquibase/data/user.csv +++ b/src/main/resources/config/liquibase/data/user.csv @@ -1,3 +1,3 @@ -id;login;password_hash;first_name;last_name;email;image_url;activated;lang_key;created_by;last_modified_by -1;admin;$2a$10$gSAhZrxMllrbgj/kkK9UceBPpChGWJA7SYIb1Mqo.n5aNLq1/oRrC;Administrator;Administrator;admin@gmail.com;;true;en;system;system -2;user;$2a$10$VEjxo0jq2YG9Rbk2HmX9S.k1uZBGYUHdUcid3g/vfiEl7lwWgOH/K;User;User;user@gmail.com;;true;en;system;system +id;login;password_hash;email;activated;lang_key;created_by;last_modified_by +1;admin;$2a$10$gSAhZrxMllrbgj/kkK9UceBPpChGWJA7SYIb1Mqo.n5aNLq1/oRrC;admin@gmail.com;true;en;system;system +2;user;$2a$10$VEjxo0jq2YG9Rbk2HmX9S.k1uZBGYUHdUcid3g/vfiEl7lwWgOH/K;user@gmail.com;true;en;system;system diff --git a/src/main/resources/config/liquibase/fake-data/activity_invite.csv b/src/main/resources/config/liquibase/fake-data/activity_invite.csv index 54cdaeb..d2c23b9 100644 --- a/src/main/resources/config/liquibase/fake-data/activity_invite.csv +++ b/src/main/resources/config/liquibase/fake-data/activity_invite.csv @@ -1,11 +1,11 @@ -id;will_participate;created_by;created_date;last_modified_by;last_modified_date -1;false;hold limp;2024-08-24T18:04:17;gee;2024-08-25T08:35:58 -2;true;shakily;2024-08-24T11:26:55;qua conflate newsstand;2024-08-25T02:57:03 -3;true;that majority than;2024-08-25T03:51:34;when magnet;2024-08-25T02:08:43 -4;true;furthermore bleakly peach;2024-08-24T13:35:26;biodegradable aw terribly;2024-08-24T21:31:12 -5;true;unfortunate pfft;2024-08-24T10:42:17;hastily zap;2024-08-24T10:11:12 -6;true;on;2024-08-24T23:13:31;ping forceful;2024-08-25T00:07:51 -7;false;sweet floozie suspiciously;2024-08-25T05:25:32;colonial;2024-08-24T18:53:05 -8;false;distant inwardly;2024-08-25T02:32:50;passage whenever;2024-08-24T10:14:18 -9;true;wavy easily;2024-08-25T02:37:24;sherry into pfft;2024-08-25T00:48:11 -10;true;packaging why yet;2024-08-24T16:40:59;ew considering;2024-08-25T05:48:34 +id;created_by;created_date;last_modified_by;last_modified_date +1;galvanize young nor;2024-08-25T05:45:04;ick;2024-08-24T10:13:27 +2;yieldingly misspend shrink;2024-08-24T16:53:58;periodic;2024-08-24T11:10:32 +3;utterly bah for;2024-08-24T23:37:34;extraneous;2024-08-24T21:16:17 +4;after even;2024-08-25T04:20:26;pish goddess because;2024-08-25T00:09:08 +5;emulate oval from;2024-08-25T04:55:40;although after infinite;2024-08-25T02:52:00 +6;aha following slow;2024-08-25T01:30:23;riposte till;2024-08-24T13:52:46 +7;suspiciously dream;2024-08-24T23:04:46;yippee;2024-08-24T14:09:05 +8;alive fuzzy;2024-08-24T09:19:47;ultimately;2024-08-24T14:00:53 +9;low whereas badger;2024-08-25T02:22:34;grave or gah;2024-08-24T23:49:22 +10;defragment;2024-08-25T06:01:37;ha quick;2024-08-24T16:52:20 diff --git a/src/main/webapp/app/entities/activity-invite/activity-invite-update.tsx b/src/main/webapp/app/entities/activity-invite/activity-invite-update.tsx index 87ff83f..3f36efe 100644 --- a/src/main/webapp/app/entities/activity-invite/activity-invite-update.tsx +++ b/src/main/webapp/app/entities/activity-invite/activity-invite-update.tsx @@ -93,7 +93,7 @@ export const ActivityInviteUpdate = () => {

- Create or edit a Activity Invite + {isNew ? 'Create' : 'Edit'} Activity Invite

diff --git a/src/main/webapp/app/modules/administration/user-management/user-management-update.tsx b/src/main/webapp/app/modules/administration/user-management/user-management-update.tsx index 935019a..322612b 100644 --- a/src/main/webapp/app/modules/administration/user-management/user-management-update.tsx +++ b/src/main/webapp/app/modules/administration/user-management/user-management-update.tsx @@ -83,29 +83,29 @@ export const UserManagementUpdate = () => { }, }} /> - - - This field cannot be longer than 50 characters. + {/**/} + {/**/} + {/*This field cannot be longer than 50 characters.*/} { Profile - - Settings - + {/**/} + {/* Settings*/} + {/**/} Password @@ -47,9 +47,9 @@ const accountMenuItemsAuthenticated = () => { Profile - - Settings - + {/**/} + {/* Settings*/} + {/**/} Password diff --git a/src/main/webapp/app/shared/layout/menus/admin.tsx b/src/main/webapp/app/shared/layout/menus/admin.tsx index 986f968..e03bb8b 100644 --- a/src/main/webapp/app/shared/layout/menus/admin.tsx +++ b/src/main/webapp/app/shared/layout/menus/admin.tsx @@ -9,18 +9,18 @@ const adminMenuItems = () => ( User management - - Metrics - - - Health - - - Configuration - - - Logs - + {/**/} + {/* Metrics*/} + {/**/} + {/**/} + {/* Health*/} + {/**/} + {/**/} + {/* Configuration*/} + {/**/} + {/**/} + {/* Logs*/} + {/**/} User Profile @@ -34,24 +34,24 @@ const adminMenuItems = () => ( ); -const openAPIItem = () => ( - - API - -); +// const openAPIItem = () => ( +// // +// // API +// // +// ); -const databaseItem = () => ( - - Database - -); +// const databaseItem = () => ( +// +// Database +// +// ); export const AdminMenu = ({ showOpenAPI, showDatabase }) => ( {adminMenuItems()} - {showOpenAPI && openAPIItem()} + {/*{showOpenAPI && openAPIItem()}*/} - {showDatabase && databaseItem()} + {/*{showDatabase && databaseItem()}*/} Code Tables diff --git a/src/test/java/com/teamsixnus/scaleup/domain/ActivityInviteAsserts.java b/src/test/java/com/teamsixnus/scaleup/domain/ActivityInviteAsserts.java index 4ed2497..26b7d60 100644 --- a/src/test/java/com/teamsixnus/scaleup/domain/ActivityInviteAsserts.java +++ b/src/test/java/com/teamsixnus/scaleup/domain/ActivityInviteAsserts.java @@ -22,7 +22,7 @@ public static void assertActivityInviteAllPropertiesEquals(ActivityInvite expect * @param actual the actual entity */ public static void assertActivityInviteAllUpdatablePropertiesEquals(ActivityInvite expected, ActivityInvite actual) { - assertActivityInviteUpdatableFieldsEquals(expected, actual); + //assertActivityInviteUpdatableFieldsEquals(expected, actual); assertActivityInviteUpdatableRelationshipsEquals(expected, actual); } @@ -40,17 +40,17 @@ public static void assertActivityInviteAutoGeneratedPropertiesEquals(ActivityInv .satisfies(e -> assertThat(e.getCreatedDate()).as("check createdDate").isEqualTo(actual.getCreatedDate())); } - /** - * Asserts that the entity has all the updatable fields set. - * - * @param expected the expected entity - * @param actual the actual entity - */ - public static void assertActivityInviteUpdatableFieldsEquals(ActivityInvite expected, ActivityInvite actual) { - assertThat(expected) - .as("Verify ActivityInvite relevant properties") - .satisfies(e -> assertThat(e.getWillParticipate()).as("check willParticipate").isEqualTo(actual.getWillParticipate())); - } + // /** + // * Asserts that the entity has all the updatable fields set. + // * + // * @param expected the expected entity + // * @param actual the actual entity + // */ + // public static void assertActivityInviteUpdatableFieldsEquals(ActivityInvite expected, ActivityInvite actual) { + // assertThat(expected) + // .as("Verify ActivityInvite relevant properties") + // .satisfies(e -> assertThat(e.getWillParticipate()).as("check willParticipate").isEqualTo(actual.getWillParticipate())); + // } /** * Asserts that the entity has all the updatable relationships set. diff --git a/src/test/java/com/teamsixnus/scaleup/service/UserServiceIT.java b/src/test/java/com/teamsixnus/scaleup/service/UserServiceIT.java index e925725..900d55b 100644 --- a/src/test/java/com/teamsixnus/scaleup/service/UserServiceIT.java +++ b/src/test/java/com/teamsixnus/scaleup/service/UserServiceIT.java @@ -75,9 +75,9 @@ public void init() { user.setPassword(RandomStringUtils.randomAlphanumeric(60)); user.setActivated(true); user.setEmail(DEFAULT_EMAIL); - user.setFirstName(DEFAULT_FIRSTNAME); - user.setLastName(DEFAULT_LASTNAME); - user.setImageUrl(DEFAULT_IMAGEURL); + // user.setFirstName(DEFAULT_FIRSTNAME); + // user.setLastName(DEFAULT_LASTNAME); + // user.setImageUrl(DEFAULT_IMAGEURL); user.setLangKey(DEFAULT_LANGKEY); when(dateTimeProvider.getNow()).thenReturn(Optional.of(LocalDateTime.now())); diff --git a/src/test/java/com/teamsixnus/scaleup/service/criteria/ActivityInviteCriteriaTest.java b/src/test/java/com/teamsixnus/scaleup/service/criteria/ActivityInviteCriteriaTest.java index b2c4f78..9a69f44 100644 --- a/src/test/java/com/teamsixnus/scaleup/service/criteria/ActivityInviteCriteriaTest.java +++ b/src/test/java/com/teamsixnus/scaleup/service/criteria/ActivityInviteCriteriaTest.java @@ -75,7 +75,6 @@ void toStringVerifier() { private static void setAllFilters(ActivityInviteCriteria activityInviteCriteria) { activityInviteCriteria.id(); - activityInviteCriteria.willParticipate(); activityInviteCriteria.createdBy(); activityInviteCriteria.createdDate(); activityInviteCriteria.lastModifiedBy(); @@ -90,7 +89,6 @@ private static Condition criteriaFiltersAre(Function( criteria -> condition.apply(criteria.getId()) && - condition.apply(criteria.getWillParticipate()) && condition.apply(criteria.getCreatedBy()) && condition.apply(criteria.getCreatedDate()) && condition.apply(criteria.getLastModifiedBy()) && @@ -110,7 +108,6 @@ private static Condition copyFiltersAre( return new Condition<>( criteria -> condition.apply(criteria.getId(), copy.getId()) && - condition.apply(criteria.getWillParticipate(), copy.getWillParticipate()) && condition.apply(criteria.getCreatedBy(), copy.getCreatedBy()) && condition.apply(criteria.getCreatedDate(), copy.getCreatedDate()) && condition.apply(criteria.getLastModifiedBy(), copy.getLastModifiedBy()) && diff --git a/src/test/java/com/teamsixnus/scaleup/service/mapper/UserMapperTest.java b/src/test/java/com/teamsixnus/scaleup/service/mapper/UserMapperTest.java index aeb0a11..ac3fbf9 100644 --- a/src/test/java/com/teamsixnus/scaleup/service/mapper/UserMapperTest.java +++ b/src/test/java/com/teamsixnus/scaleup/service/mapper/UserMapperTest.java @@ -36,9 +36,9 @@ public void init() { user.setPassword(RandomStringUtils.randomAlphanumeric(60)); user.setActivated(true); user.setEmail("johndoe@localhost"); - user.setFirstName("john"); - user.setLastName("doe"); - user.setImageUrl("image_url"); + // user.setFirstName("john"); + // user.setLastName("doe"); + // user.setImageUrl("image_url"); user.setCreatedBy(DEFAULT_LOGIN); user.setCreatedDate(Instant.now()); user.setLastModifiedBy(DEFAULT_LOGIN); @@ -60,11 +60,11 @@ void testUserToUserDTO() { assertThat(convertedUserDto.getId()).isEqualTo(user.getId()); assertThat(convertedUserDto.getLogin()).isEqualTo(user.getLogin()); - assertThat(convertedUserDto.getFirstName()).isEqualTo(user.getFirstName()); - assertThat(convertedUserDto.getLastName()).isEqualTo(user.getLastName()); + // assertThat(convertedUserDto.getFirstName()).isEqualTo(user.getFirstName()); + // assertThat(convertedUserDto.getLastName()).isEqualTo(user.getLastName()); assertThat(convertedUserDto.getEmail()).isEqualTo(user.getEmail()); assertThat(convertedUserDto.isActivated()).isEqualTo(user.isActivated()); - assertThat(convertedUserDto.getImageUrl()).isEqualTo(user.getImageUrl()); + // assertThat(convertedUserDto.getImageUrl()).isEqualTo(user.getImageUrl()); assertThat(convertedUserDto.getCreatedBy()).isEqualTo(user.getCreatedBy()); assertThat(convertedUserDto.getCreatedDate()).isEqualTo(user.getCreatedDate()); assertThat(convertedUserDto.getLastModifiedBy()).isEqualTo(user.getLastModifiedBy()); @@ -79,11 +79,11 @@ void testUserDTOtoUser() { assertThat(convertedUser.getId()).isEqualTo(userDto.getId()); assertThat(convertedUser.getLogin()).isEqualTo(userDto.getLogin()); - assertThat(convertedUser.getFirstName()).isEqualTo(userDto.getFirstName()); - assertThat(convertedUser.getLastName()).isEqualTo(userDto.getLastName()); + // assertThat(convertedUser.getFirstName()).isEqualTo(userDto.getFirstName()); + // assertThat(convertedUser.getLastName()).isEqualTo(userDto.getLastName()); assertThat(convertedUser.getEmail()).isEqualTo(userDto.getEmail()); assertThat(convertedUser.isActivated()).isEqualTo(userDto.isActivated()); - assertThat(convertedUser.getImageUrl()).isEqualTo(userDto.getImageUrl()); + // assertThat(convertedUser.getImageUrl()).isEqualTo(userDto.getImageUrl()); assertThat(convertedUser.getLangKey()).isEqualTo(userDto.getLangKey()); assertThat(convertedUser.getCreatedBy()).isEqualTo(userDto.getCreatedBy()); assertThat(convertedUser.getCreatedDate()).isEqualTo(userDto.getCreatedDate()); diff --git a/src/test/java/com/teamsixnus/scaleup/web/rest/AccountResourceIT.java b/src/test/java/com/teamsixnus/scaleup/web/rest/AccountResourceIT.java index ecc1705..dc0496e 100644 --- a/src/test/java/com/teamsixnus/scaleup/web/rest/AccountResourceIT.java +++ b/src/test/java/com/teamsixnus/scaleup/web/rest/AccountResourceIT.java @@ -99,10 +99,10 @@ void testGetExistingAccount() throws Exception { AdminUserDTO user = new AdminUserDTO(); user.setLogin(TEST_USER_LOGIN); - user.setFirstName("john"); - user.setLastName("doe"); + // user.setFirstName("john"); + // user.setLastName("doe"); user.setEmail("john.doe@jhipster.com"); - user.setImageUrl("http://placehold.it/50x50"); + // user.setImageUrl("http://placehold.it/50x50"); user.setLangKey("en"); user.setAuthorities(authorities); userService.createUser(user); @@ -112,10 +112,10 @@ void testGetExistingAccount() throws Exception { .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) .andExpect(jsonPath("$.login").value(TEST_USER_LOGIN)) - .andExpect(jsonPath("$.firstName").value("john")) - .andExpect(jsonPath("$.lastName").value("doe")) + // .andExpect(jsonPath("$.firstName").value("john")) + // .andExpect(jsonPath("$.lastName").value("doe")) .andExpect(jsonPath("$.email").value("john.doe@jhipster.com")) - .andExpect(jsonPath("$.imageUrl").value("http://placehold.it/50x50")) + // .andExpect(jsonPath("$.imageUrl").value("http://placehold.it/50x50")) .andExpect(jsonPath("$.langKey").value("en")) .andExpect(jsonPath("$.authorities").value(AuthoritiesConstants.ADMIN)); @@ -133,10 +133,10 @@ void testRegisterValid() throws Exception { ManagedUserVM validUser = new ManagedUserVM(); validUser.setLogin("test-register-valid"); validUser.setPassword("password"); - validUser.setFirstName("Alice"); - validUser.setLastName("Test"); + // validUser.setFirstName("Alice"); + // validUser.setLastName("Test"); validUser.setEmail("test-register-valid@example.com"); - validUser.setImageUrl("http://placehold.it/50x50"); + // validUser.setImageUrl("http://placehold.it/50x50"); validUser.setLangKey(Constants.DEFAULT_LANGUAGE); validUser.setAuthorities(Collections.singleton(AuthoritiesConstants.USER)); assertThat(userRepository.findOneByLogin("test-register-valid")).isEmpty(); @@ -156,11 +156,11 @@ void testRegisterInvalidLogin() throws Exception { ManagedUserVM invalidUser = new ManagedUserVM(); invalidUser.setLogin("funky-log(n"); // <-- invalid invalidUser.setPassword("password"); - invalidUser.setFirstName("Funky"); - invalidUser.setLastName("One"); + // invalidUser.setFirstName("Funky"); + // invalidUser.setLastName("One"); invalidUser.setEmail("funky@example.com"); invalidUser.setActivated(true); - invalidUser.setImageUrl("http://placehold.it/50x50"); + // invalidUser.setImageUrl("http://placehold.it/50x50"); invalidUser.setLangKey(Constants.DEFAULT_LANGUAGE); invalidUser.setAuthorities(Collections.singleton(AuthoritiesConstants.USER)); @@ -203,11 +203,11 @@ private static ManagedUserVM createInvalidUser( ManagedUserVM invalidUser = new ManagedUserVM(); invalidUser.setLogin(login); invalidUser.setPassword(password); - invalidUser.setFirstName(firstName); - invalidUser.setLastName(lastName); + // invalidUser.setFirstName(firstName); + // invalidUser.setLastName(lastName); invalidUser.setEmail(email); invalidUser.setActivated(activated); - invalidUser.setImageUrl("http://placehold.it/50x50"); + // invalidUser.setImageUrl("http://placehold.it/50x50"); invalidUser.setLangKey(Constants.DEFAULT_LANGUAGE); invalidUser.setAuthorities(Collections.singleton(AuthoritiesConstants.USER)); return invalidUser; @@ -220,10 +220,10 @@ void testRegisterDuplicateLogin() throws Exception { ManagedUserVM firstUser = new ManagedUserVM(); firstUser.setLogin("alice"); firstUser.setPassword("password"); - firstUser.setFirstName("Alice"); - firstUser.setLastName("Something"); + // firstUser.setFirstName("Alice"); + // firstUser.setLastName("Something"); firstUser.setEmail("alice@example.com"); - firstUser.setImageUrl("http://placehold.it/50x50"); + // firstUser.setImageUrl("http://placehold.it/50x50"); firstUser.setLangKey(Constants.DEFAULT_LANGUAGE); firstUser.setAuthorities(Collections.singleton(AuthoritiesConstants.USER)); @@ -231,10 +231,10 @@ void testRegisterDuplicateLogin() throws Exception { ManagedUserVM secondUser = new ManagedUserVM(); secondUser.setLogin(firstUser.getLogin()); secondUser.setPassword(firstUser.getPassword()); - secondUser.setFirstName(firstUser.getFirstName()); - secondUser.setLastName(firstUser.getLastName()); + // secondUser.setFirstName(firstUser.getFirstName()); + // secondUser.setLastName(firstUser.getLastName()); secondUser.setEmail("alice2@example.com"); - secondUser.setImageUrl(firstUser.getImageUrl()); + // secondUser.setImageUrl(firstUser.getImageUrl()); secondUser.setLangKey(firstUser.getLangKey()); secondUser.setCreatedBy(firstUser.getCreatedBy()); secondUser.setCreatedDate(firstUser.getCreatedDate()); @@ -272,10 +272,10 @@ void testRegisterDuplicateEmail() throws Exception { ManagedUserVM firstUser = new ManagedUserVM(); firstUser.setLogin("test-register-duplicate-email"); firstUser.setPassword("password"); - firstUser.setFirstName("Alice"); - firstUser.setLastName("Test"); + // firstUser.setFirstName("Alice"); + // firstUser.setLastName("Test"); firstUser.setEmail("test-register-duplicate-email@example.com"); - firstUser.setImageUrl("http://placehold.it/50x50"); + // firstUser.setImageUrl("http://placehold.it/50x50"); firstUser.setLangKey(Constants.DEFAULT_LANGUAGE); firstUser.setAuthorities(Collections.singleton(AuthoritiesConstants.USER)); @@ -291,10 +291,10 @@ void testRegisterDuplicateEmail() throws Exception { ManagedUserVM secondUser = new ManagedUserVM(); secondUser.setLogin("test-register-duplicate-email-2"); secondUser.setPassword(firstUser.getPassword()); - secondUser.setFirstName(firstUser.getFirstName()); - secondUser.setLastName(firstUser.getLastName()); + // secondUser.setFirstName(firstUser.getFirstName()); + // secondUser.setLastName(firstUser.getLastName()); secondUser.setEmail(firstUser.getEmail()); - secondUser.setImageUrl(firstUser.getImageUrl()); + // secondUser.setImageUrl(firstUser.getImageUrl()); secondUser.setLangKey(firstUser.getLangKey()); secondUser.setAuthorities(new HashSet<>(firstUser.getAuthorities())); @@ -314,10 +314,10 @@ void testRegisterDuplicateEmail() throws Exception { userWithUpperCaseEmail.setId(firstUser.getId()); userWithUpperCaseEmail.setLogin("test-register-duplicate-email-3"); userWithUpperCaseEmail.setPassword(firstUser.getPassword()); - userWithUpperCaseEmail.setFirstName(firstUser.getFirstName()); - userWithUpperCaseEmail.setLastName(firstUser.getLastName()); + // userWithUpperCaseEmail.setFirstName(firstUser.getFirstName()); + // userWithUpperCaseEmail.setLastName(firstUser.getLastName()); userWithUpperCaseEmail.setEmail("TEST-register-duplicate-email@example.com"); - userWithUpperCaseEmail.setImageUrl(firstUser.getImageUrl()); + // userWithUpperCaseEmail.setImageUrl(firstUser.getImageUrl()); userWithUpperCaseEmail.setLangKey(firstUser.getLangKey()); userWithUpperCaseEmail.setAuthorities(new HashSet<>(firstUser.getAuthorities())); @@ -347,11 +347,11 @@ void testRegisterAdminIsIgnored() throws Exception { ManagedUserVM validUser = new ManagedUserVM(); validUser.setLogin("badguy"); validUser.setPassword("password"); - validUser.setFirstName("Bad"); - validUser.setLastName("Guy"); + // validUser.setFirstName("Bad"); + // validUser.setLastName("Guy"); validUser.setEmail("badguy@example.com"); validUser.setActivated(true); - validUser.setImageUrl("http://placehold.it/50x50"); + // validUser.setImageUrl("http://placehold.it/50x50"); validUser.setLangKey(Constants.DEFAULT_LANGUAGE); validUser.setAuthorities(Collections.singleton(AuthoritiesConstants.ADMIN)); @@ -408,11 +408,11 @@ void testSaveAccount() throws Exception { AdminUserDTO userDTO = new AdminUserDTO(); userDTO.setLogin("not-used"); - userDTO.setFirstName("firstname"); - userDTO.setLastName("lastname"); + // userDTO.setFirstName("firstname"); + // userDTO.setLastName("lastname"); userDTO.setEmail("save-account@example.com"); userDTO.setActivated(false); - userDTO.setImageUrl("http://placehold.it/50x50"); + // userDTO.setImageUrl("http://placehold.it/50x50"); userDTO.setLangKey(Constants.DEFAULT_LANGUAGE); userDTO.setAuthorities(Collections.singleton(AuthoritiesConstants.ADMIN)); @@ -421,12 +421,12 @@ void testSaveAccount() throws Exception { .andExpect(status().isOk()); User updatedUser = userRepository.findOneWithAuthoritiesByLogin(user.getLogin()).orElse(null); - assertThat(updatedUser.getFirstName()).isEqualTo(userDTO.getFirstName()); - assertThat(updatedUser.getLastName()).isEqualTo(userDTO.getLastName()); + // assertThat(updatedUser.getFirstName()).isEqualTo(userDTO.getFirstName()); + // assertThat(updatedUser.getLastName()).isEqualTo(userDTO.getLastName()); assertThat(updatedUser.getEmail()).isEqualTo(userDTO.getEmail()); assertThat(updatedUser.getLangKey()).isEqualTo(userDTO.getLangKey()); assertThat(updatedUser.getPassword()).isEqualTo(user.getPassword()); - assertThat(updatedUser.getImageUrl()).isEqualTo(userDTO.getImageUrl()); + // assertThat(updatedUser.getImageUrl()).isEqualTo(userDTO.getImageUrl()); assertThat(updatedUser.isActivated()).isTrue(); assertThat(updatedUser.getAuthorities()).isEmpty(); @@ -447,11 +447,11 @@ void testSaveInvalidEmail() throws Exception { AdminUserDTO userDTO = new AdminUserDTO(); userDTO.setLogin("not-used"); - userDTO.setFirstName("firstname"); - userDTO.setLastName("lastname"); + // userDTO.setFirstName("firstname"); + // userDTO.setLastName("lastname"); userDTO.setEmail("invalid email"); userDTO.setActivated(false); - userDTO.setImageUrl("http://placehold.it/50x50"); + // userDTO.setImageUrl("http://placehold.it/50x50"); userDTO.setLangKey(Constants.DEFAULT_LANGUAGE); userDTO.setAuthorities(Collections.singleton(AuthoritiesConstants.ADMIN)); @@ -485,11 +485,11 @@ void testSaveExistingEmail() throws Exception { AdminUserDTO userDTO = new AdminUserDTO(); userDTO.setLogin("not-used"); - userDTO.setFirstName("firstname"); - userDTO.setLastName("lastname"); + // userDTO.setFirstName("firstname"); + // userDTO.setLastName("lastname"); userDTO.setEmail("save-existing-email2@example.com"); userDTO.setActivated(false); - userDTO.setImageUrl("http://placehold.it/50x50"); + // userDTO.setImageUrl("http://placehold.it/50x50"); userDTO.setLangKey(Constants.DEFAULT_LANGUAGE); userDTO.setAuthorities(Collections.singleton(AuthoritiesConstants.ADMIN)); @@ -517,11 +517,11 @@ void testSaveExistingEmailAndLogin() throws Exception { AdminUserDTO userDTO = new AdminUserDTO(); userDTO.setLogin("not-used"); - userDTO.setFirstName("firstname"); - userDTO.setLastName("lastname"); + // userDTO.setFirstName("firstname"); + // userDTO.setLastName("lastname"); userDTO.setEmail("save-existing-email-and-login@example.com"); userDTO.setActivated(false); - userDTO.setImageUrl("http://placehold.it/50x50"); + // userDTO.setImageUrl("http://placehold.it/50x50"); userDTO.setLangKey(Constants.DEFAULT_LANGUAGE); userDTO.setAuthorities(Collections.singleton(AuthoritiesConstants.ADMIN)); diff --git a/src/test/java/com/teamsixnus/scaleup/web/rest/ActivityInviteResourceIT.java b/src/test/java/com/teamsixnus/scaleup/web/rest/ActivityInviteResourceIT.java index b7308b6..b3c9292 100644 --- a/src/test/java/com/teamsixnus/scaleup/web/rest/ActivityInviteResourceIT.java +++ b/src/test/java/com/teamsixnus/scaleup/web/rest/ActivityInviteResourceIT.java @@ -9,9 +9,11 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.teamsixnus.scaleup.IntegrationTest; -import com.teamsixnus.scaleup.domain.*; +import com.teamsixnus.scaleup.domain.Activity; +import com.teamsixnus.scaleup.domain.ActivityInvite; +import com.teamsixnus.scaleup.domain.CodeTables; +import com.teamsixnus.scaleup.domain.UserProfile; import com.teamsixnus.scaleup.repository.ActivityInviteRepository; -import com.teamsixnus.scaleup.security.AuthoritiesConstants; import com.teamsixnus.scaleup.service.dto.ActivityInviteDTO; import com.teamsixnus.scaleup.service.mapper.ActivityInviteMapper; import jakarta.persistence.EntityManager; @@ -35,9 +37,6 @@ @WithMockUser class ActivityInviteResourceIT { - private static final Boolean DEFAULT_WILL_PARTICIPATE = false; - private static final Boolean UPDATED_WILL_PARTICIPATE = true; - private static final String ENTITY_API_URL = "/api/activity-invites"; private static final String ENTITY_API_URL_ID = ENTITY_API_URL + "/{id}"; @@ -70,7 +69,7 @@ class ActivityInviteResourceIT { * if they test an entity which requires the current entity. */ public static ActivityInvite createEntity(EntityManager em) { - ActivityInvite activityInvite = new ActivityInvite().willParticipate(DEFAULT_WILL_PARTICIPATE); + ActivityInvite activityInvite = new ActivityInvite(); return activityInvite; } @@ -81,7 +80,7 @@ public static ActivityInvite createEntity(EntityManager em) { * if they test an entity which requires the current entity. */ public static ActivityInvite createUpdatedEntity(EntityManager em) { - ActivityInvite activityInvite = new ActivityInvite().willParticipate(UPDATED_WILL_PARTICIPATE); + ActivityInvite activityInvite = new ActivityInvite(); return activityInvite; } @@ -117,7 +116,7 @@ void createActivityInvite() throws Exception { // Validate the ActivityInvite in the database assertIncrementedRepositoryCount(databaseSizeBeforeCreate); var returnedActivityInvite = activityInviteMapper.toEntity(returnedActivityInviteDTO); - assertActivityInviteUpdatableFieldsEquals(returnedActivityInvite, getPersistedActivityInvite(returnedActivityInvite)); + //assertActivityInviteUpdatableFieldsEquals(returnedActivityInvite, getPersistedActivityInvite(returnedActivityInvite)); insertedActivityInvite = returnedActivityInvite; } @@ -151,8 +150,7 @@ void getAllActivityInvites() throws Exception { .perform(get(ENTITY_API_URL + "?sort=id,desc")) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) - .andExpect(jsonPath("$.[*].id").value(hasItem(activityInvite.getId().intValue()))) - .andExpect(jsonPath("$.[*].willParticipate").value(hasItem(DEFAULT_WILL_PARTICIPATE.booleanValue()))); + .andExpect(jsonPath("$.[*].id").value(hasItem(activityInvite.getId().intValue()))); } @Test @@ -166,8 +164,7 @@ void getActivityInvite() throws Exception { .perform(get(ENTITY_API_URL_ID, activityInvite.getId())) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) - .andExpect(jsonPath("$.id").value(activityInvite.getId().intValue())) - .andExpect(jsonPath("$.willParticipate").value(DEFAULT_WILL_PARTICIPATE.booleanValue())); + .andExpect(jsonPath("$.id").value(activityInvite.getId().intValue())); } @Test @@ -187,43 +184,6 @@ void getActivityInvitesByIdFiltering() throws Exception { @Test @Transactional - void getAllActivityInvitesByWillParticipateIsEqualToSomething() throws Exception { - // Initialize the database - insertedActivityInvite = activityInviteRepository.saveAndFlush(activityInvite); - - // Get all the activityInviteList where willParticipate equals to - defaultActivityInviteFiltering( - "willParticipate.equals=" + DEFAULT_WILL_PARTICIPATE, - "willParticipate.equals=" + UPDATED_WILL_PARTICIPATE - ); - } - - @Test - @Transactional - void getAllActivityInvitesByWillParticipateIsInShouldWork() throws Exception { - // Initialize the database - insertedActivityInvite = activityInviteRepository.saveAndFlush(activityInvite); - - // Get all the activityInviteList where willParticipate in - defaultActivityInviteFiltering( - "willParticipate.in=" + DEFAULT_WILL_PARTICIPATE + "," + UPDATED_WILL_PARTICIPATE, - "willParticipate.in=" + UPDATED_WILL_PARTICIPATE - ); - } - - @Test - @Transactional - void getAllActivityInvitesByWillParticipateIsNullOrNotNull() throws Exception { - // Initialize the database - insertedActivityInvite = activityInviteRepository.saveAndFlush(activityInvite); - - // Get all the activityInviteList where willParticipate is not null - defaultActivityInviteFiltering("willParticipate.specified=true", "willParticipate.specified=false"); - } - - @Test - @Transactional - @WithMockUser(username = "user", authorities = { AuthoritiesConstants.USER }) void getAllActivityInvitesByActivityIsEqualToSomething() throws Exception { Activity activity; if (TestUtil.findAll(em, Activity.class).isEmpty()) { @@ -301,8 +261,7 @@ private void defaultActivityInviteShouldBeFound(String filter) throws Exception .perform(get(ENTITY_API_URL + "?sort=id,desc&" + filter)) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) - .andExpect(jsonPath("$.[*].id").value(hasItem(activityInvite.getId().intValue()))) - .andExpect(jsonPath("$.[*].willParticipate").value(hasItem(DEFAULT_WILL_PARTICIPATE.booleanValue()))); + .andExpect(jsonPath("$.[*].id").value(hasItem(activityInvite.getId().intValue()))); // Check, that the count call also returns 1 restActivityInviteMockMvc @@ -350,7 +309,6 @@ void putExistingActivityInvite() throws Exception { ActivityInvite updatedActivityInvite = activityInviteRepository.findById(activityInvite.getId()).orElseThrow(); // Disconnect from session so that the updates on updatedActivityInvite are not directly saved in db em.detach(updatedActivityInvite); - updatedActivityInvite.willParticipate(UPDATED_WILL_PARTICIPATE); ActivityInviteDTO activityInviteDTO = activityInviteMapper.toDto(updatedActivityInvite); restActivityInviteMockMvc @@ -451,10 +409,10 @@ void partialUpdateActivityInviteWithPatch() throws Exception { // Validate the ActivityInvite in the database assertSameRepositoryCount(databaseSizeBeforeUpdate); - assertActivityInviteUpdatableFieldsEquals( - createUpdateProxyForBean(partialUpdatedActivityInvite, activityInvite), - getPersistedActivityInvite(activityInvite) - ); + // assertActivityInviteUpdatableFieldsEquals( + // createUpdateProxyForBean(partialUpdatedActivityInvite, activityInvite), + // getPersistedActivityInvite(activityInvite) + // ); } @Test @@ -469,8 +427,6 @@ void fullUpdateActivityInviteWithPatch() throws Exception { ActivityInvite partialUpdatedActivityInvite = new ActivityInvite(); partialUpdatedActivityInvite.setId(activityInvite.getId()); - partialUpdatedActivityInvite.willParticipate(UPDATED_WILL_PARTICIPATE); - restActivityInviteMockMvc .perform( patch(ENTITY_API_URL_ID, partialUpdatedActivityInvite.getId()) @@ -482,7 +438,7 @@ void fullUpdateActivityInviteWithPatch() throws Exception { // Validate the ActivityInvite in the database assertSameRepositoryCount(databaseSizeBeforeUpdate); - assertActivityInviteUpdatableFieldsEquals(partialUpdatedActivityInvite, getPersistedActivityInvite(partialUpdatedActivityInvite)); + //assertActivityInviteUpdatableFieldsEquals(partialUpdatedActivityInvite, getPersistedActivityInvite(partialUpdatedActivityInvite)); } @Test @@ -591,12 +547,4 @@ protected void assertPersistedActivityInviteToMatchAllProperties(ActivityInvite protected void assertPersistedActivityInviteToMatchUpdatableProperties(ActivityInvite expectedActivityInvite) { assertActivityInviteAllUpdatablePropertiesEquals(expectedActivityInvite, getPersistedActivityInvite(expectedActivityInvite)); } - - // Mock helper function to return the current user - private User mockCurrentUser(Long id, String username) { - User user = new User(); - user.setId(id); - user.setLogin(username); - return user; - } } diff --git a/src/test/java/com/teamsixnus/scaleup/web/rest/UserResourceIT.java b/src/test/java/com/teamsixnus/scaleup/web/rest/UserResourceIT.java index 96a682e..5f314e5 100644 --- a/src/test/java/com/teamsixnus/scaleup/web/rest/UserResourceIT.java +++ b/src/test/java/com/teamsixnus/scaleup/web/rest/UserResourceIT.java @@ -103,9 +103,9 @@ public static User createEntity(EntityManager em) { persistUser.setPassword(RandomStringUtils.randomAlphanumeric(60)); persistUser.setActivated(true); persistUser.setEmail(RandomStringUtils.randomAlphabetic(5) + DEFAULT_EMAIL); - persistUser.setFirstName(DEFAULT_FIRSTNAME); - persistUser.setLastName(DEFAULT_LASTNAME); - persistUser.setImageUrl(DEFAULT_IMAGEURL); + // persistUser.setFirstName(DEFAULT_FIRSTNAME); + // persistUser.setLastName(DEFAULT_LASTNAME); + // persistUser.setImageUrl(DEFAULT_IMAGEURL); persistUser.setLangKey(DEFAULT_LANGKEY); return persistUser; } @@ -147,11 +147,11 @@ void createUser() throws Exception { // Create the User AdminUserDTO userDTO = new AdminUserDTO(); userDTO.setLogin(DEFAULT_LOGIN); - userDTO.setFirstName(DEFAULT_FIRSTNAME); - userDTO.setLastName(DEFAULT_LASTNAME); + // userDTO.setFirstName(DEFAULT_FIRSTNAME); + // userDTO.setLastName(DEFAULT_LASTNAME); userDTO.setEmail(DEFAULT_EMAIL); userDTO.setActivated(true); - userDTO.setImageUrl(DEFAULT_IMAGEURL); + // userDTO.setImageUrl(DEFAULT_IMAGEURL); userDTO.setLangKey(DEFAULT_LANGKEY); userDTO.setAuthorities(Collections.singleton(AuthoritiesConstants.USER)); @@ -168,10 +168,10 @@ void createUser() throws Exception { User convertedUser = userMapper.userDTOToUser(returnedUserDTO); // Validate the returned User assertThat(convertedUser.getLogin()).isEqualTo(DEFAULT_LOGIN); - assertThat(convertedUser.getFirstName()).isEqualTo(DEFAULT_FIRSTNAME); - assertThat(convertedUser.getLastName()).isEqualTo(DEFAULT_LASTNAME); + // assertThat(convertedUser.getFirstName()).isEqualTo(DEFAULT_FIRSTNAME); + // assertThat(convertedUser.getLastName()).isEqualTo(DEFAULT_LASTNAME); assertThat(convertedUser.getEmail()).isEqualTo(DEFAULT_EMAIL); - assertThat(convertedUser.getImageUrl()).isEqualTo(DEFAULT_IMAGEURL); + // assertThat(convertedUser.getImageUrl()).isEqualTo(DEFAULT_IMAGEURL); assertThat(convertedUser.getLangKey()).isEqualTo(DEFAULT_LANGKEY); } @@ -183,11 +183,11 @@ void createUserWithExistingId() throws Exception { AdminUserDTO userDTO = new AdminUserDTO(); userDTO.setId(DEFAULT_ID); userDTO.setLogin(DEFAULT_LOGIN); - userDTO.setFirstName(DEFAULT_FIRSTNAME); - userDTO.setLastName(DEFAULT_LASTNAME); + // userDTO.setFirstName(DEFAULT_FIRSTNAME); + // userDTO.setLastName(DEFAULT_LASTNAME); userDTO.setEmail(DEFAULT_EMAIL); userDTO.setActivated(true); - userDTO.setImageUrl(DEFAULT_IMAGEURL); + // userDTO.setImageUrl(DEFAULT_IMAGEURL); userDTO.setLangKey(DEFAULT_LANGKEY); userDTO.setAuthorities(Collections.singleton(AuthoritiesConstants.USER)); @@ -209,11 +209,11 @@ void createUserWithExistingLogin() throws Exception { AdminUserDTO userDTO = new AdminUserDTO(); userDTO.setLogin(DEFAULT_LOGIN); // this login should already be used - userDTO.setFirstName(DEFAULT_FIRSTNAME); - userDTO.setLastName(DEFAULT_LASTNAME); + // userDTO.setFirstName(DEFAULT_FIRSTNAME); + // userDTO.setLastName(DEFAULT_LASTNAME); userDTO.setEmail("anothermail@localhost"); userDTO.setActivated(true); - userDTO.setImageUrl(DEFAULT_IMAGEURL); + // userDTO.setImageUrl(DEFAULT_IMAGEURL); userDTO.setLangKey(DEFAULT_LANGKEY); userDTO.setAuthorities(Collections.singleton(AuthoritiesConstants.USER)); @@ -235,11 +235,11 @@ void createUserWithExistingEmail() throws Exception { AdminUserDTO userDTO = new AdminUserDTO(); userDTO.setLogin("anotherlogin"); - userDTO.setFirstName(DEFAULT_FIRSTNAME); - userDTO.setLastName(DEFAULT_LASTNAME); + // userDTO.setFirstName(DEFAULT_FIRSTNAME); + // userDTO.setLastName(DEFAULT_LASTNAME); userDTO.setEmail(DEFAULT_EMAIL); // this email should already be used userDTO.setActivated(true); - userDTO.setImageUrl(DEFAULT_IMAGEURL); + // userDTO.setImageUrl(DEFAULT_IMAGEURL); userDTO.setLangKey(DEFAULT_LANGKEY); userDTO.setAuthorities(Collections.singleton(AuthoritiesConstants.USER)); @@ -264,10 +264,10 @@ void getAllUsers() throws Exception { .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) .andExpect(jsonPath("$.[*].login").value(hasItem(DEFAULT_LOGIN))) - .andExpect(jsonPath("$.[*].firstName").value(hasItem(DEFAULT_FIRSTNAME))) - .andExpect(jsonPath("$.[*].lastName").value(hasItem(DEFAULT_LASTNAME))) + // .andExpect(jsonPath("$.[*].firstName").value(hasItem(DEFAULT_FIRSTNAME))) + // .andExpect(jsonPath("$.[*].lastName").value(hasItem(DEFAULT_LASTNAME))) .andExpect(jsonPath("$.[*].email").value(hasItem(DEFAULT_EMAIL))) - .andExpect(jsonPath("$.[*].imageUrl").value(hasItem(DEFAULT_IMAGEURL))) + // .andExpect(jsonPath("$.[*].imageUrl").value(hasItem(DEFAULT_IMAGEURL))) .andExpect(jsonPath("$.[*].langKey").value(hasItem(DEFAULT_LANGKEY))); } @@ -285,10 +285,10 @@ void getUser() throws Exception { .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) .andExpect(jsonPath("$.login").value(user.getLogin())) - .andExpect(jsonPath("$.firstName").value(DEFAULT_FIRSTNAME)) - .andExpect(jsonPath("$.lastName").value(DEFAULT_LASTNAME)) + // .andExpect(jsonPath("$.firstName").value(DEFAULT_FIRSTNAME)) + // .andExpect(jsonPath("$.lastName").value(DEFAULT_LASTNAME)) .andExpect(jsonPath("$.email").value(DEFAULT_EMAIL)) - .andExpect(jsonPath("$.imageUrl").value(DEFAULT_IMAGEURL)) + // .andExpect(jsonPath("$.imageUrl").value(DEFAULT_IMAGEURL)) .andExpect(jsonPath("$.langKey").value(DEFAULT_LANGKEY)); assertThat(cacheManager.getCache(UserRepository.USERS_BY_LOGIN_CACHE).get(user.getLogin())).isNotNull(); @@ -313,11 +313,11 @@ void updateUser() throws Exception { AdminUserDTO userDTO = new AdminUserDTO(); userDTO.setId(updatedUser.getId()); userDTO.setLogin(updatedUser.getLogin()); - userDTO.setFirstName(UPDATED_FIRSTNAME); - userDTO.setLastName(UPDATED_LASTNAME); + // userDTO.setFirstName(UPDATED_FIRSTNAME); + // userDTO.setLastName(UPDATED_LASTNAME); userDTO.setEmail(UPDATED_EMAIL); userDTO.setActivated(updatedUser.isActivated()); - userDTO.setImageUrl(UPDATED_IMAGEURL); + // userDTO.setImageUrl(UPDATED_IMAGEURL); userDTO.setLangKey(UPDATED_LANGKEY); userDTO.setCreatedBy(updatedUser.getCreatedBy()); userDTO.setCreatedDate(updatedUser.getCreatedDate()); @@ -333,10 +333,10 @@ void updateUser() throws Exception { assertPersistedUsers(users -> { assertThat(users).hasSize(databaseSizeBeforeUpdate); User testUser = users.stream().filter(usr -> usr.getId().equals(updatedUser.getId())).findFirst().orElseThrow(); - assertThat(testUser.getFirstName()).isEqualTo(UPDATED_FIRSTNAME); - assertThat(testUser.getLastName()).isEqualTo(UPDATED_LASTNAME); + // assertThat(testUser.getFirstName()).isEqualTo(UPDATED_FIRSTNAME); + // assertThat(testUser.getLastName()).isEqualTo(UPDATED_LASTNAME); assertThat(testUser.getEmail()).isEqualTo(UPDATED_EMAIL); - assertThat(testUser.getImageUrl()).isEqualTo(UPDATED_IMAGEURL); + // assertThat(testUser.getImageUrl()).isEqualTo(UPDATED_IMAGEURL); assertThat(testUser.getLangKey()).isEqualTo(UPDATED_LANGKEY); }); } @@ -354,11 +354,11 @@ void updateUserLogin() throws Exception { AdminUserDTO userDTO = new AdminUserDTO(); userDTO.setId(updatedUser.getId()); userDTO.setLogin(UPDATED_LOGIN); - userDTO.setFirstName(UPDATED_FIRSTNAME); - userDTO.setLastName(UPDATED_LASTNAME); + // userDTO.setFirstName(UPDATED_FIRSTNAME); + // userDTO.setLastName(UPDATED_LASTNAME); userDTO.setEmail(UPDATED_EMAIL); userDTO.setActivated(updatedUser.isActivated()); - userDTO.setImageUrl(UPDATED_IMAGEURL); + // userDTO.setImageUrl(UPDATED_IMAGEURL); userDTO.setLangKey(UPDATED_LANGKEY); userDTO.setCreatedBy(updatedUser.getCreatedBy()); userDTO.setCreatedDate(updatedUser.getCreatedDate()); @@ -375,10 +375,10 @@ void updateUserLogin() throws Exception { assertThat(users).hasSize(databaseSizeBeforeUpdate); User testUser = users.stream().filter(usr -> usr.getId().equals(updatedUser.getId())).findFirst().orElseThrow(); assertThat(testUser.getLogin()).isEqualTo(UPDATED_LOGIN); - assertThat(testUser.getFirstName()).isEqualTo(UPDATED_FIRSTNAME); - assertThat(testUser.getLastName()).isEqualTo(UPDATED_LASTNAME); + // assertThat(testUser.getFirstName()).isEqualTo(UPDATED_FIRSTNAME); + // assertThat(testUser.getLastName()).isEqualTo(UPDATED_LASTNAME); assertThat(testUser.getEmail()).isEqualTo(UPDATED_EMAIL); - assertThat(testUser.getImageUrl()).isEqualTo(UPDATED_IMAGEURL); + // assertThat(testUser.getImageUrl()).isEqualTo(UPDATED_IMAGEURL); assertThat(testUser.getLangKey()).isEqualTo(UPDATED_LANGKEY); }); } @@ -394,9 +394,9 @@ void updateUserExistingEmail() throws Exception { anotherUser.setPassword(RandomStringUtils.randomAlphanumeric(60)); anotherUser.setActivated(true); anotherUser.setEmail("jhipster@localhost"); - anotherUser.setFirstName("java"); - anotherUser.setLastName("hipster"); - anotherUser.setImageUrl(""); + // anotherUser.setFirstName("java"); + // anotherUser.setLastName("hipster"); + // anotherUser.setImageUrl(""); anotherUser.setLangKey("en"); userRepository.saveAndFlush(anotherUser); @@ -406,11 +406,11 @@ void updateUserExistingEmail() throws Exception { AdminUserDTO userDTO = new AdminUserDTO(); userDTO.setId(updatedUser.getId()); userDTO.setLogin(updatedUser.getLogin()); - userDTO.setFirstName(updatedUser.getFirstName()); - userDTO.setLastName(updatedUser.getLastName()); + // userDTO.setFirstName(updatedUser.getFirstName()); + // userDTO.setLastName(updatedUser.getLastName()); userDTO.setEmail("jhipster@localhost"); // this email should already be used by anotherUser userDTO.setActivated(updatedUser.isActivated()); - userDTO.setImageUrl(updatedUser.getImageUrl()); + // userDTO.setImageUrl(updatedUser.getImageUrl()); userDTO.setLangKey(updatedUser.getLangKey()); userDTO.setCreatedBy(updatedUser.getCreatedBy()); userDTO.setCreatedDate(updatedUser.getCreatedDate()); @@ -434,9 +434,9 @@ void updateUserExistingLogin() throws Exception { anotherUser.setPassword(RandomStringUtils.randomAlphanumeric(60)); anotherUser.setActivated(true); anotherUser.setEmail("jhipster@localhost"); - anotherUser.setFirstName("java"); - anotherUser.setLastName("hipster"); - anotherUser.setImageUrl(""); + // anotherUser.setFirstName("java"); + // anotherUser.setLastName("hipster"); + // anotherUser.setImageUrl(""); anotherUser.setLangKey("en"); userRepository.saveAndFlush(anotherUser); @@ -446,11 +446,11 @@ void updateUserExistingLogin() throws Exception { AdminUserDTO userDTO = new AdminUserDTO(); userDTO.setId(updatedUser.getId()); userDTO.setLogin("jhipster"); // this login should already be used by anotherUser - userDTO.setFirstName(updatedUser.getFirstName()); - userDTO.setLastName(updatedUser.getLastName()); + // userDTO.setFirstName(updatedUser.getFirstName()); + // userDTO.setLastName(updatedUser.getLastName()); userDTO.setEmail(updatedUser.getEmail()); userDTO.setActivated(updatedUser.isActivated()); - userDTO.setImageUrl(updatedUser.getImageUrl()); + // userDTO.setImageUrl(updatedUser.getImageUrl()); userDTO.setLangKey(updatedUser.getLangKey()); userDTO.setCreatedBy(updatedUser.getCreatedBy()); userDTO.setCreatedDate(updatedUser.getCreatedDate()); From 6cc9d1ca3ae00ddcea1fd77aa777dcacd0214d36 Mon Sep 17 00:00:00 2001 From: Lee Wei Jie Date: Sun, 3 Nov 2024 18:57:55 +0800 Subject: [PATCH 2/6] quick fix for activity invite --- src/main/resources/.h2.server.properties | 2 +- .../webapp/app/entities/activity-invite/activity-invite.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/resources/.h2.server.properties b/src/main/resources/.h2.server.properties index 1a7ce59..01dc5a2 100644 --- a/src/main/resources/.h2.server.properties +++ b/src/main/resources/.h2.server.properties @@ -1,5 +1,5 @@ #H2 Server Properties -#Wed Oct 30 23:33:01 SGT 2024 +#Sun Nov 03 18:42:49 SGT 2024 0=JHipster H2 (Disk)|org.h2.Driver|jdbc\:h2\:file\:./target/h2db/db/scaleup|scaleup webAllowOthers=true webPort=8092 diff --git a/src/main/webapp/app/entities/activity-invite/activity-invite.tsx b/src/main/webapp/app/entities/activity-invite/activity-invite.tsx index ed5e498..f85c5d7 100644 --- a/src/main/webapp/app/entities/activity-invite/activity-invite.tsx +++ b/src/main/webapp/app/entities/activity-invite/activity-invite.tsx @@ -57,7 +57,7 @@ export const ActivityInvite = () => { // Filter the activityInviteList on the client-side const filteredActivityInviteList = activityInviteList.filter( - invite => invite.inviteeProfile.id === currentUser.id.toString() || invite.createdBy === currentUser.login, + invite => invite.inviteeProfile.id === currentUser.id || invite.createdBy === currentUser.login, ); // Fetch Activity Name From d53a77f11bb9c2533831983d49368b356d098795 Mon Sep 17 00:00:00 2001 From: sayoungestguy Date: Sun, 3 Nov 2024 20:47:39 +0800 Subject: [PATCH 3/6] System Cleanup (hide/delete stuff not in the proposal) (Notification) --- .../scaleup/config/CacheConfiguration.java | 1 - .../scaleup/domain/Notification.java | 210 ------ .../com/teamsixnus/scaleup/domain/User.java | 24 - .../repository/NotificationRepository.java | 12 - .../service/NotificationQueryService.java | 114 ---- .../scaleup/service/NotificationService.java | 99 --- .../scaleup/service/UserService.java | 9 - .../scaleup/service/dto/NotificationDTO.java | 153 ----- .../service/mapper/NotificationMapper.java | 29 - .../web/rest/NotificationResource.java | 203 ------ src/main/resources/.h2.server.properties | 2 +- ...240825084300_added_entity_Notification.xml | 77 --- ..._added_entity_constraints_Notification.xml | 27 - .../liquibase/fake-data/notification.csv | 11 - .../resources/config/liquibase/master.xml | 2 - .../app/entities/notification/index.tsx | 23 - .../notification-delete-dialog.tsx | 64 -- .../notification/notification-detail.tsx | 84 --- .../notification/notification-reducer.spec.ts | 259 -------- .../notification/notification-update.tsx | 177 ----- .../notification/notification.reducer.ts | 128 ---- .../entities/notification/notification.tsx | 230 ------- src/main/webapp/app/entities/reducers.ts | 2 - src/main/webapp/app/entities/routes.tsx | 3 +- .../scaleup/domain/NotificationAsserts.java | 69 -- .../scaleup/domain/NotificationTest.java | 50 -- .../domain/NotificationTestSamples.java | 35 - .../service/dto/NotificationDTOTest.java | 24 - .../mapper/NotificationMapperTest.java | 24 - .../web/rest/NotificationResourceIT.java | 623 ------------------ .../scaleup/web/rest/UserResourceIT.java | 34 - 31 files changed, 2 insertions(+), 2800 deletions(-) delete mode 100644 src/main/java/com/teamsixnus/scaleup/domain/Notification.java delete mode 100644 src/main/java/com/teamsixnus/scaleup/repository/NotificationRepository.java delete mode 100644 src/main/java/com/teamsixnus/scaleup/service/NotificationQueryService.java delete mode 100644 src/main/java/com/teamsixnus/scaleup/service/NotificationService.java delete mode 100644 src/main/java/com/teamsixnus/scaleup/service/dto/NotificationDTO.java delete mode 100644 src/main/java/com/teamsixnus/scaleup/service/mapper/NotificationMapper.java delete mode 100644 src/main/java/com/teamsixnus/scaleup/web/rest/NotificationResource.java delete mode 100644 src/main/resources/config/liquibase/changelog/20240825084300_added_entity_Notification.xml delete mode 100644 src/main/resources/config/liquibase/changelog/20240825084300_added_entity_constraints_Notification.xml delete mode 100644 src/main/resources/config/liquibase/fake-data/notification.csv delete mode 100644 src/main/webapp/app/entities/notification/index.tsx delete mode 100644 src/main/webapp/app/entities/notification/notification-delete-dialog.tsx delete mode 100644 src/main/webapp/app/entities/notification/notification-detail.tsx delete mode 100644 src/main/webapp/app/entities/notification/notification-reducer.spec.ts delete mode 100644 src/main/webapp/app/entities/notification/notification-update.tsx delete mode 100644 src/main/webapp/app/entities/notification/notification.reducer.ts delete mode 100644 src/main/webapp/app/entities/notification/notification.tsx delete mode 100644 src/test/java/com/teamsixnus/scaleup/domain/NotificationAsserts.java delete mode 100644 src/test/java/com/teamsixnus/scaleup/domain/NotificationTest.java delete mode 100644 src/test/java/com/teamsixnus/scaleup/domain/NotificationTestSamples.java delete mode 100644 src/test/java/com/teamsixnus/scaleup/service/dto/NotificationDTOTest.java delete mode 100644 src/test/java/com/teamsixnus/scaleup/service/mapper/NotificationMapperTest.java delete mode 100644 src/test/java/com/teamsixnus/scaleup/web/rest/NotificationResourceIT.java diff --git a/src/main/java/com/teamsixnus/scaleup/config/CacheConfiguration.java b/src/main/java/com/teamsixnus/scaleup/config/CacheConfiguration.java index 486c9fb..d425397 100644 --- a/src/main/java/com/teamsixnus/scaleup/config/CacheConfiguration.java +++ b/src/main/java/com/teamsixnus/scaleup/config/CacheConfiguration.java @@ -57,7 +57,6 @@ public JCacheManagerCustomizer cacheManagerCustomizer() { createCache(cm, com.teamsixnus.scaleup.domain.Message.class.getName()); createCache(cm, com.teamsixnus.scaleup.domain.Activity.class.getName()); createCache(cm, com.teamsixnus.scaleup.domain.ActivityInvite.class.getName()); - createCache(cm, com.teamsixnus.scaleup.domain.Notification.class.getName()); createCache(cm, com.teamsixnus.scaleup.domain.UserSkill.class.getName()); // jhipster-needle-ehcache-add-entry }; diff --git a/src/main/java/com/teamsixnus/scaleup/domain/Notification.java b/src/main/java/com/teamsixnus/scaleup/domain/Notification.java deleted file mode 100644 index 860b547..0000000 --- a/src/main/java/com/teamsixnus/scaleup/domain/Notification.java +++ /dev/null @@ -1,210 +0,0 @@ -package com.teamsixnus.scaleup.domain; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import jakarta.persistence.*; -import java.io.Serializable; -import java.time.Instant; -import java.util.UUID; -import org.hibernate.annotations.Cache; -import org.hibernate.annotations.CacheConcurrencyStrategy; -import org.hibernate.annotations.JdbcTypeCode; -import org.hibernate.type.SqlTypes; -import org.springframework.data.domain.Persistable; - -/** - * A Notification. - */ -@Entity -@Table(name = "tbl_notification") -@Cache(usage = CacheConcurrencyStrategy.READ_WRITE) -@JsonIgnoreProperties(value = { "new" }) -@SuppressWarnings("common-java:DuplicatedBlocks") -public class Notification extends AbstractAuditingEntity implements Serializable, Persistable { - - private static final long serialVersionUID = 1L; - - @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) - @Column(name = "id") - private Long id; - - @JdbcTypeCode(SqlTypes.VARCHAR) - @Column(name = "notification_ref_id", length = 36) - private UUID notificationRefId; - - @Lob - @Column(name = "content") - private String content; - - @Column(name = "is_read") - private Boolean isRead; - - // Inherited createdBy definition - // Inherited createdDate definition - // Inherited lastModifiedBy definition - // Inherited lastModifiedDate definition - @Transient - private boolean isPersisted; - - @ManyToOne(fetch = FetchType.LAZY) - @JsonIgnoreProperties(value = { "user" }, allowSetters = true) - private UserProfile userProfile; - - @ManyToOne(fetch = FetchType.LAZY) - private CodeTables type; - - // jhipster-needle-entity-add-field - JHipster will add fields here - - public Long getId() { - return this.id; - } - - public Notification id(Long id) { - this.setId(id); - return this; - } - - public void setId(Long id) { - this.id = id; - } - - public UUID getNotificationRefId() { - return this.notificationRefId; - } - - public Notification notificationRefId(UUID notificationRefId) { - this.setNotificationRefId(notificationRefId); - return this; - } - - public void setNotificationRefId(UUID notificationRefId) { - this.notificationRefId = notificationRefId; - } - - public String getContent() { - return this.content; - } - - public Notification content(String content) { - this.setContent(content); - return this; - } - - public void setContent(String content) { - this.content = content; - } - - public Boolean getIsRead() { - return this.isRead; - } - - public Notification isRead(Boolean isRead) { - this.setIsRead(isRead); - return this; - } - - public void setIsRead(Boolean isRead) { - this.isRead = isRead; - } - - // Inherited createdBy methods - public Notification createdBy(String createdBy) { - this.setCreatedBy(createdBy); - return this; - } - - // Inherited createdDate methods - public Notification createdDate(Instant createdDate) { - this.setCreatedDate(createdDate); - return this; - } - - // Inherited lastModifiedBy methods - public Notification lastModifiedBy(String lastModifiedBy) { - this.setLastModifiedBy(lastModifiedBy); - return this; - } - - // Inherited lastModifiedDate methods - public Notification lastModifiedDate(Instant lastModifiedDate) { - this.setLastModifiedDate(lastModifiedDate); - return this; - } - - @PostLoad - @PostPersist - public void updateEntityState() { - this.setIsPersisted(); - } - - @Transient - @Override - public boolean isNew() { - return !this.isPersisted; - } - - public Notification setIsPersisted() { - this.isPersisted = true; - return this; - } - - public UserProfile getUserProfile() { - return this.userProfile; - } - - public void setUserProfile(UserProfile userProfile) { - this.userProfile = userProfile; - } - - public Notification userProfile(UserProfile userProfile) { - this.setUserProfile(userProfile); - return this; - } - - public CodeTables getType() { - return this.type; - } - - public void setType(CodeTables codeTables) { - this.type = codeTables; - } - - public Notification type(CodeTables codeTables) { - this.setType(codeTables); - return this; - } - - // jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (!(o instanceof Notification)) { - return false; - } - return id != null && id.equals(((Notification) o).id); - } - - @Override - public int hashCode() { - // see https://vladmihalcea.com/how-to-implement-equals-and-hashcode-using-the-jpa-entity-identifier/ - return getClass().hashCode(); - } - - // prettier-ignore - @Override - public String toString() { - return "Notification{" + - "id=" + getId() + - ", notificationRefId='" + getNotificationRefId() + "'" + - ", content='" + getContent() + "'" + - ", isRead='" + getIsRead() + "'" + - ", createdBy='" + getCreatedBy() + "'" + - ", createdDate='" + getCreatedDate() + "'" + - ", lastModifiedBy='" + getLastModifiedBy() + "'" + - ", lastModifiedDate='" + getLastModifiedDate() + "'" + - "}"; - } -} diff --git a/src/main/java/com/teamsixnus/scaleup/domain/User.java b/src/main/java/com/teamsixnus/scaleup/domain/User.java index c72a886..795b965 100644 --- a/src/main/java/com/teamsixnus/scaleup/domain/User.java +++ b/src/main/java/com/teamsixnus/scaleup/domain/User.java @@ -117,22 +117,6 @@ public void setPassword(String password) { this.password = password; } - // public String getFirstName() { - // return firstName; - // } - // - // public void setFirstName(String firstName) { - // this.firstName = firstName; - // } - // - // public String getLastName() { - // return lastName; - // } - // - // public void setLastName(String lastName) { - // this.lastName = lastName; - // } - public String getEmail() { return email; } @@ -141,14 +125,6 @@ public void setEmail(String email) { this.email = email; } - // public String getImageUrl() { - // return imageUrl; - // } - // - // public void setImageUrl(String imageUrl) { - // this.imageUrl = imageUrl; - // } - public boolean isActivated() { return activated; } diff --git a/src/main/java/com/teamsixnus/scaleup/repository/NotificationRepository.java b/src/main/java/com/teamsixnus/scaleup/repository/NotificationRepository.java deleted file mode 100644 index 9b6730a..0000000 --- a/src/main/java/com/teamsixnus/scaleup/repository/NotificationRepository.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.teamsixnus.scaleup.repository; - -import com.teamsixnus.scaleup.domain.Notification; -import org.springframework.data.jpa.repository.*; -import org.springframework.stereotype.Repository; - -/** - * Spring Data JPA repository for the Notification entity. - */ -@SuppressWarnings("unused") -@Repository -public interface NotificationRepository extends JpaRepository, JpaSpecificationExecutor {} diff --git a/src/main/java/com/teamsixnus/scaleup/service/NotificationQueryService.java b/src/main/java/com/teamsixnus/scaleup/service/NotificationQueryService.java deleted file mode 100644 index 4064501..0000000 --- a/src/main/java/com/teamsixnus/scaleup/service/NotificationQueryService.java +++ /dev/null @@ -1,114 +0,0 @@ -package com.teamsixnus.scaleup.service; - -import com.teamsixnus.scaleup.domain.*; // for static metamodels -import com.teamsixnus.scaleup.domain.Notification; -import com.teamsixnus.scaleup.repository.NotificationRepository; -import com.teamsixnus.scaleup.service.criteria.NotificationCriteria; -import com.teamsixnus.scaleup.service.dto.NotificationDTO; -import com.teamsixnus.scaleup.service.mapper.NotificationMapper; -import jakarta.persistence.criteria.JoinType; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.data.domain.Page; -import org.springframework.data.domain.Pageable; -import org.springframework.data.jpa.domain.Specification; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import tech.jhipster.service.QueryService; - -/** - * Service for executing complex queries for {@link Notification} entities in the database. - * The main input is a {@link NotificationCriteria} which gets converted to {@link Specification}, - * in a way that all the filters must apply. - * It returns a {@link Page} of {@link NotificationDTO} which fulfills the criteria. - */ -@Service -@Transactional(readOnly = true) -public class NotificationQueryService extends QueryService { - - private static final Logger log = LoggerFactory.getLogger(NotificationQueryService.class); - - private final NotificationRepository notificationRepository; - - private final NotificationMapper notificationMapper; - - public NotificationQueryService(NotificationRepository notificationRepository, NotificationMapper notificationMapper) { - this.notificationRepository = notificationRepository; - this.notificationMapper = notificationMapper; - } - - /** - * Return a {@link Page} of {@link NotificationDTO} which matches the criteria from the database. - * @param criteria The object which holds all the filters, which the entities should match. - * @param page The page, which should be returned. - * @return the matching entities. - */ - @Transactional(readOnly = true) - public Page findByCriteria(NotificationCriteria criteria, Pageable page) { - // log.debug("find by criteria : {}, page: {}", criteria, page); - final Specification specification = createSpecification(criteria); - return notificationRepository.findAll(specification, page).map(notificationMapper::toDto); - } - - /** - * Return the number of matching entities in the database. - * @param criteria The object which holds all the filters, which the entities should match. - * @return the number of matching entities. - */ - @Transactional(readOnly = true) - public long countByCriteria(NotificationCriteria criteria) { - // log.debug("count by criteria : {}", criteria); - final Specification specification = createSpecification(criteria); - return notificationRepository.count(specification); - } - - /** - * Function to convert {@link NotificationCriteria} to a {@link Specification} - * @param criteria The object which holds all the filters, which the entities should match. - * @return the matching {@link Specification} of the entity. - */ - protected Specification createSpecification(NotificationCriteria criteria) { - Specification specification = Specification.where(null); - if (criteria != null) { - // This has to be called first, because the distinct method returns null - if (criteria.getDistinct() != null) { - specification = specification.and(distinct(criteria.getDistinct())); - } - if (criteria.getId() != null) { - specification = specification.and(buildRangeSpecification(criteria.getId(), Notification_.id)); - } - if (criteria.getNotificationRefId() != null) { - specification = specification.and(buildSpecification(criteria.getNotificationRefId(), Notification_.notificationRefId)); - } - if (criteria.getIsRead() != null) { - specification = specification.and(buildSpecification(criteria.getIsRead(), Notification_.isRead)); - } - if (criteria.getCreatedBy() != null) { - specification = specification.and(buildStringSpecification(criteria.getCreatedBy(), Notification_.createdBy)); - } - if (criteria.getCreatedDate() != null) { - specification = specification.and(buildRangeSpecification(criteria.getCreatedDate(), Notification_.createdDate)); - } - if (criteria.getLastModifiedBy() != null) { - specification = specification.and(buildStringSpecification(criteria.getLastModifiedBy(), Notification_.lastModifiedBy)); - } - if (criteria.getLastModifiedDate() != null) { - specification = specification.and(buildRangeSpecification(criteria.getLastModifiedDate(), Notification_.lastModifiedDate)); - } - if (criteria.getUserProfileId() != null) { - specification = specification.and( - buildSpecification( - criteria.getUserProfileId(), - root -> root.join(Notification_.userProfile, JoinType.LEFT).get(UserProfile_.id) - ) - ); - } - if (criteria.getTypeId() != null) { - specification = specification.and( - buildSpecification(criteria.getTypeId(), root -> root.join(Notification_.type, JoinType.LEFT).get(CodeTables_.id)) - ); - } - } - return specification; - } -} diff --git a/src/main/java/com/teamsixnus/scaleup/service/NotificationService.java b/src/main/java/com/teamsixnus/scaleup/service/NotificationService.java deleted file mode 100644 index d941ae8..0000000 --- a/src/main/java/com/teamsixnus/scaleup/service/NotificationService.java +++ /dev/null @@ -1,99 +0,0 @@ -package com.teamsixnus.scaleup.service; - -import com.teamsixnus.scaleup.domain.Notification; -import com.teamsixnus.scaleup.repository.NotificationRepository; -import com.teamsixnus.scaleup.service.dto.NotificationDTO; -import com.teamsixnus.scaleup.service.mapper.NotificationMapper; -import java.util.Optional; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -/** - * Service Implementation for managing {@link com.teamsixnus.scaleup.domain.Notification}. - */ -@Service -@Transactional -public class NotificationService { - - private static final Logger log = LoggerFactory.getLogger(NotificationService.class); - - private final NotificationRepository notificationRepository; - - private final NotificationMapper notificationMapper; - - public NotificationService(NotificationRepository notificationRepository, NotificationMapper notificationMapper) { - this.notificationRepository = notificationRepository; - this.notificationMapper = notificationMapper; - } - - /** - * Save a notification. - * - * @param notificationDTO the entity to save. - * @return the persisted entity. - */ - public NotificationDTO save(NotificationDTO notificationDTO) { - log.debug("Request to save Notification : {}", notificationDTO); - Notification notification = notificationMapper.toEntity(notificationDTO); - notification = notificationRepository.save(notification); - return notificationMapper.toDto(notification); - } - - /** - * Update a notification. - * - * @param notificationDTO the entity to save. - * @return the persisted entity. - */ - public NotificationDTO update(NotificationDTO notificationDTO) { - log.debug("Request to update Notification : {}", notificationDTO); - Notification notification = notificationMapper.toEntity(notificationDTO); - notification.setIsPersisted(); - notification = notificationRepository.save(notification); - return notificationMapper.toDto(notification); - } - - /** - * Partially update a notification. - * - * @param notificationDTO the entity to update partially. - * @return the persisted entity. - */ - public Optional partialUpdate(NotificationDTO notificationDTO) { - log.debug("Request to partially update Notification : {}", notificationDTO); - - return notificationRepository - .findById(notificationDTO.getId()) - .map(existingNotification -> { - notificationMapper.partialUpdate(existingNotification, notificationDTO); - - return existingNotification; - }) - .map(notificationRepository::save) - .map(notificationMapper::toDto); - } - - /** - * Get one notification by id. - * - * @param id the id of the entity. - * @return the entity. - */ - @Transactional(readOnly = true) - public Optional findOne(Long id) { - log.debug("Request to get Notification : {}", id); - return notificationRepository.findById(id).map(notificationMapper::toDto); - } - - /** - * Delete the notification by id. - * - * @param id the id of the entity. - */ - public void delete(Long id) { - log.debug("Request to delete Notification : {}", id); - notificationRepository.deleteById(id); - } -} diff --git a/src/main/java/com/teamsixnus/scaleup/service/UserService.java b/src/main/java/com/teamsixnus/scaleup/service/UserService.java index c9e0c8b..dee70b3 100644 --- a/src/main/java/com/teamsixnus/scaleup/service/UserService.java +++ b/src/main/java/com/teamsixnus/scaleup/service/UserService.java @@ -122,12 +122,9 @@ public User registerUser(AdminUserDTO userDTO, String password) { newUser.setLogin(userDTO.getLogin().toLowerCase()); // new user gets initially a generated password newUser.setPassword(encryptedPassword); - // newUser.setFirstName(userDTO.getFirstName()); - // newUser.setLastName(userDTO.getLastName()); if (userDTO.getEmail() != null) { newUser.setEmail(userDTO.getEmail().toLowerCase()); } - // newUser.setImageUrl(userDTO.getImageUrl()); newUser.setLangKey(userDTO.getLangKey()); // new user is not active newUser.setActivated(false); @@ -155,8 +152,6 @@ private boolean removeNonActivatedUser(User existingUser) { public User createUser(AdminUserDTO userDTO) { User user = new User(); user.setLogin(userDTO.getLogin().toLowerCase()); - // user.setFirstName(userDTO.getFirstName()); - // user.setLastName(userDTO.getLastName()); if (userDTO.getEmail() != null) { user.setEmail(userDTO.getEmail().toLowerCase()); } @@ -201,8 +196,6 @@ public Optional updateUser(AdminUserDTO userDTO) { .map(user -> { this.clearUserCaches(user); user.setLogin(userDTO.getLogin().toLowerCase()); - // user.setFirstName(userDTO.getFirstName()); - // user.setLastName(userDTO.getLastName()); if (userDTO.getEmail() != null) { user.setEmail(userDTO.getEmail().toLowerCase()); } @@ -246,8 +239,6 @@ public void updateUser(String email, String langKey) { SecurityUtils.getCurrentUserLogin() .flatMap(userRepository::findOneByLogin) .ifPresent(user -> { - // user.setFirstName(firstName); - // user.setLastName(lastName); if (email != null) { user.setEmail(email.toLowerCase()); } diff --git a/src/main/java/com/teamsixnus/scaleup/service/dto/NotificationDTO.java b/src/main/java/com/teamsixnus/scaleup/service/dto/NotificationDTO.java deleted file mode 100644 index 146a72f..0000000 --- a/src/main/java/com/teamsixnus/scaleup/service/dto/NotificationDTO.java +++ /dev/null @@ -1,153 +0,0 @@ -package com.teamsixnus.scaleup.service.dto; - -import jakarta.persistence.Lob; -import java.io.Serializable; -import java.time.Instant; -import java.util.Objects; -import java.util.UUID; - -/** - * A DTO for the {@link com.teamsixnus.scaleup.domain.Notification} entity. - */ -@SuppressWarnings("common-java:DuplicatedBlocks") -public class NotificationDTO implements Serializable { - - private Long id; - - private UUID notificationRefId; - - @Lob - private String content; - - private Boolean isRead; - - private String createdBy; - - private Instant createdDate; - - private String lastModifiedBy; - - private Instant lastModifiedDate; - - private UserProfileDTO userProfile; - - private CodeTablesDTO type; - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public UUID getNotificationRefId() { - return notificationRefId; - } - - public void setNotificationRefId(UUID notificationRefId) { - this.notificationRefId = notificationRefId; - } - - public String getContent() { - return content; - } - - public void setContent(String content) { - this.content = content; - } - - public Boolean getIsRead() { - return isRead; - } - - public void setIsRead(Boolean isRead) { - this.isRead = isRead; - } - - public String getCreatedBy() { - return createdBy; - } - - public void setCreatedBy(String createdBy) { - this.createdBy = createdBy; - } - - public Instant getCreatedDate() { - return createdDate; - } - - public void setCreatedDate(Instant createdDate) { - this.createdDate = createdDate; - } - - public String getLastModifiedBy() { - return lastModifiedBy; - } - - public void setLastModifiedBy(String lastModifiedBy) { - this.lastModifiedBy = lastModifiedBy; - } - - public Instant getLastModifiedDate() { - return lastModifiedDate; - } - - public void setLastModifiedDate(Instant lastModifiedDate) { - this.lastModifiedDate = lastModifiedDate; - } - - public UserProfileDTO getUserProfile() { - return userProfile; - } - - public void setUserProfile(UserProfileDTO userProfile) { - this.userProfile = userProfile; - } - - public CodeTablesDTO getType() { - return type; - } - - public void setType(CodeTablesDTO type) { - this.type = type; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (!(o instanceof NotificationDTO)) { - return false; - } - - NotificationDTO notificationDTO = (NotificationDTO) o; - if (this.id == null) { - return false; - } - return Objects.equals(this.id, notificationDTO.id); - } - - @Override - public int hashCode() { - return Objects.hash(this.id); - } - - // prettier-ignore - @Override - public String toString() { - return "NotificationDTO{" + - "id=" + getId() + - ", notificationRefId='" + getNotificationRefId() + "'" + - ", content='" + getContent() + "'" + - ", isRead='" + getIsRead() + "'" + - ", createdBy='" + getCreatedBy() + "'" + - ", createdDate='" + getCreatedDate() + "'" + - ", lastModifiedBy='" + getLastModifiedBy() + "'" + - ", lastModifiedDate='" + getLastModifiedDate() + "'" + - ", userProfile=" + getUserProfile() + - ", type=" + getType() + - "}"; - } -} diff --git a/src/main/java/com/teamsixnus/scaleup/service/mapper/NotificationMapper.java b/src/main/java/com/teamsixnus/scaleup/service/mapper/NotificationMapper.java deleted file mode 100644 index b82cb5b..0000000 --- a/src/main/java/com/teamsixnus/scaleup/service/mapper/NotificationMapper.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.teamsixnus.scaleup.service.mapper; - -import com.teamsixnus.scaleup.domain.CodeTables; -import com.teamsixnus.scaleup.domain.Notification; -import com.teamsixnus.scaleup.domain.UserProfile; -import com.teamsixnus.scaleup.service.dto.CodeTablesDTO; -import com.teamsixnus.scaleup.service.dto.NotificationDTO; -import com.teamsixnus.scaleup.service.dto.UserProfileDTO; -import org.mapstruct.*; - -/** - * Mapper for the entity {@link Notification} and its DTO {@link NotificationDTO}. - */ -@Mapper(componentModel = "spring") -public interface NotificationMapper extends EntityMapper { - @Mapping(target = "userProfile", source = "userProfile", qualifiedByName = "userProfileId") - @Mapping(target = "type", source = "type", qualifiedByName = "codeTablesId") - NotificationDTO toDto(Notification s); - - @Named("userProfileId") - @BeanMapping(ignoreByDefault = true) - @Mapping(target = "id", source = "id") - UserProfileDTO toDtoUserProfileId(UserProfile userProfile); - - @Named("codeTablesId") - @BeanMapping(ignoreByDefault = true) - @Mapping(target = "id", source = "id") - CodeTablesDTO toDtoCodeTablesId(CodeTables codeTables); -} diff --git a/src/main/java/com/teamsixnus/scaleup/web/rest/NotificationResource.java b/src/main/java/com/teamsixnus/scaleup/web/rest/NotificationResource.java deleted file mode 100644 index c243007..0000000 --- a/src/main/java/com/teamsixnus/scaleup/web/rest/NotificationResource.java +++ /dev/null @@ -1,203 +0,0 @@ -package com.teamsixnus.scaleup.web.rest; - -import com.teamsixnus.scaleup.repository.NotificationRepository; -import com.teamsixnus.scaleup.service.NotificationQueryService; -import com.teamsixnus.scaleup.service.NotificationService; -import com.teamsixnus.scaleup.service.criteria.NotificationCriteria; -import com.teamsixnus.scaleup.service.dto.NotificationDTO; -import com.teamsixnus.scaleup.web.rest.errors.BadRequestAlertException; -import java.net.URI; -import java.net.URISyntaxException; -import java.util.List; -import java.util.Objects; -import java.util.Optional; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.data.domain.Page; -import org.springframework.data.domain.Pageable; -import org.springframework.http.HttpHeaders; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.*; -import org.springframework.web.servlet.support.ServletUriComponentsBuilder; -import tech.jhipster.web.util.HeaderUtil; -import tech.jhipster.web.util.PaginationUtil; -import tech.jhipster.web.util.ResponseUtil; - -/** - * REST controller for managing {@link com.teamsixnus.scaleup.domain.Notification}. - */ -@RestController -@RequestMapping("/api/notifications") -public class NotificationResource { - - private static final Logger log = LoggerFactory.getLogger(NotificationResource.class); - - private static final String ENTITY_NAME = "notification"; - - @Value("${jhipster.clientApp.name}") - private String applicationName; - - private final NotificationService notificationService; - - private final NotificationRepository notificationRepository; - - private final NotificationQueryService notificationQueryService; - - public NotificationResource( - NotificationService notificationService, - NotificationRepository notificationRepository, - NotificationQueryService notificationQueryService - ) { - this.notificationService = notificationService; - this.notificationRepository = notificationRepository; - this.notificationQueryService = notificationQueryService; - } - - /** - * {@code POST /notifications} : Create a new notification. - * - * @param notificationDTO the notificationDTO to create. - * @return the {@link ResponseEntity} with status {@code 201 (Created)} and with body the new notificationDTO, or with status {@code 400 (Bad Request)} if the notification has already an ID. - * @throws URISyntaxException if the Location URI syntax is incorrect. - */ - @PostMapping("") - public ResponseEntity createNotification(@RequestBody NotificationDTO notificationDTO) throws URISyntaxException { - // log.debug("REST request to save Notification : {}", notificationDTO); - if (notificationDTO.getId() != null) { - throw new BadRequestAlertException("A new notification cannot already have an ID", ENTITY_NAME, "idexists"); - } - notificationDTO = notificationService.save(notificationDTO); - return ResponseEntity.created(new URI("/api/notifications/" + notificationDTO.getId())) - .headers(HeaderUtil.createEntityCreationAlert(applicationName, false, ENTITY_NAME, notificationDTO.getId().toString())) - .body(notificationDTO); - } - - /** - * {@code PUT /notifications/:id} : Updates an existing notification. - * - * @param id the id of the notificationDTO to save. - * @param notificationDTO the notificationDTO to update. - * @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body the updated notificationDTO, - * or with status {@code 400 (Bad Request)} if the notificationDTO is not valid, - * or with status {@code 500 (Internal Server Error)} if the notificationDTO couldn't be updated. - * @throws URISyntaxException if the Location URI syntax is incorrect. - */ - @PutMapping("/{id}") - public ResponseEntity updateNotification( - @PathVariable(value = "id", required = false) final Long id, - @RequestBody NotificationDTO notificationDTO - ) throws URISyntaxException { - log.debug("REST request to update Notification : {}, {}", id, notificationDTO); - if (notificationDTO.getId() == null) { - throw new BadRequestAlertException("Invalid id", ENTITY_NAME, "idnull"); - } - if (!Objects.equals(id, notificationDTO.getId())) { - throw new BadRequestAlertException("Invalid ID", ENTITY_NAME, "idinvalid"); - } - - if (!notificationRepository.existsById(id)) { - throw new BadRequestAlertException("Entity not found", ENTITY_NAME, "idnotfound"); - } - - notificationDTO = notificationService.update(notificationDTO); - return ResponseEntity.ok() - .headers(HeaderUtil.createEntityUpdateAlert(applicationName, false, ENTITY_NAME, notificationDTO.getId().toString())) - .body(notificationDTO); - } - - /** - * {@code PATCH /notifications/:id} : Partial updates given fields of an existing notification, field will ignore if it is null - * - * @param id the id of the notificationDTO to save. - * @param notificationDTO the notificationDTO to update. - * @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body the updated notificationDTO, - * or with status {@code 400 (Bad Request)} if the notificationDTO is not valid, - * or with status {@code 404 (Not Found)} if the notificationDTO is not found, - * or with status {@code 500 (Internal Server Error)} if the notificationDTO couldn't be updated. - * @throws URISyntaxException if the Location URI syntax is incorrect. - */ - @PatchMapping(value = "/{id}", consumes = { "application/json", "application/merge-patch+json" }) - public ResponseEntity partialUpdateNotification( - @PathVariable(value = "id", required = false) final Long id, - @RequestBody NotificationDTO notificationDTO - ) throws URISyntaxException { - log.debug("REST request to partial update Notification partially : {}, {}", id, notificationDTO); - if (notificationDTO.getId() == null) { - throw new BadRequestAlertException("Invalid id", ENTITY_NAME, "idnull"); - } - if (!Objects.equals(id, notificationDTO.getId())) { - throw new BadRequestAlertException("Invalid ID", ENTITY_NAME, "idinvalid"); - } - - if (!notificationRepository.existsById(id)) { - throw new BadRequestAlertException("Entity not found", ENTITY_NAME, "idnotfound"); - } - - Optional result = notificationService.partialUpdate(notificationDTO); - - return ResponseUtil.wrapOrNotFound( - result, - HeaderUtil.createEntityUpdateAlert(applicationName, false, ENTITY_NAME, notificationDTO.getId().toString()) - ); - } - - /** - * {@code GET /notifications} : get all the notifications. - * - * @param pageable the pagination information. - * @param criteria the criteria which the requested entities should match. - * @return the {@link ResponseEntity} with status {@code 200 (OK)} and the list of notifications in body. - */ - @GetMapping("") - public ResponseEntity> getAllNotifications( - NotificationCriteria criteria, - @org.springdoc.core.annotations.ParameterObject Pageable pageable - ) { - // log.debug("REST request to get Notifications by criteria: {}", criteria); - - Page page = notificationQueryService.findByCriteria(criteria, pageable); - HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(ServletUriComponentsBuilder.fromCurrentRequest(), page); - return ResponseEntity.ok().headers(headers).body(page.getContent()); - } - - /** - * {@code GET /notifications/count} : count all the notifications. - * - * @param criteria the criteria which the requested entities should match. - * @return the {@link ResponseEntity} with status {@code 200 (OK)} and the count in body. - */ - @GetMapping("/count") - public ResponseEntity countNotifications(NotificationCriteria criteria) { - // log.debug("REST request to count Notifications by criteria: {}", criteria); - return ResponseEntity.ok().body(notificationQueryService.countByCriteria(criteria)); - } - - /** - * {@code GET /notifications/:id} : get the "id" notification. - * - * @param id the id of the notificationDTO to retrieve. - * @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body the notificationDTO, or with status {@code 404 (Not Found)}. - */ - @GetMapping("/{id}") - public ResponseEntity getNotification(@PathVariable("id") Long id) { - log.debug("REST request to get Notification : {}", id); - Optional notificationDTO = notificationService.findOne(id); - return ResponseUtil.wrapOrNotFound(notificationDTO); - } - - /** - * {@code DELETE /notifications/:id} : delete the "id" notification. - * - * @param id the id of the notificationDTO to delete. - * @return the {@link ResponseEntity} with status {@code 204 (NO_CONTENT)}. - */ - @DeleteMapping("/{id}") - public ResponseEntity deleteNotification(@PathVariable("id") Long id) { - log.debug("REST request to delete Notification : {}", id); - notificationService.delete(id); - return ResponseEntity.noContent() - .headers(HeaderUtil.createEntityDeletionAlert(applicationName, false, ENTITY_NAME, id.toString())) - .build(); - } -} diff --git a/src/main/resources/.h2.server.properties b/src/main/resources/.h2.server.properties index 01dc5a2..2ac988e 100644 --- a/src/main/resources/.h2.server.properties +++ b/src/main/resources/.h2.server.properties @@ -1,5 +1,5 @@ #H2 Server Properties -#Sun Nov 03 18:42:49 SGT 2024 +#Sun Nov 03 20:29:23 SGT 2024 0=JHipster H2 (Disk)|org.h2.Driver|jdbc\:h2\:file\:./target/h2db/db/scaleup|scaleup webAllowOthers=true webPort=8092 diff --git a/src/main/resources/config/liquibase/changelog/20240825084300_added_entity_Notification.xml b/src/main/resources/config/liquibase/changelog/20240825084300_added_entity_Notification.xml deleted file mode 100644 index 30d2023..0000000 --- a/src/main/resources/config/liquibase/changelog/20240825084300_added_entity_Notification.xml +++ /dev/null @@ -1,77 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/main/resources/config/liquibase/changelog/20240825084300_added_entity_constraints_Notification.xml b/src/main/resources/config/liquibase/changelog/20240825084300_added_entity_constraints_Notification.xml deleted file mode 100644 index e28b578..0000000 --- a/src/main/resources/config/liquibase/changelog/20240825084300_added_entity_constraints_Notification.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - diff --git a/src/main/resources/config/liquibase/fake-data/notification.csv b/src/main/resources/config/liquibase/fake-data/notification.csv deleted file mode 100644 index 6968054..0000000 --- a/src/main/resources/config/liquibase/fake-data/notification.csv +++ /dev/null @@ -1,11 +0,0 @@ -id;notification_ref_id;content;is_read;created_by;created_date;last_modified_by;last_modified_date -1;11369be3-2766-4089-9fd0-f2ad74906479;../fake-data/blob/hipster.txt;true;qua;2024-08-24T17:41:10;superb whereas fantastic;2024-08-24T14:53:29 -2;23c15533-1641-432c-ac9a-fa7f776e8024;../fake-data/blob/hipster.txt;false;patronise;2024-08-24T17:35:46;yippee;2024-08-25T07:52:57 -3;0f39abf6-3b06-4c27-9364-54875d67acfa;../fake-data/blob/hipster.txt;false;sedately shuttle epic;2024-08-24T15:49:05;popular;2024-08-24T19:17:35 -4;5dc86e65-22be-45f9-ac28-f8144d814f04;../fake-data/blob/hipster.txt;true;critical;2024-08-24T11:35:09;indeed per;2024-08-25T05:45:34 -5;b21a16c3-f885-4925-b0fe-5df1d322aef8;../fake-data/blob/hipster.txt;false;whoever;2024-08-25T00:35:19;hard enormously during;2024-08-25T00:20:46 -6;b3f54889-3828-49c3-ab11-1016b911b754;../fake-data/blob/hipster.txt;false;text who beside;2024-08-24T12:41:39;until meh;2024-08-24T17:57:18 -7;780453dd-3d7f-463f-ab05-f840ad2c8846;../fake-data/blob/hipster.txt;false;offence burglarize quicker;2024-08-25T07:47:02;between;2024-08-24T14:19:15 -8;aba3b916-1393-4170-ad4f-fa0b91826a60;../fake-data/blob/hipster.txt;false;about;2024-08-24T14:08:09;capitalise annually;2024-08-24T15:42:15 -9;d725d05a-614d-4a44-b9af-7bd60bcaef0b;../fake-data/blob/hipster.txt;false;boo aha um;2024-08-24T19:36:12;ouch admired courageously;2024-08-25T05:56:00 -10;3b391336-8682-4c3a-af64-b783616d591c;../fake-data/blob/hipster.txt;true;accomplishment with hm;2024-08-24T10:55:22;lest;2024-08-24T16:12:00 diff --git a/src/main/resources/config/liquibase/master.xml b/src/main/resources/config/liquibase/master.xml index 5519d23..b4e9a60 100644 --- a/src/main/resources/config/liquibase/master.xml +++ b/src/main/resources/config/liquibase/master.xml @@ -23,14 +23,12 @@ - - diff --git a/src/main/webapp/app/entities/notification/index.tsx b/src/main/webapp/app/entities/notification/index.tsx deleted file mode 100644 index b498f63..0000000 --- a/src/main/webapp/app/entities/notification/index.tsx +++ /dev/null @@ -1,23 +0,0 @@ -import React from 'react'; -import { Route } from 'react-router-dom'; - -import ErrorBoundaryRoutes from 'app/shared/error/error-boundary-routes'; - -import Notification from './notification'; -import NotificationDetail from './notification-detail'; -import NotificationUpdate from './notification-update'; -import NotificationDeleteDialog from './notification-delete-dialog'; - -const NotificationRoutes = () => ( - - } /> - } /> - - } /> - } /> - } /> - - -); - -export default NotificationRoutes; diff --git a/src/main/webapp/app/entities/notification/notification-delete-dialog.tsx b/src/main/webapp/app/entities/notification/notification-delete-dialog.tsx deleted file mode 100644 index 348299e..0000000 --- a/src/main/webapp/app/entities/notification/notification-delete-dialog.tsx +++ /dev/null @@ -1,64 +0,0 @@ -import React, { useEffect, useState } from 'react'; -import { useLocation, useNavigate, useParams } from 'react-router-dom'; -import { Modal, ModalHeader, ModalBody, ModalFooter, Button } from 'reactstrap'; - -import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; - -import { useAppDispatch, useAppSelector } from 'app/config/store'; -import { getEntity, deleteEntity } from './notification.reducer'; - -export const NotificationDeleteDialog = () => { - const dispatch = useAppDispatch(); - - const pageLocation = useLocation(); - const navigate = useNavigate(); - const { id } = useParams<'id'>(); - - const [loadModal, setLoadModal] = useState(false); - - useEffect(() => { - dispatch(getEntity(id)); - setLoadModal(true); - }, []); - - const notificationEntity = useAppSelector(state => state.notification.entity); - const updateSuccess = useAppSelector(state => state.notification.updateSuccess); - - const handleClose = () => { - navigate('/notification' + pageLocation.search); - }; - - useEffect(() => { - if (updateSuccess && loadModal) { - handleClose(); - setLoadModal(false); - } - }, [updateSuccess]); - - const confirmDelete = () => { - dispatch(deleteEntity(notificationEntity.id)); - }; - - return ( - - - Confirm delete operation - - - Are you sure you want to delete Notification {notificationEntity.id}? - - - - - - - ); -}; - -export default NotificationDeleteDialog; diff --git a/src/main/webapp/app/entities/notification/notification-detail.tsx b/src/main/webapp/app/entities/notification/notification-detail.tsx deleted file mode 100644 index cb82657..0000000 --- a/src/main/webapp/app/entities/notification/notification-detail.tsx +++ /dev/null @@ -1,84 +0,0 @@ -import React, { useEffect } from 'react'; -import { Link, useParams } from 'react-router-dom'; -import { Button, Row, Col } from 'reactstrap'; -import { byteSize, TextFormat } from 'react-jhipster'; -import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; - -import { APP_DATE_FORMAT, APP_LOCAL_DATE_FORMAT } from 'app/config/constants'; -import { useAppDispatch, useAppSelector } from 'app/config/store'; - -import { getEntity } from './notification.reducer'; - -export const NotificationDetail = () => { - const dispatch = useAppDispatch(); - - const { id } = useParams<'id'>(); - - useEffect(() => { - dispatch(getEntity(id)); - }, []); - - const notificationEntity = useAppSelector(state => state.notification.entity); - return ( - - -

Notification

-
-
- ID -
-
{notificationEntity.id}
-
- Notification Ref Id -
-
{notificationEntity.notificationRefId}
-
- Content -
-
{notificationEntity.content}
-
- Is Read -
-
{notificationEntity.isRead ? 'true' : 'false'}
-
- Created By -
-
{notificationEntity.createdBy}
-
- Created Date -
-
- {notificationEntity.createdDate ? ( - - ) : null} -
-
- Last Modified By -
-
{notificationEntity.lastModifiedBy}
-
- Last Modified Date -
-
- {notificationEntity.lastModifiedDate ? ( - - ) : null} -
-
User Profile
-
{notificationEntity.userProfile ? notificationEntity.userProfile.id : ''}
-
Type
-
{notificationEntity.type ? notificationEntity.type.id : ''}
-
- -   - - -
- ); -}; - -export default NotificationDetail; diff --git a/src/main/webapp/app/entities/notification/notification-reducer.spec.ts b/src/main/webapp/app/entities/notification/notification-reducer.spec.ts deleted file mode 100644 index 2f9bbbf..0000000 --- a/src/main/webapp/app/entities/notification/notification-reducer.spec.ts +++ /dev/null @@ -1,259 +0,0 @@ -import axios from 'axios'; - -import { configureStore } from '@reduxjs/toolkit'; -import sinon from 'sinon'; - -import { EntityState } from 'app/shared/reducers/reducer.utils'; -import { INotification, defaultValue } from 'app/shared/model/notification.model'; -import reducer, { - createEntity, - deleteEntity, - getEntities, - getEntity, - updateEntity, - partialUpdateEntity, - reset, -} from './notification.reducer'; - -describe('Entities reducer tests', () => { - function isEmpty(element): boolean { - if (element instanceof Array) { - return element.length === 0; - } else { - return Object.keys(element).length === 0; - } - } - - const initialState: EntityState = { - loading: false, - errorMessage: null, - entities: [], - entity: defaultValue, - totalItems: 0, - updating: false, - updateSuccess: false, - }; - - function testInitialState(state) { - expect(state).toMatchObject({ - loading: false, - errorMessage: null, - updating: false, - updateSuccess: false, - }); - expect(isEmpty(state.entities)); - expect(isEmpty(state.entity)); - } - - function testMultipleTypes(types, payload, testFunction, error?) { - types.forEach(e => { - testFunction(reducer(undefined, { type: e, payload, error })); - }); - } - - describe('Common', () => { - it('should return the initial state', () => { - testInitialState(reducer(undefined, { type: '' })); - }); - }); - - describe('Requests', () => { - it('should set state to loading', () => { - testMultipleTypes([getEntities.pending.type, getEntity.pending.type], {}, state => { - expect(state).toMatchObject({ - errorMessage: null, - updateSuccess: false, - loading: true, - }); - }); - }); - - it('should set state to updating', () => { - testMultipleTypes( - [createEntity.pending.type, updateEntity.pending.type, partialUpdateEntity.pending.type, deleteEntity.pending.type], - {}, - state => { - expect(state).toMatchObject({ - errorMessage: null, - updateSuccess: false, - updating: true, - }); - }, - ); - }); - - it('should reset the state', () => { - expect(reducer({ ...initialState, loading: true }, reset())).toEqual({ - ...initialState, - }); - }); - }); - - describe('Failures', () => { - it('should set a message in errorMessage', () => { - testMultipleTypes( - [ - getEntities.rejected.type, - getEntity.rejected.type, - createEntity.rejected.type, - updateEntity.rejected.type, - partialUpdateEntity.rejected.type, - deleteEntity.rejected.type, - ], - 'some message', - state => { - expect(state).toMatchObject({ - errorMessage: null, - updateSuccess: false, - updating: false, - }); - }, - { - message: 'error message', - }, - ); - }); - }); - - describe('Successes', () => { - it('should fetch all entities', () => { - const payload = { data: [{ 1: 'fake1' }, { 2: 'fake2' }], headers: { 'x-total-count': 123 } }; - expect( - reducer(undefined, { - type: getEntities.fulfilled.type, - payload, - }), - ).toEqual({ - ...initialState, - loading: false, - totalItems: payload.headers['x-total-count'], - entities: payload.data, - }); - }); - - it('should fetch a single entity', () => { - const payload = { data: { 1: 'fake1' } }; - expect( - reducer(undefined, { - type: getEntity.fulfilled.type, - payload, - }), - ).toEqual({ - ...initialState, - loading: false, - entity: payload.data, - }); - }); - - it('should create/update entity', () => { - const payload = { data: 'fake payload' }; - expect( - reducer(undefined, { - type: createEntity.fulfilled.type, - payload, - }), - ).toEqual({ - ...initialState, - updating: false, - updateSuccess: true, - entity: payload.data, - }); - }); - - it('should delete entity', () => { - const payload = 'fake payload'; - const toTest = reducer(undefined, { - type: deleteEntity.fulfilled.type, - payload, - }); - expect(toTest).toMatchObject({ - updating: false, - updateSuccess: true, - }); - }); - }); - - describe('Actions', () => { - let store; - - const resolvedObject = { value: 'whatever' }; - const getState = jest.fn(); - const dispatch = jest.fn(); - const extra = {}; - beforeEach(() => { - store = configureStore({ - reducer: (state = [], action) => [...state, action], - }); - axios.get = sinon.stub().returns(Promise.resolve(resolvedObject)); - axios.post = sinon.stub().returns(Promise.resolve(resolvedObject)); - axios.put = sinon.stub().returns(Promise.resolve(resolvedObject)); - axios.patch = sinon.stub().returns(Promise.resolve(resolvedObject)); - axios.delete = sinon.stub().returns(Promise.resolve(resolvedObject)); - }); - - it('dispatches FETCH_NOTIFICATION_LIST actions', async () => { - const arg = {}; - - const result = await getEntities(arg)(dispatch, getState, extra); - - const pendingAction = dispatch.mock.calls[0][0]; - expect(pendingAction.meta.requestStatus).toBe('pending'); - expect(getEntities.fulfilled.match(result)).toBe(true); - }); - - it('dispatches FETCH_NOTIFICATION actions', async () => { - const arg = 42666; - - const result = await getEntity(arg)(dispatch, getState, extra); - - const pendingAction = dispatch.mock.calls[0][0]; - expect(pendingAction.meta.requestStatus).toBe('pending'); - expect(getEntity.fulfilled.match(result)).toBe(true); - }); - - it('dispatches CREATE_NOTIFICATION actions', async () => { - const arg = { id: 456 }; - - const result = await createEntity(arg)(dispatch, getState, extra); - - const pendingAction = dispatch.mock.calls[0][0]; - expect(pendingAction.meta.requestStatus).toBe('pending'); - expect(createEntity.fulfilled.match(result)).toBe(true); - }); - - it('dispatches UPDATE_NOTIFICATION actions', async () => { - const arg = { id: 456 }; - - const result = await updateEntity(arg)(dispatch, getState, extra); - - const pendingAction = dispatch.mock.calls[0][0]; - expect(pendingAction.meta.requestStatus).toBe('pending'); - expect(updateEntity.fulfilled.match(result)).toBe(true); - }); - - it('dispatches PARTIAL_UPDATE_NOTIFICATION actions', async () => { - const arg = { id: 123 }; - - const result = await partialUpdateEntity(arg)(dispatch, getState, extra); - - const pendingAction = dispatch.mock.calls[0][0]; - expect(pendingAction.meta.requestStatus).toBe('pending'); - expect(partialUpdateEntity.fulfilled.match(result)).toBe(true); - }); - - it('dispatches DELETE_NOTIFICATION actions', async () => { - const arg = 42666; - - const result = await deleteEntity(arg)(dispatch, getState, extra); - - const pendingAction = dispatch.mock.calls[0][0]; - expect(pendingAction.meta.requestStatus).toBe('pending'); - expect(deleteEntity.fulfilled.match(result)).toBe(true); - }); - - it('dispatches RESET actions', async () => { - await store.dispatch(reset()); - expect(store.getState()).toEqual([expect.any(Object), expect.objectContaining(reset())]); - }); - }); -}); diff --git a/src/main/webapp/app/entities/notification/notification-update.tsx b/src/main/webapp/app/entities/notification/notification-update.tsx deleted file mode 100644 index 15d3b4e..0000000 --- a/src/main/webapp/app/entities/notification/notification-update.tsx +++ /dev/null @@ -1,177 +0,0 @@ -import React, { useState, useEffect } from 'react'; -import { Link, useNavigate, useParams } from 'react-router-dom'; -import { Button, Row, Col, FormText } from 'reactstrap'; -import { isNumber, ValidatedField, ValidatedForm } from 'react-jhipster'; -import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; - -import { convertDateTimeFromServer, convertDateTimeToServer, displayDefaultDateTime } from 'app/shared/util/date-utils'; -import { mapIdList } from 'app/shared/util/entity-utils'; -import { useAppDispatch, useAppSelector } from 'app/config/store'; - -import { IUserProfile } from 'app/shared/model/user-profile.model'; -import { getAllUserProfiles as getUserProfiles } from 'app/entities/user-profile/user-profile.reducer'; -import { ICodeTables } from 'app/shared/model/code-tables.model'; -import { getCodeTables as getCodeTables } from 'app/entities/code-tables/code-tables.reducer'; -import { INotification } from 'app/shared/model/notification.model'; -import { getEntity, updateEntity, createEntity, reset } from './notification.reducer'; - -export const NotificationUpdate = () => { - const dispatch = useAppDispatch(); - - const navigate = useNavigate(); - - const { id } = useParams<'id'>(); - const isNew = id === undefined; - - const userProfiles = useAppSelector(state => state.userProfile.entities); - const codeTables = useAppSelector(state => state.codeTables.entities); - const notificationEntity = useAppSelector(state => state.notification.entity); - const loading = useAppSelector(state => state.notification.loading); - const updating = useAppSelector(state => state.notification.updating); - const updateSuccess = useAppSelector(state => state.notification.updateSuccess); - - const handleClose = () => { - navigate('/notification' + location.search); - }; - - useEffect(() => { - if (isNew) { - dispatch(reset()); - } else { - dispatch(getEntity(id)); - } - - dispatch(getUserProfiles({})); - dispatch(getCodeTables({})); - }, []); - - useEffect(() => { - if (updateSuccess) { - handleClose(); - } - }, [updateSuccess]); - - // eslint-disable-next-line complexity - const saveEntity = values => { - if (values.id !== undefined && typeof values.id !== 'number') { - values.id = Number(values.id); - } - values.createdDate = convertDateTimeToServer(values.createdDate); - values.lastModifiedDate = convertDateTimeToServer(values.lastModifiedDate); - - const entity = { - ...notificationEntity, - ...values, - userProfile: userProfiles.find(it => it.id.toString() === values.userProfile?.toString()), - type: codeTables.find(it => it.id.toString() === values.type?.toString()), - }; - - if (isNew) { - dispatch(createEntity(entity)); - } else { - dispatch(updateEntity(entity)); - } - }; - - const defaultValues = () => - isNew - ? { - createdDate: displayDefaultDateTime(), - lastModifiedDate: displayDefaultDateTime(), - } - : { - ...notificationEntity, - createdDate: convertDateTimeFromServer(notificationEntity.createdDate), - lastModifiedDate: convertDateTimeFromServer(notificationEntity.lastModifiedDate), - userProfile: notificationEntity?.userProfile?.id, - type: notificationEntity?.type?.id, - }; - - return ( -
- - -

- Create or edit a Notification -

- -
- - - {loading ? ( -

Loading...

- ) : ( - - {!isNew ? : null} - - - - - - - - - - )) - : null} - - - - )) - : null} - - -   - - - )} - -
-
- ); -}; - -export default NotificationUpdate; diff --git a/src/main/webapp/app/entities/notification/notification.reducer.ts b/src/main/webapp/app/entities/notification/notification.reducer.ts deleted file mode 100644 index a867c81..0000000 --- a/src/main/webapp/app/entities/notification/notification.reducer.ts +++ /dev/null @@ -1,128 +0,0 @@ -import axios from 'axios'; -import { createAsyncThunk, isFulfilled, isPending } from '@reduxjs/toolkit'; -import { cleanEntity } from 'app/shared/util/entity-utils'; -import { IQueryParams, createEntitySlice, EntityState, serializeAxiosError } from 'app/shared/reducers/reducer.utils'; -import { INotification, defaultValue } from 'app/shared/model/notification.model'; - -const initialState: EntityState = { - loading: false, - errorMessage: null, - entities: [], - entity: defaultValue, - updating: false, - totalItems: 0, - updateSuccess: false, -}; - -const apiUrl = 'api/notifications'; - -// Actions - -export const getEntities = createAsyncThunk( - 'notification/fetch_entity_list', - async ({ page, size, sort }: IQueryParams) => { - const requestUrl = `${apiUrl}?${sort ? `page=${page}&size=${size}&sort=${sort}&` : ''}cacheBuster=${new Date().getTime()}`; - return axios.get(requestUrl); - }, - { serializeError: serializeAxiosError }, -); - -export const getEntity = createAsyncThunk( - 'notification/fetch_entity', - async (id: string | number) => { - const requestUrl = `${apiUrl}/${id}`; - return axios.get(requestUrl); - }, - { serializeError: serializeAxiosError }, -); - -export const createEntity = createAsyncThunk( - 'notification/create_entity', - async (entity: INotification, thunkAPI) => { - const result = await axios.post(apiUrl, cleanEntity(entity)); - thunkAPI.dispatch(getEntities({})); - return result; - }, - { serializeError: serializeAxiosError }, -); - -export const updateEntity = createAsyncThunk( - 'notification/update_entity', - async (entity: INotification, thunkAPI) => { - const result = await axios.put(`${apiUrl}/${entity.id}`, cleanEntity(entity)); - thunkAPI.dispatch(getEntities({})); - return result; - }, - { serializeError: serializeAxiosError }, -); - -export const partialUpdateEntity = createAsyncThunk( - 'notification/partial_update_entity', - async (entity: INotification, thunkAPI) => { - const result = await axios.patch(`${apiUrl}/${entity.id}`, cleanEntity(entity)); - thunkAPI.dispatch(getEntities({})); - return result; - }, - { serializeError: serializeAxiosError }, -); - -export const deleteEntity = createAsyncThunk( - 'notification/delete_entity', - async (id: string | number, thunkAPI) => { - const requestUrl = `${apiUrl}/${id}`; - const result = await axios.delete(requestUrl); - thunkAPI.dispatch(getEntities({})); - return result; - }, - { serializeError: serializeAxiosError }, -); - -// slice - -export const NotificationSlice = createEntitySlice({ - name: 'notification', - initialState, - extraReducers(builder) { - builder - .addCase(getEntity.fulfilled, (state, action) => { - state.loading = false; - state.entity = action.payload.data; - }) - .addCase(deleteEntity.fulfilled, state => { - state.updating = false; - state.updateSuccess = true; - state.entity = {}; - }) - .addMatcher(isFulfilled(getEntities), (state, action) => { - const { data, headers } = action.payload; - - return { - ...state, - loading: false, - entities: data, - totalItems: parseInt(headers['x-total-count'], 10), - }; - }) - .addMatcher(isFulfilled(createEntity, updateEntity, partialUpdateEntity), (state, action) => { - state.updating = false; - state.loading = false; - state.updateSuccess = true; - state.entity = action.payload.data; - }) - .addMatcher(isPending(getEntities, getEntity), state => { - state.errorMessage = null; - state.updateSuccess = false; - state.loading = true; - }) - .addMatcher(isPending(createEntity, updateEntity, partialUpdateEntity, deleteEntity), state => { - state.errorMessage = null; - state.updateSuccess = false; - state.updating = true; - }); - }, -}); - -export const { reset } = NotificationSlice.actions; - -// Reducer -export default NotificationSlice.reducer; diff --git a/src/main/webapp/app/entities/notification/notification.tsx b/src/main/webapp/app/entities/notification/notification.tsx deleted file mode 100644 index 227c1ef..0000000 --- a/src/main/webapp/app/entities/notification/notification.tsx +++ /dev/null @@ -1,230 +0,0 @@ -import React, { useState, useEffect } from 'react'; -import { Link, useLocation, useNavigate } from 'react-router-dom'; -import { Button, Table } from 'reactstrap'; -import { byteSize, Translate, TextFormat, getPaginationState, JhiPagination, JhiItemCount } from 'react-jhipster'; -import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; -import { faSort, faSortUp, faSortDown } from '@fortawesome/free-solid-svg-icons'; -import { APP_DATE_FORMAT, APP_LOCAL_DATE_FORMAT } from 'app/config/constants'; -import { ASC, DESC, ITEMS_PER_PAGE, SORT } from 'app/shared/util/pagination.constants'; -import { overridePaginationStateWithQueryParams } from 'app/shared/util/entity-utils'; -import { useAppDispatch, useAppSelector } from 'app/config/store'; - -import { getEntities } from './notification.reducer'; - -export const Notification = () => { - const dispatch = useAppDispatch(); - - const pageLocation = useLocation(); - const navigate = useNavigate(); - - const [paginationState, setPaginationState] = useState( - overridePaginationStateWithQueryParams(getPaginationState(pageLocation, ITEMS_PER_PAGE, 'id'), pageLocation.search), - ); - - const notificationList = useAppSelector(state => state.notification.entities); - const loading = useAppSelector(state => state.notification.loading); - const totalItems = useAppSelector(state => state.notification.totalItems); - - const getAllEntities = () => { - dispatch( - getEntities({ - page: paginationState.activePage - 1, - size: paginationState.itemsPerPage, - sort: `${paginationState.sort},${paginationState.order}`, - }), - ); - }; - - const sortEntities = () => { - getAllEntities(); - const endURL = `?page=${paginationState.activePage}&sort=${paginationState.sort},${paginationState.order}`; - if (pageLocation.search !== endURL) { - navigate(`${pageLocation.pathname}${endURL}`); - } - }; - - useEffect(() => { - sortEntities(); - }, [paginationState.activePage, paginationState.order, paginationState.sort]); - - useEffect(() => { - const params = new URLSearchParams(pageLocation.search); - const page = params.get('page'); - const sort = params.get(SORT); - if (page && sort) { - const sortSplit = sort.split(','); - setPaginationState({ - ...paginationState, - activePage: +page, - sort: sortSplit[0], - order: sortSplit[1], - }); - } - }, [pageLocation.search]); - - const sort = p => () => { - setPaginationState({ - ...paginationState, - order: paginationState.order === ASC ? DESC : ASC, - sort: p, - }); - }; - - const handlePagination = currentPage => - setPaginationState({ - ...paginationState, - activePage: currentPage, - }); - - const handleSyncList = () => { - sortEntities(); - }; - - const getSortIconByFieldName = (fieldName: string) => { - const sortFieldName = paginationState.sort; - const order = paginationState.order; - if (sortFieldName !== fieldName) { - return faSort; - } else { - return order === ASC ? faSortUp : faSortDown; - } - }; - - return ( -
-

- Notifications -
- - - -   Create a new Notification - -
-

-
- {notificationList && notificationList.length > 0 ? ( - - - - - - - - - - - - - - - - - {notificationList.map((notification, i) => ( - - - - - - - - - - - - - - ))} - -
- ID - - Notification Ref Id - - Content - - Is Read - - Created By - - Created Date - - Last Modified By - - Last Modified Date - - User Profile - - Type - -
- - {notification.notificationRefId}{notification.content}{notification.isRead ? 'true' : 'false'}{notification.createdBy} - {notification.createdDate ? : null} - {notification.lastModifiedBy} - {notification.lastModifiedDate ? ( - - ) : null} - - {notification.userProfile ? ( - {notification.userProfile.id} - ) : ( - '' - )} - {notification.type ? {notification.type.id} : ''} -
- - - -
-
- ) : ( - !loading &&
No Notifications found
- )} -
- {totalItems ? ( -
0 ? '' : 'd-none'}> -
- -
-
- -
-
- ) : ( - '' - )} -
- ); -}; - -export default Notification; diff --git a/src/main/webapp/app/entities/reducers.ts b/src/main/webapp/app/entities/reducers.ts index c1fd2f6..94fe0f8 100644 --- a/src/main/webapp/app/entities/reducers.ts +++ b/src/main/webapp/app/entities/reducers.ts @@ -4,7 +4,6 @@ import skill from 'app/entities/skill/skill.reducer'; import message from 'app/entities/message/message.reducer'; import activity from 'app/entities/activity/activity.reducer'; import activityInvite from 'app/entities/activity-invite/activity-invite.reducer'; -import notification from 'app/entities/notification/notification.reducer'; import userSkill from 'app/entities/user-skill/user-skill.reducer'; /* jhipster-needle-add-reducer-import - JHipster will add reducer here */ @@ -15,7 +14,6 @@ const entitiesReducers = { message, activity, activityInvite, - notification, userSkill, /* jhipster-needle-add-reducer-combine - JHipster will add reducer here */ }; diff --git a/src/main/webapp/app/entities/routes.tsx b/src/main/webapp/app/entities/routes.tsx index dc32592..2cca4ee 100644 --- a/src/main/webapp/app/entities/routes.tsx +++ b/src/main/webapp/app/entities/routes.tsx @@ -9,7 +9,6 @@ import Skill from './skill'; import Message from './message'; import Activity from './activity'; import ActivityInvite from './activity-invite'; -import Notification from './notification'; import UserSkill from './user-skill'; import SearchAppActivity from 'app/entities/search/searchAppActivity'; /* jhipster-needle-add-route-import - JHipster will add routes here */ @@ -25,7 +24,7 @@ export default () => { } /> } /> } /> - } /> + } /> } /> {/* jhipster-needle-add-route-path - JHipster will add routes here */} diff --git a/src/test/java/com/teamsixnus/scaleup/domain/NotificationAsserts.java b/src/test/java/com/teamsixnus/scaleup/domain/NotificationAsserts.java deleted file mode 100644 index 22e224a..0000000 --- a/src/test/java/com/teamsixnus/scaleup/domain/NotificationAsserts.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.teamsixnus.scaleup.domain; - -import static org.assertj.core.api.Assertions.assertThat; - -public class NotificationAsserts { - - /** - * Asserts that the entity has all properties (fields/relationships) set. - * - * @param expected the expected entity - * @param actual the actual entity - */ - public static void assertNotificationAllPropertiesEquals(Notification expected, Notification actual) { - assertNotificationAutoGeneratedPropertiesEquals(expected, actual); - assertNotificationAllUpdatablePropertiesEquals(expected, actual); - } - - /** - * Asserts that the entity has all updatable properties (fields/relationships) set. - * - * @param expected the expected entity - * @param actual the actual entity - */ - public static void assertNotificationAllUpdatablePropertiesEquals(Notification expected, Notification actual) { - assertNotificationUpdatableFieldsEquals(expected, actual); - assertNotificationUpdatableRelationshipsEquals(expected, actual); - } - - /** - * Asserts that the entity has all the auto generated properties (fields/relationships) set. - * - * @param expected the expected entity - * @param actual the actual entity - */ - public static void assertNotificationAutoGeneratedPropertiesEquals(Notification expected, Notification actual) { - assertThat(expected) - .as("Verify Notification auto generated properties") - .satisfies(e -> assertThat(e.getId()).as("check id").isEqualTo(actual.getId())) - .satisfies(e -> assertThat(e.getCreatedBy()).as("check createdBy").isEqualTo(actual.getCreatedBy())) - .satisfies(e -> assertThat(e.getCreatedDate()).as("check createdDate").isEqualTo(actual.getCreatedDate())); - } - - /** - * Asserts that the entity has all the updatable fields set. - * - * @param expected the expected entity - * @param actual the actual entity - */ - public static void assertNotificationUpdatableFieldsEquals(Notification expected, Notification actual) { - assertThat(expected) - .as("Verify Notification relevant properties") - .satisfies(e -> assertThat(e.getNotificationRefId()).as("check notificationRefId").isEqualTo(actual.getNotificationRefId())) - .satisfies(e -> assertThat(e.getContent()).as("check content").isEqualTo(actual.getContent())) - .satisfies(e -> assertThat(e.getIsRead()).as("check isRead").isEqualTo(actual.getIsRead())); - } - - /** - * Asserts that the entity has all the updatable relationships set. - * - * @param expected the expected entity - * @param actual the actual entity - */ - public static void assertNotificationUpdatableRelationshipsEquals(Notification expected, Notification actual) { - assertThat(expected) - .as("Verify Notification relationships") - .satisfies(e -> assertThat(e.getUserProfile()).as("check userProfile").isEqualTo(actual.getUserProfile())) - .satisfies(e -> assertThat(e.getType()).as("check type").isEqualTo(actual.getType())); - } -} diff --git a/src/test/java/com/teamsixnus/scaleup/domain/NotificationTest.java b/src/test/java/com/teamsixnus/scaleup/domain/NotificationTest.java deleted file mode 100644 index 554a23f..0000000 --- a/src/test/java/com/teamsixnus/scaleup/domain/NotificationTest.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.teamsixnus.scaleup.domain; - -import static com.teamsixnus.scaleup.domain.CodeTablesTestSamples.*; -import static com.teamsixnus.scaleup.domain.NotificationTestSamples.*; -import static com.teamsixnus.scaleup.domain.UserProfileTestSamples.*; -import static org.assertj.core.api.Assertions.assertThat; - -import com.teamsixnus.scaleup.web.rest.TestUtil; -import org.junit.jupiter.api.Test; - -class NotificationTest { - - @Test - void equalsVerifier() throws Exception { - TestUtil.equalsVerifier(Notification.class); - Notification notification1 = getNotificationSample1(); - Notification notification2 = new Notification(); - assertThat(notification1).isNotEqualTo(notification2); - - notification2.setId(notification1.getId()); - assertThat(notification1).isEqualTo(notification2); - - notification2 = getNotificationSample2(); - assertThat(notification1).isNotEqualTo(notification2); - } - - @Test - void userProfileTest() { - Notification notification = getNotificationRandomSampleGenerator(); - UserProfile userProfileBack = getUserProfileRandomSampleGenerator(); - - notification.setUserProfile(userProfileBack); - assertThat(notification.getUserProfile()).isEqualTo(userProfileBack); - - notification.userProfile(null); - assertThat(notification.getUserProfile()).isNull(); - } - - @Test - void typeTest() { - Notification notification = getNotificationRandomSampleGenerator(); - CodeTables codeTablesBack = getCodeTablesRandomSampleGenerator(); - - notification.setType(codeTablesBack); - assertThat(notification.getType()).isEqualTo(codeTablesBack); - - notification.type(null); - assertThat(notification.getType()).isNull(); - } -} diff --git a/src/test/java/com/teamsixnus/scaleup/domain/NotificationTestSamples.java b/src/test/java/com/teamsixnus/scaleup/domain/NotificationTestSamples.java deleted file mode 100644 index a029dc6..0000000 --- a/src/test/java/com/teamsixnus/scaleup/domain/NotificationTestSamples.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.teamsixnus.scaleup.domain; - -import java.util.Random; -import java.util.UUID; -import java.util.concurrent.atomic.AtomicLong; - -public class NotificationTestSamples { - - private static final Random random = new Random(); - private static final AtomicLong longCount = new AtomicLong(random.nextInt() + (2 * Integer.MAX_VALUE)); - - public static Notification getNotificationSample1() { - return new Notification() - .id(1L) - .notificationRefId(UUID.fromString("23d8dc04-a48b-45d9-a01d-4b728f0ad4aa")) - .createdBy("createdBy1") - .lastModifiedBy("lastModifiedBy1"); - } - - public static Notification getNotificationSample2() { - return new Notification() - .id(2L) - .notificationRefId(UUID.fromString("ad79f240-3727-46c3-b89f-2cf6ebd74367")) - .createdBy("createdBy2") - .lastModifiedBy("lastModifiedBy2"); - } - - public static Notification getNotificationRandomSampleGenerator() { - return new Notification() - .id(longCount.incrementAndGet()) - .notificationRefId(UUID.randomUUID()) - .createdBy(UUID.randomUUID().toString()) - .lastModifiedBy(UUID.randomUUID().toString()); - } -} diff --git a/src/test/java/com/teamsixnus/scaleup/service/dto/NotificationDTOTest.java b/src/test/java/com/teamsixnus/scaleup/service/dto/NotificationDTOTest.java deleted file mode 100644 index 428fb4b..0000000 --- a/src/test/java/com/teamsixnus/scaleup/service/dto/NotificationDTOTest.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.teamsixnus.scaleup.service.dto; - -import static org.assertj.core.api.Assertions.assertThat; - -import com.teamsixnus.scaleup.web.rest.TestUtil; -import org.junit.jupiter.api.Test; - -class NotificationDTOTest { - - @Test - void dtoEqualsVerifier() throws Exception { - TestUtil.equalsVerifier(NotificationDTO.class); - NotificationDTO notificationDTO1 = new NotificationDTO(); - notificationDTO1.setId(1L); - NotificationDTO notificationDTO2 = new NotificationDTO(); - assertThat(notificationDTO1).isNotEqualTo(notificationDTO2); - notificationDTO2.setId(notificationDTO1.getId()); - assertThat(notificationDTO1).isEqualTo(notificationDTO2); - notificationDTO2.setId(2L); - assertThat(notificationDTO1).isNotEqualTo(notificationDTO2); - notificationDTO1.setId(null); - assertThat(notificationDTO1).isNotEqualTo(notificationDTO2); - } -} diff --git a/src/test/java/com/teamsixnus/scaleup/service/mapper/NotificationMapperTest.java b/src/test/java/com/teamsixnus/scaleup/service/mapper/NotificationMapperTest.java deleted file mode 100644 index 1b8e29f..0000000 --- a/src/test/java/com/teamsixnus/scaleup/service/mapper/NotificationMapperTest.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.teamsixnus.scaleup.service.mapper; - -import static com.teamsixnus.scaleup.domain.NotificationAsserts.*; -import static com.teamsixnus.scaleup.domain.NotificationTestSamples.*; - -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; - -class NotificationMapperTest { - - private NotificationMapper notificationMapper; - - @BeforeEach - void setUp() { - notificationMapper = new NotificationMapperImpl(); - } - - @Test - void shouldConvertToDtoAndBack() { - var expected = getNotificationSample1(); - var actual = notificationMapper.toEntity(notificationMapper.toDto(expected)); - assertNotificationAllPropertiesEquals(expected, actual); - } -} diff --git a/src/test/java/com/teamsixnus/scaleup/web/rest/NotificationResourceIT.java b/src/test/java/com/teamsixnus/scaleup/web/rest/NotificationResourceIT.java deleted file mode 100644 index 9365891..0000000 --- a/src/test/java/com/teamsixnus/scaleup/web/rest/NotificationResourceIT.java +++ /dev/null @@ -1,623 +0,0 @@ -package com.teamsixnus.scaleup.web.rest; - -import static com.teamsixnus.scaleup.domain.NotificationAsserts.*; -import static com.teamsixnus.scaleup.web.rest.TestUtil.createUpdateProxyForBean; -import static org.assertj.core.api.Assertions.assertThat; -import static org.hamcrest.Matchers.hasItem; -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; - -import com.fasterxml.jackson.databind.ObjectMapper; -import com.teamsixnus.scaleup.IntegrationTest; -import com.teamsixnus.scaleup.domain.CodeTables; -import com.teamsixnus.scaleup.domain.Notification; -import com.teamsixnus.scaleup.domain.UserProfile; -import com.teamsixnus.scaleup.repository.NotificationRepository; -import com.teamsixnus.scaleup.service.dto.NotificationDTO; -import com.teamsixnus.scaleup.service.mapper.NotificationMapper; -import jakarta.persistence.EntityManager; -import java.util.Random; -import java.util.UUID; -import java.util.concurrent.atomic.AtomicLong; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; -import org.springframework.http.MediaType; -import org.springframework.security.test.context.support.WithMockUser; -import org.springframework.test.web.servlet.MockMvc; -import org.springframework.transaction.annotation.Transactional; - -/** - * Integration tests for the {@link NotificationResource} REST controller. - */ -@IntegrationTest -@AutoConfigureMockMvc -@WithMockUser -class NotificationResourceIT { - - private static final UUID DEFAULT_NOTIFICATION_REF_ID = UUID.randomUUID(); - private static final UUID UPDATED_NOTIFICATION_REF_ID = UUID.randomUUID(); - - private static final String DEFAULT_CONTENT = "AAAAAAAAAA"; - private static final String UPDATED_CONTENT = "BBBBBBBBBB"; - - private static final Boolean DEFAULT_IS_READ = false; - private static final Boolean UPDATED_IS_READ = true; - - private static final String ENTITY_API_URL = "/api/notifications"; - private static final String ENTITY_API_URL_ID = ENTITY_API_URL + "/{id}"; - - private static Random random = new Random(); - private static AtomicLong longCount = new AtomicLong(random.nextInt() + (2 * Integer.MAX_VALUE)); - - @Autowired - private ObjectMapper om; - - @Autowired - private NotificationRepository notificationRepository; - - @Autowired - private NotificationMapper notificationMapper; - - @Autowired - private EntityManager em; - - @Autowired - private MockMvc restNotificationMockMvc; - - private Notification notification; - - private Notification insertedNotification; - - /** - * Create an entity for this test. - * - * This is a static method, as tests for other entities might also need it, - * if they test an entity which requires the current entity. - */ - public static Notification createEntity(EntityManager em) { - Notification notification = new Notification() - .notificationRefId(DEFAULT_NOTIFICATION_REF_ID) - .content(DEFAULT_CONTENT) - .isRead(DEFAULT_IS_READ); - return notification; - } - - /** - * Create an updated entity for this test. - * - * This is a static method, as tests for other entities might also need it, - * if they test an entity which requires the current entity. - */ - public static Notification createUpdatedEntity(EntityManager em) { - Notification notification = new Notification() - .notificationRefId(UPDATED_NOTIFICATION_REF_ID) - .content(UPDATED_CONTENT) - .isRead(UPDATED_IS_READ); - return notification; - } - - @BeforeEach - public void initTest() { - notification = createEntity(em); - } - - @AfterEach - public void cleanup() { - if (insertedNotification != null) { - notificationRepository.delete(insertedNotification); - insertedNotification = null; - } - } - - @Test - @Transactional - void createNotification() throws Exception { - long databaseSizeBeforeCreate = getRepositoryCount(); - // Create the Notification - NotificationDTO notificationDTO = notificationMapper.toDto(notification); - var returnedNotificationDTO = om.readValue( - restNotificationMockMvc - .perform(post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(om.writeValueAsBytes(notificationDTO))) - .andExpect(status().isCreated()) - .andReturn() - .getResponse() - .getContentAsString(), - NotificationDTO.class - ); - - // Validate the Notification in the database - assertIncrementedRepositoryCount(databaseSizeBeforeCreate); - var returnedNotification = notificationMapper.toEntity(returnedNotificationDTO); - assertNotificationUpdatableFieldsEquals(returnedNotification, getPersistedNotification(returnedNotification)); - - insertedNotification = returnedNotification; - } - - @Test - @Transactional - void createNotificationWithExistingId() throws Exception { - // Create the Notification with an existing ID - notification.setId(1L); - NotificationDTO notificationDTO = notificationMapper.toDto(notification); - - long databaseSizeBeforeCreate = getRepositoryCount(); - - // An entity with an existing ID cannot be created, so this API call must fail - restNotificationMockMvc - .perform(post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(om.writeValueAsBytes(notificationDTO))) - .andExpect(status().isBadRequest()); - - // Validate the Notification in the database - assertSameRepositoryCount(databaseSizeBeforeCreate); - } - - @Test - @Transactional - void getAllNotifications() throws Exception { - // Initialize the database - insertedNotification = notificationRepository.saveAndFlush(notification); - - // Get all the notificationList - restNotificationMockMvc - .perform(get(ENTITY_API_URL + "?sort=id,desc")) - .andExpect(status().isOk()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) - .andExpect(jsonPath("$.[*].id").value(hasItem(notification.getId().intValue()))) - .andExpect(jsonPath("$.[*].notificationRefId").value(hasItem(DEFAULT_NOTIFICATION_REF_ID.toString()))) - .andExpect(jsonPath("$.[*].content").value(hasItem(DEFAULT_CONTENT.toString()))) - .andExpect(jsonPath("$.[*].isRead").value(hasItem(DEFAULT_IS_READ.booleanValue()))); - } - - @Test - @Transactional - void getNotification() throws Exception { - // Initialize the database - insertedNotification = notificationRepository.saveAndFlush(notification); - - // Get the notification - restNotificationMockMvc - .perform(get(ENTITY_API_URL_ID, notification.getId())) - .andExpect(status().isOk()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) - .andExpect(jsonPath("$.id").value(notification.getId().intValue())) - .andExpect(jsonPath("$.notificationRefId").value(DEFAULT_NOTIFICATION_REF_ID.toString())) - .andExpect(jsonPath("$.content").value(DEFAULT_CONTENT.toString())) - .andExpect(jsonPath("$.isRead").value(DEFAULT_IS_READ.booleanValue())); - } - - @Test - @Transactional - void getNotificationsByIdFiltering() throws Exception { - // Initialize the database - insertedNotification = notificationRepository.saveAndFlush(notification); - - Long id = notification.getId(); - - defaultNotificationFiltering("id.equals=" + id, "id.notEquals=" + id); - - defaultNotificationFiltering("id.greaterThanOrEqual=" + id, "id.greaterThan=" + id); - - defaultNotificationFiltering("id.lessThanOrEqual=" + id, "id.lessThan=" + id); - } - - @Test - @Transactional - void getAllNotificationsByNotificationRefIdIsEqualToSomething() throws Exception { - // Initialize the database - insertedNotification = notificationRepository.saveAndFlush(notification); - - // Get all the notificationList where notificationRefId equals to - defaultNotificationFiltering( - "notificationRefId.equals=" + DEFAULT_NOTIFICATION_REF_ID, - "notificationRefId.equals=" + UPDATED_NOTIFICATION_REF_ID - ); - } - - @Test - @Transactional - void getAllNotificationsByNotificationRefIdIsInShouldWork() throws Exception { - // Initialize the database - insertedNotification = notificationRepository.saveAndFlush(notification); - - // Get all the notificationList where notificationRefId in - defaultNotificationFiltering( - "notificationRefId.in=" + DEFAULT_NOTIFICATION_REF_ID + "," + UPDATED_NOTIFICATION_REF_ID, - "notificationRefId.in=" + UPDATED_NOTIFICATION_REF_ID - ); - } - - @Test - @Transactional - void getAllNotificationsByNotificationRefIdIsNullOrNotNull() throws Exception { - // Initialize the database - insertedNotification = notificationRepository.saveAndFlush(notification); - - // Get all the notificationList where notificationRefId is not null - defaultNotificationFiltering("notificationRefId.specified=true", "notificationRefId.specified=false"); - } - - @Test - @Transactional - void getAllNotificationsByIsReadIsEqualToSomething() throws Exception { - // Initialize the database - insertedNotification = notificationRepository.saveAndFlush(notification); - - // Get all the notificationList where isRead equals to - defaultNotificationFiltering("isRead.equals=" + DEFAULT_IS_READ, "isRead.equals=" + UPDATED_IS_READ); - } - - @Test - @Transactional - void getAllNotificationsByIsReadIsInShouldWork() throws Exception { - // Initialize the database - insertedNotification = notificationRepository.saveAndFlush(notification); - - // Get all the notificationList where isRead in - defaultNotificationFiltering("isRead.in=" + DEFAULT_IS_READ + "," + UPDATED_IS_READ, "isRead.in=" + UPDATED_IS_READ); - } - - @Test - @Transactional - void getAllNotificationsByIsReadIsNullOrNotNull() throws Exception { - // Initialize the database - insertedNotification = notificationRepository.saveAndFlush(notification); - - // Get all the notificationList where isRead is not null - defaultNotificationFiltering("isRead.specified=true", "isRead.specified=false"); - } - - @Test - @Transactional - void getAllNotificationsByUserProfileIsEqualToSomething() throws Exception { - UserProfile userProfile; - if (TestUtil.findAll(em, UserProfile.class).isEmpty()) { - notificationRepository.saveAndFlush(notification); - userProfile = UserProfileResourceIT.createEntity(em); - } else { - userProfile = TestUtil.findAll(em, UserProfile.class).get(0); - } - em.persist(userProfile); - em.flush(); - notification.setUserProfile(userProfile); - notificationRepository.saveAndFlush(notification); - Long userProfileId = userProfile.getId(); - // Get all the notificationList where userProfile equals to userProfileId - defaultNotificationShouldBeFound("userProfileId.equals=" + userProfileId); - - // Get all the notificationList where userProfile equals to (userProfileId + 1) - defaultNotificationShouldNotBeFound("userProfileId.equals=" + (userProfileId + 1)); - } - - @Test - @Transactional - void getAllNotificationsByTypeIsEqualToSomething() throws Exception { - CodeTables type; - if (TestUtil.findAll(em, CodeTables.class).isEmpty()) { - notificationRepository.saveAndFlush(notification); - type = CodeTablesResourceIT.createEntity(em); - } else { - type = TestUtil.findAll(em, CodeTables.class).get(0); - } - em.persist(type); - em.flush(); - notification.setType(type); - notificationRepository.saveAndFlush(notification); - Long typeId = type.getId(); - // Get all the notificationList where type equals to typeId - defaultNotificationShouldBeFound("typeId.equals=" + typeId); - - // Get all the notificationList where type equals to (typeId + 1) - defaultNotificationShouldNotBeFound("typeId.equals=" + (typeId + 1)); - } - - private void defaultNotificationFiltering(String shouldBeFound, String shouldNotBeFound) throws Exception { - defaultNotificationShouldBeFound(shouldBeFound); - defaultNotificationShouldNotBeFound(shouldNotBeFound); - } - - /** - * Executes the search, and checks that the default entity is returned. - */ - private void defaultNotificationShouldBeFound(String filter) throws Exception { - restNotificationMockMvc - .perform(get(ENTITY_API_URL + "?sort=id,desc&" + filter)) - .andExpect(status().isOk()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) - .andExpect(jsonPath("$.[*].id").value(hasItem(notification.getId().intValue()))) - .andExpect(jsonPath("$.[*].notificationRefId").value(hasItem(DEFAULT_NOTIFICATION_REF_ID.toString()))) - .andExpect(jsonPath("$.[*].content").value(hasItem(DEFAULT_CONTENT.toString()))) - .andExpect(jsonPath("$.[*].isRead").value(hasItem(DEFAULT_IS_READ.booleanValue()))); - - // Check, that the count call also returns 1 - restNotificationMockMvc - .perform(get(ENTITY_API_URL + "/count?sort=id,desc&" + filter)) - .andExpect(status().isOk()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) - .andExpect(content().string("1")); - } - - /** - * Executes the search, and checks that the default entity is not returned. - */ - private void defaultNotificationShouldNotBeFound(String filter) throws Exception { - restNotificationMockMvc - .perform(get(ENTITY_API_URL + "?sort=id,desc&" + filter)) - .andExpect(status().isOk()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) - .andExpect(jsonPath("$").isArray()) - .andExpect(jsonPath("$").isEmpty()); - - // Check, that the count call also returns 0 - restNotificationMockMvc - .perform(get(ENTITY_API_URL + "/count?sort=id,desc&" + filter)) - .andExpect(status().isOk()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) - .andExpect(content().string("0")); - } - - @Test - @Transactional - void getNonExistingNotification() throws Exception { - // Get the notification - restNotificationMockMvc.perform(get(ENTITY_API_URL_ID, Long.MAX_VALUE)).andExpect(status().isNotFound()); - } - - @Test - @Transactional - void putExistingNotification() throws Exception { - // Initialize the database - insertedNotification = notificationRepository.saveAndFlush(notification); - - long databaseSizeBeforeUpdate = getRepositoryCount(); - - // Update the notification - Notification updatedNotification = notificationRepository.findById(notification.getId()).orElseThrow(); - // Disconnect from session so that the updates on updatedNotification are not directly saved in db - em.detach(updatedNotification); - updatedNotification.notificationRefId(UPDATED_NOTIFICATION_REF_ID).content(UPDATED_CONTENT).isRead(UPDATED_IS_READ); - NotificationDTO notificationDTO = notificationMapper.toDto(updatedNotification); - - restNotificationMockMvc - .perform( - put(ENTITY_API_URL_ID, notificationDTO.getId()) - .contentType(MediaType.APPLICATION_JSON) - .content(om.writeValueAsBytes(notificationDTO)) - ) - .andExpect(status().isOk()); - - // Validate the Notification in the database - assertSameRepositoryCount(databaseSizeBeforeUpdate); - assertPersistedNotificationToMatchAllProperties(updatedNotification); - } - - @Test - @Transactional - void putNonExistingNotification() throws Exception { - long databaseSizeBeforeUpdate = getRepositoryCount(); - notification.setId(longCount.incrementAndGet()); - - // Create the Notification - NotificationDTO notificationDTO = notificationMapper.toDto(notification); - - // If the entity doesn't have an ID, it will throw BadRequestAlertException - restNotificationMockMvc - .perform( - put(ENTITY_API_URL_ID, notificationDTO.getId()) - .contentType(MediaType.APPLICATION_JSON) - .content(om.writeValueAsBytes(notificationDTO)) - ) - .andExpect(status().isBadRequest()); - - // Validate the Notification in the database - assertSameRepositoryCount(databaseSizeBeforeUpdate); - } - - @Test - @Transactional - void putWithIdMismatchNotification() throws Exception { - long databaseSizeBeforeUpdate = getRepositoryCount(); - notification.setId(longCount.incrementAndGet()); - - // Create the Notification - NotificationDTO notificationDTO = notificationMapper.toDto(notification); - - // If url ID doesn't match entity ID, it will throw BadRequestAlertException - restNotificationMockMvc - .perform( - put(ENTITY_API_URL_ID, longCount.incrementAndGet()) - .contentType(MediaType.APPLICATION_JSON) - .content(om.writeValueAsBytes(notificationDTO)) - ) - .andExpect(status().isBadRequest()); - - // Validate the Notification in the database - assertSameRepositoryCount(databaseSizeBeforeUpdate); - } - - @Test - @Transactional - void putWithMissingIdPathParamNotification() throws Exception { - long databaseSizeBeforeUpdate = getRepositoryCount(); - notification.setId(longCount.incrementAndGet()); - - // Create the Notification - NotificationDTO notificationDTO = notificationMapper.toDto(notification); - - // If url ID doesn't match entity ID, it will throw BadRequestAlertException - restNotificationMockMvc - .perform(put(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(om.writeValueAsBytes(notificationDTO))) - .andExpect(status().isMethodNotAllowed()); - - // Validate the Notification in the database - assertSameRepositoryCount(databaseSizeBeforeUpdate); - } - - @Test - @Transactional - void partialUpdateNotificationWithPatch() throws Exception { - // Initialize the database - insertedNotification = notificationRepository.saveAndFlush(notification); - - long databaseSizeBeforeUpdate = getRepositoryCount(); - - // Update the notification using partial update - Notification partialUpdatedNotification = new Notification(); - partialUpdatedNotification.setId(notification.getId()); - - partialUpdatedNotification.notificationRefId(UPDATED_NOTIFICATION_REF_ID); - - restNotificationMockMvc - .perform( - patch(ENTITY_API_URL_ID, partialUpdatedNotification.getId()) - .contentType("application/merge-patch+json") - .content(om.writeValueAsBytes(partialUpdatedNotification)) - ) - .andExpect(status().isOk()); - - // Validate the Notification in the database - - assertSameRepositoryCount(databaseSizeBeforeUpdate); - assertNotificationUpdatableFieldsEquals( - createUpdateProxyForBean(partialUpdatedNotification, notification), - getPersistedNotification(notification) - ); - } - - @Test - @Transactional - void fullUpdateNotificationWithPatch() throws Exception { - // Initialize the database - insertedNotification = notificationRepository.saveAndFlush(notification); - - long databaseSizeBeforeUpdate = getRepositoryCount(); - - // Update the notification using partial update - Notification partialUpdatedNotification = new Notification(); - partialUpdatedNotification.setId(notification.getId()); - - partialUpdatedNotification.notificationRefId(UPDATED_NOTIFICATION_REF_ID).content(UPDATED_CONTENT).isRead(UPDATED_IS_READ); - - restNotificationMockMvc - .perform( - patch(ENTITY_API_URL_ID, partialUpdatedNotification.getId()) - .contentType("application/merge-patch+json") - .content(om.writeValueAsBytes(partialUpdatedNotification)) - ) - .andExpect(status().isOk()); - - // Validate the Notification in the database - - assertSameRepositoryCount(databaseSizeBeforeUpdate); - assertNotificationUpdatableFieldsEquals(partialUpdatedNotification, getPersistedNotification(partialUpdatedNotification)); - } - - @Test - @Transactional - void patchNonExistingNotification() throws Exception { - long databaseSizeBeforeUpdate = getRepositoryCount(); - notification.setId(longCount.incrementAndGet()); - - // Create the Notification - NotificationDTO notificationDTO = notificationMapper.toDto(notification); - - // If the entity doesn't have an ID, it will throw BadRequestAlertException - restNotificationMockMvc - .perform( - patch(ENTITY_API_URL_ID, notificationDTO.getId()) - .contentType("application/merge-patch+json") - .content(om.writeValueAsBytes(notificationDTO)) - ) - .andExpect(status().isBadRequest()); - - // Validate the Notification in the database - assertSameRepositoryCount(databaseSizeBeforeUpdate); - } - - @Test - @Transactional - void patchWithIdMismatchNotification() throws Exception { - long databaseSizeBeforeUpdate = getRepositoryCount(); - notification.setId(longCount.incrementAndGet()); - - // Create the Notification - NotificationDTO notificationDTO = notificationMapper.toDto(notification); - - // If url ID doesn't match entity ID, it will throw BadRequestAlertException - restNotificationMockMvc - .perform( - patch(ENTITY_API_URL_ID, longCount.incrementAndGet()) - .contentType("application/merge-patch+json") - .content(om.writeValueAsBytes(notificationDTO)) - ) - .andExpect(status().isBadRequest()); - - // Validate the Notification in the database - assertSameRepositoryCount(databaseSizeBeforeUpdate); - } - - @Test - @Transactional - void patchWithMissingIdPathParamNotification() throws Exception { - long databaseSizeBeforeUpdate = getRepositoryCount(); - notification.setId(longCount.incrementAndGet()); - - // Create the Notification - NotificationDTO notificationDTO = notificationMapper.toDto(notification); - - // If url ID doesn't match entity ID, it will throw BadRequestAlertException - restNotificationMockMvc - .perform(patch(ENTITY_API_URL).contentType("application/merge-patch+json").content(om.writeValueAsBytes(notificationDTO))) - .andExpect(status().isMethodNotAllowed()); - - // Validate the Notification in the database - assertSameRepositoryCount(databaseSizeBeforeUpdate); - } - - @Test - @Transactional - void deleteNotification() throws Exception { - // Initialize the database - insertedNotification = notificationRepository.saveAndFlush(notification); - - long databaseSizeBeforeDelete = getRepositoryCount(); - - // Delete the notification - restNotificationMockMvc - .perform(delete(ENTITY_API_URL_ID, notification.getId()).accept(MediaType.APPLICATION_JSON)) - .andExpect(status().isNoContent()); - - // Validate the database contains one less item - assertDecrementedRepositoryCount(databaseSizeBeforeDelete); - } - - protected long getRepositoryCount() { - return notificationRepository.count(); - } - - protected void assertIncrementedRepositoryCount(long countBefore) { - assertThat(countBefore + 1).isEqualTo(getRepositoryCount()); - } - - protected void assertDecrementedRepositoryCount(long countBefore) { - assertThat(countBefore - 1).isEqualTo(getRepositoryCount()); - } - - protected void assertSameRepositoryCount(long countBefore) { - assertThat(countBefore).isEqualTo(getRepositoryCount()); - } - - protected Notification getPersistedNotification(Notification notification) { - return notificationRepository.findById(notification.getId()).orElseThrow(); - } - - protected void assertPersistedNotificationToMatchAllProperties(Notification expectedNotification) { - assertNotificationAllPropertiesEquals(expectedNotification, getPersistedNotification(expectedNotification)); - } - - protected void assertPersistedNotificationToMatchUpdatableProperties(Notification expectedNotification) { - assertNotificationAllUpdatablePropertiesEquals(expectedNotification, getPersistedNotification(expectedNotification)); - } -} diff --git a/src/test/java/com/teamsixnus/scaleup/web/rest/UserResourceIT.java b/src/test/java/com/teamsixnus/scaleup/web/rest/UserResourceIT.java index 5f314e5..846af3f 100644 --- a/src/test/java/com/teamsixnus/scaleup/web/rest/UserResourceIT.java +++ b/src/test/java/com/teamsixnus/scaleup/web/rest/UserResourceIT.java @@ -103,9 +103,6 @@ public static User createEntity(EntityManager em) { persistUser.setPassword(RandomStringUtils.randomAlphanumeric(60)); persistUser.setActivated(true); persistUser.setEmail(RandomStringUtils.randomAlphabetic(5) + DEFAULT_EMAIL); - // persistUser.setFirstName(DEFAULT_FIRSTNAME); - // persistUser.setLastName(DEFAULT_LASTNAME); - // persistUser.setImageUrl(DEFAULT_IMAGEURL); persistUser.setLangKey(DEFAULT_LANGKEY); return persistUser; } @@ -147,8 +144,6 @@ void createUser() throws Exception { // Create the User AdminUserDTO userDTO = new AdminUserDTO(); userDTO.setLogin(DEFAULT_LOGIN); - // userDTO.setFirstName(DEFAULT_FIRSTNAME); - // userDTO.setLastName(DEFAULT_LASTNAME); userDTO.setEmail(DEFAULT_EMAIL); userDTO.setActivated(true); // userDTO.setImageUrl(DEFAULT_IMAGEURL); @@ -168,8 +163,6 @@ void createUser() throws Exception { User convertedUser = userMapper.userDTOToUser(returnedUserDTO); // Validate the returned User assertThat(convertedUser.getLogin()).isEqualTo(DEFAULT_LOGIN); - // assertThat(convertedUser.getFirstName()).isEqualTo(DEFAULT_FIRSTNAME); - // assertThat(convertedUser.getLastName()).isEqualTo(DEFAULT_LASTNAME); assertThat(convertedUser.getEmail()).isEqualTo(DEFAULT_EMAIL); // assertThat(convertedUser.getImageUrl()).isEqualTo(DEFAULT_IMAGEURL); assertThat(convertedUser.getLangKey()).isEqualTo(DEFAULT_LANGKEY); @@ -183,8 +176,6 @@ void createUserWithExistingId() throws Exception { AdminUserDTO userDTO = new AdminUserDTO(); userDTO.setId(DEFAULT_ID); userDTO.setLogin(DEFAULT_LOGIN); - // userDTO.setFirstName(DEFAULT_FIRSTNAME); - // userDTO.setLastName(DEFAULT_LASTNAME); userDTO.setEmail(DEFAULT_EMAIL); userDTO.setActivated(true); // userDTO.setImageUrl(DEFAULT_IMAGEURL); @@ -209,8 +200,6 @@ void createUserWithExistingLogin() throws Exception { AdminUserDTO userDTO = new AdminUserDTO(); userDTO.setLogin(DEFAULT_LOGIN); // this login should already be used - // userDTO.setFirstName(DEFAULT_FIRSTNAME); - // userDTO.setLastName(DEFAULT_LASTNAME); userDTO.setEmail("anothermail@localhost"); userDTO.setActivated(true); // userDTO.setImageUrl(DEFAULT_IMAGEURL); @@ -235,8 +224,6 @@ void createUserWithExistingEmail() throws Exception { AdminUserDTO userDTO = new AdminUserDTO(); userDTO.setLogin("anotherlogin"); - // userDTO.setFirstName(DEFAULT_FIRSTNAME); - // userDTO.setLastName(DEFAULT_LASTNAME); userDTO.setEmail(DEFAULT_EMAIL); // this email should already be used userDTO.setActivated(true); // userDTO.setImageUrl(DEFAULT_IMAGEURL); @@ -264,10 +251,7 @@ void getAllUsers() throws Exception { .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) .andExpect(jsonPath("$.[*].login").value(hasItem(DEFAULT_LOGIN))) - // .andExpect(jsonPath("$.[*].firstName").value(hasItem(DEFAULT_FIRSTNAME))) - // .andExpect(jsonPath("$.[*].lastName").value(hasItem(DEFAULT_LASTNAME))) .andExpect(jsonPath("$.[*].email").value(hasItem(DEFAULT_EMAIL))) - // .andExpect(jsonPath("$.[*].imageUrl").value(hasItem(DEFAULT_IMAGEURL))) .andExpect(jsonPath("$.[*].langKey").value(hasItem(DEFAULT_LANGKEY))); } @@ -313,8 +297,6 @@ void updateUser() throws Exception { AdminUserDTO userDTO = new AdminUserDTO(); userDTO.setId(updatedUser.getId()); userDTO.setLogin(updatedUser.getLogin()); - // userDTO.setFirstName(UPDATED_FIRSTNAME); - // userDTO.setLastName(UPDATED_LASTNAME); userDTO.setEmail(UPDATED_EMAIL); userDTO.setActivated(updatedUser.isActivated()); // userDTO.setImageUrl(UPDATED_IMAGEURL); @@ -333,8 +315,6 @@ void updateUser() throws Exception { assertPersistedUsers(users -> { assertThat(users).hasSize(databaseSizeBeforeUpdate); User testUser = users.stream().filter(usr -> usr.getId().equals(updatedUser.getId())).findFirst().orElseThrow(); - // assertThat(testUser.getFirstName()).isEqualTo(UPDATED_FIRSTNAME); - // assertThat(testUser.getLastName()).isEqualTo(UPDATED_LASTNAME); assertThat(testUser.getEmail()).isEqualTo(UPDATED_EMAIL); // assertThat(testUser.getImageUrl()).isEqualTo(UPDATED_IMAGEURL); assertThat(testUser.getLangKey()).isEqualTo(UPDATED_LANGKEY); @@ -354,8 +334,6 @@ void updateUserLogin() throws Exception { AdminUserDTO userDTO = new AdminUserDTO(); userDTO.setId(updatedUser.getId()); userDTO.setLogin(UPDATED_LOGIN); - // userDTO.setFirstName(UPDATED_FIRSTNAME); - // userDTO.setLastName(UPDATED_LASTNAME); userDTO.setEmail(UPDATED_EMAIL); userDTO.setActivated(updatedUser.isActivated()); // userDTO.setImageUrl(UPDATED_IMAGEURL); @@ -375,8 +353,6 @@ void updateUserLogin() throws Exception { assertThat(users).hasSize(databaseSizeBeforeUpdate); User testUser = users.stream().filter(usr -> usr.getId().equals(updatedUser.getId())).findFirst().orElseThrow(); assertThat(testUser.getLogin()).isEqualTo(UPDATED_LOGIN); - // assertThat(testUser.getFirstName()).isEqualTo(UPDATED_FIRSTNAME); - // assertThat(testUser.getLastName()).isEqualTo(UPDATED_LASTNAME); assertThat(testUser.getEmail()).isEqualTo(UPDATED_EMAIL); // assertThat(testUser.getImageUrl()).isEqualTo(UPDATED_IMAGEURL); assertThat(testUser.getLangKey()).isEqualTo(UPDATED_LANGKEY); @@ -394,9 +370,6 @@ void updateUserExistingEmail() throws Exception { anotherUser.setPassword(RandomStringUtils.randomAlphanumeric(60)); anotherUser.setActivated(true); anotherUser.setEmail("jhipster@localhost"); - // anotherUser.setFirstName("java"); - // anotherUser.setLastName("hipster"); - // anotherUser.setImageUrl(""); anotherUser.setLangKey("en"); userRepository.saveAndFlush(anotherUser); @@ -406,8 +379,6 @@ void updateUserExistingEmail() throws Exception { AdminUserDTO userDTO = new AdminUserDTO(); userDTO.setId(updatedUser.getId()); userDTO.setLogin(updatedUser.getLogin()); - // userDTO.setFirstName(updatedUser.getFirstName()); - // userDTO.setLastName(updatedUser.getLastName()); userDTO.setEmail("jhipster@localhost"); // this email should already be used by anotherUser userDTO.setActivated(updatedUser.isActivated()); // userDTO.setImageUrl(updatedUser.getImageUrl()); @@ -434,9 +405,6 @@ void updateUserExistingLogin() throws Exception { anotherUser.setPassword(RandomStringUtils.randomAlphanumeric(60)); anotherUser.setActivated(true); anotherUser.setEmail("jhipster@localhost"); - // anotherUser.setFirstName("java"); - // anotherUser.setLastName("hipster"); - // anotherUser.setImageUrl(""); anotherUser.setLangKey("en"); userRepository.saveAndFlush(anotherUser); @@ -446,8 +414,6 @@ void updateUserExistingLogin() throws Exception { AdminUserDTO userDTO = new AdminUserDTO(); userDTO.setId(updatedUser.getId()); userDTO.setLogin("jhipster"); // this login should already be used by anotherUser - // userDTO.setFirstName(updatedUser.getFirstName()); - // userDTO.setLastName(updatedUser.getLastName()); userDTO.setEmail(updatedUser.getEmail()); userDTO.setActivated(updatedUser.isActivated()); // userDTO.setImageUrl(updatedUser.getImageUrl()); From 68a217e5f6657a5476e36801dee49c8b5b44d14e Mon Sep 17 00:00:00 2001 From: "shenan.quek" <77522687+sayoungestguy@users.noreply.github.com> Date: Sun, 3 Nov 2024 21:53:55 +0800 Subject: [PATCH 4/6] Prepare change to SIT --- .../scaleup/service/UserService.java | 2 +- .../scaleup/service/mapper/UserMapper.java | 3 -- .../scaleup/web/rest/AccountResource.java | 8 +-- .../resources/config/application-prod.yml | 4 +- .../scaleup/web/rest/AccountResourceIT.java | 50 +++---------------- .../scaleup/web/rest/UserResourceIT.java | 18 ++----- 6 files changed, 15 insertions(+), 70 deletions(-) diff --git a/src/main/java/com/teamsixnus/scaleup/service/UserService.java b/src/main/java/com/teamsixnus/scaleup/service/UserService.java index dee70b3..0597b96 100644 --- a/src/main/java/com/teamsixnus/scaleup/service/UserService.java +++ b/src/main/java/com/teamsixnus/scaleup/service/UserService.java @@ -155,7 +155,7 @@ public User createUser(AdminUserDTO userDTO) { if (userDTO.getEmail() != null) { user.setEmail(userDTO.getEmail().toLowerCase()); } - // user.setImageUrl(userDTO.getImageUrl()); + if (userDTO.getLangKey() == null) { user.setLangKey(Constants.DEFAULT_LANGUAGE); // default language } else { diff --git a/src/main/java/com/teamsixnus/scaleup/service/mapper/UserMapper.java b/src/main/java/com/teamsixnus/scaleup/service/mapper/UserMapper.java index 1ddc99b..57c4e61 100644 --- a/src/main/java/com/teamsixnus/scaleup/service/mapper/UserMapper.java +++ b/src/main/java/com/teamsixnus/scaleup/service/mapper/UserMapper.java @@ -47,10 +47,7 @@ public User userDTOToUser(AdminUserDTO userDTO) { User user = new User(); user.setId(userDTO.getId()); user.setLogin(userDTO.getLogin()); - // user.setFirstName(userDTO.getFirstName()); - // user.setLastName(userDTO.getLastName()); user.setEmail(userDTO.getEmail()); - // user.setImageUrl(userDTO.getImageUrl()); user.setCreatedBy(userDTO.getCreatedBy()); user.setCreatedDate(userDTO.getCreatedDate()); user.setLastModifiedBy(userDTO.getLastModifiedBy()); diff --git a/src/main/java/com/teamsixnus/scaleup/web/rest/AccountResource.java b/src/main/java/com/teamsixnus/scaleup/web/rest/AccountResource.java index 46e1613..d500052 100644 --- a/src/main/java/com/teamsixnus/scaleup/web/rest/AccountResource.java +++ b/src/main/java/com/teamsixnus/scaleup/web/rest/AccountResource.java @@ -111,13 +111,7 @@ public void saveAccount(@Valid @RequestBody AdminUserDTO userDTO) { if (!user.isPresent()) { throw new AccountResourceException("User could not be found"); } - userService.updateUser( - // userDTO.getFirstName(), - // userDTO.getLastName(), - userDTO.getEmail(), - userDTO.getLangKey() - // userDTO.getImageUrl() - ); + userService.updateUser(userDTO.getEmail(), userDTO.getLangKey()); } /** diff --git a/src/main/resources/config/application-prod.yml b/src/main/resources/config/application-prod.yml index 51b6845..a4c3795 100644 --- a/src/main/resources/config/application-prod.yml +++ b/src/main/resources/config/application-prod.yml @@ -33,7 +33,7 @@ spring: enabled: false datasource: type: com.zaxxer.hikari.HikariDataSource - url: jdbc:mysql://terraform-20241008143513166800000005.cxq0oswgswef.ap-southeast-1.rds.amazonaws.com:3306/scaleup?useUnicode=true&characterEncoding=utf8&useSSL=false&useLegacyDatetimeCode=false&createDatabaseIfNotExist=true + url: jdbc:mysql://terraform-20241004101126193600000005.cxq0oswgswef.ap-southeast-1.rds.amazonaws.com:3306/scaleup?useUnicode=true&characterEncoding=utf8&useSSL=false&useLegacyDatetimeCode=false&createDatabaseIfNotExist=true username: admin password: teamsixnusscaleup # send to secrets hikari: @@ -121,7 +121,7 @@ jhipster: token-validity-in-seconds: 86400 token-validity-in-seconds-for-remember-me: 2592000 mail: # specific JHipster mail property, for standard properties see MailProperties - base-url: http://ec2-54-255-11-22.ap-southeast-1.compute.amazonaws.com # Modify according to your server's URL + base-url: http://ec2-52-77-34-58.ap-southeast-1.compute.amazonaws.com # Modify according to your server's URL logging: use-json-format: false # By default, logs are not in Json format logstash: # Forward logs to logstash over a socket, used by LoggingConfiguration diff --git a/src/test/java/com/teamsixnus/scaleup/web/rest/AccountResourceIT.java b/src/test/java/com/teamsixnus/scaleup/web/rest/AccountResourceIT.java index dc0496e..0bbd97d 100644 --- a/src/test/java/com/teamsixnus/scaleup/web/rest/AccountResourceIT.java +++ b/src/test/java/com/teamsixnus/scaleup/web/rest/AccountResourceIT.java @@ -133,10 +133,7 @@ void testRegisterValid() throws Exception { ManagedUserVM validUser = new ManagedUserVM(); validUser.setLogin("test-register-valid"); validUser.setPassword("password"); - // validUser.setFirstName("Alice"); - // validUser.setLastName("Test"); validUser.setEmail("test-register-valid@example.com"); - // validUser.setImageUrl("http://placehold.it/50x50"); validUser.setLangKey(Constants.DEFAULT_LANGUAGE); validUser.setAuthorities(Collections.singleton(AuthoritiesConstants.USER)); assertThat(userRepository.findOneByLogin("test-register-valid")).isEmpty(); @@ -156,11 +153,8 @@ void testRegisterInvalidLogin() throws Exception { ManagedUserVM invalidUser = new ManagedUserVM(); invalidUser.setLogin("funky-log(n"); // <-- invalid invalidUser.setPassword("password"); - // invalidUser.setFirstName("Funky"); - // invalidUser.setLastName("One"); invalidUser.setEmail("funky@example.com"); invalidUser.setActivated(true); - // invalidUser.setImageUrl("http://placehold.it/50x50"); invalidUser.setLangKey(Constants.DEFAULT_LANGUAGE); invalidUser.setAuthorities(Collections.singleton(AuthoritiesConstants.USER)); @@ -203,11 +197,8 @@ private static ManagedUserVM createInvalidUser( ManagedUserVM invalidUser = new ManagedUserVM(); invalidUser.setLogin(login); invalidUser.setPassword(password); - // invalidUser.setFirstName(firstName); - // invalidUser.setLastName(lastName); invalidUser.setEmail(email); invalidUser.setActivated(activated); - // invalidUser.setImageUrl("http://placehold.it/50x50"); invalidUser.setLangKey(Constants.DEFAULT_LANGUAGE); invalidUser.setAuthorities(Collections.singleton(AuthoritiesConstants.USER)); return invalidUser; @@ -220,10 +211,7 @@ void testRegisterDuplicateLogin() throws Exception { ManagedUserVM firstUser = new ManagedUserVM(); firstUser.setLogin("alice"); firstUser.setPassword("password"); - // firstUser.setFirstName("Alice"); - // firstUser.setLastName("Something"); firstUser.setEmail("alice@example.com"); - // firstUser.setImageUrl("http://placehold.it/50x50"); firstUser.setLangKey(Constants.DEFAULT_LANGUAGE); firstUser.setAuthorities(Collections.singleton(AuthoritiesConstants.USER)); @@ -231,10 +219,7 @@ void testRegisterDuplicateLogin() throws Exception { ManagedUserVM secondUser = new ManagedUserVM(); secondUser.setLogin(firstUser.getLogin()); secondUser.setPassword(firstUser.getPassword()); - // secondUser.setFirstName(firstUser.getFirstName()); - // secondUser.setLastName(firstUser.getLastName()); secondUser.setEmail("alice2@example.com"); - // secondUser.setImageUrl(firstUser.getImageUrl()); secondUser.setLangKey(firstUser.getLangKey()); secondUser.setCreatedBy(firstUser.getCreatedBy()); secondUser.setCreatedDate(firstUser.getCreatedDate()); @@ -272,10 +257,7 @@ void testRegisterDuplicateEmail() throws Exception { ManagedUserVM firstUser = new ManagedUserVM(); firstUser.setLogin("test-register-duplicate-email"); firstUser.setPassword("password"); - // firstUser.setFirstName("Alice"); - // firstUser.setLastName("Test"); firstUser.setEmail("test-register-duplicate-email@example.com"); - // firstUser.setImageUrl("http://placehold.it/50x50"); firstUser.setLangKey(Constants.DEFAULT_LANGUAGE); firstUser.setAuthorities(Collections.singleton(AuthoritiesConstants.USER)); @@ -291,10 +273,7 @@ void testRegisterDuplicateEmail() throws Exception { ManagedUserVM secondUser = new ManagedUserVM(); secondUser.setLogin("test-register-duplicate-email-2"); secondUser.setPassword(firstUser.getPassword()); - // secondUser.setFirstName(firstUser.getFirstName()); - // secondUser.setLastName(firstUser.getLastName()); secondUser.setEmail(firstUser.getEmail()); - // secondUser.setImageUrl(firstUser.getImageUrl()); secondUser.setLangKey(firstUser.getLangKey()); secondUser.setAuthorities(new HashSet<>(firstUser.getAuthorities())); @@ -314,10 +293,7 @@ void testRegisterDuplicateEmail() throws Exception { userWithUpperCaseEmail.setId(firstUser.getId()); userWithUpperCaseEmail.setLogin("test-register-duplicate-email-3"); userWithUpperCaseEmail.setPassword(firstUser.getPassword()); - // userWithUpperCaseEmail.setFirstName(firstUser.getFirstName()); - // userWithUpperCaseEmail.setLastName(firstUser.getLastName()); userWithUpperCaseEmail.setEmail("TEST-register-duplicate-email@example.com"); - // userWithUpperCaseEmail.setImageUrl(firstUser.getImageUrl()); userWithUpperCaseEmail.setLangKey(firstUser.getLangKey()); userWithUpperCaseEmail.setAuthorities(new HashSet<>(firstUser.getAuthorities())); @@ -347,11 +323,8 @@ void testRegisterAdminIsIgnored() throws Exception { ManagedUserVM validUser = new ManagedUserVM(); validUser.setLogin("badguy"); validUser.setPassword("password"); - // validUser.setFirstName("Bad"); - // validUser.setLastName("Guy"); validUser.setEmail("badguy@example.com"); validUser.setActivated(true); - // validUser.setImageUrl("http://placehold.it/50x50"); validUser.setLangKey(Constants.DEFAULT_LANGUAGE); validUser.setAuthorities(Collections.singleton(AuthoritiesConstants.ADMIN)); @@ -408,11 +381,8 @@ void testSaveAccount() throws Exception { AdminUserDTO userDTO = new AdminUserDTO(); userDTO.setLogin("not-used"); - // userDTO.setFirstName("firstname"); - // userDTO.setLastName("lastname"); userDTO.setEmail("save-account@example.com"); userDTO.setActivated(false); - // userDTO.setImageUrl("http://placehold.it/50x50"); userDTO.setLangKey(Constants.DEFAULT_LANGUAGE); userDTO.setAuthorities(Collections.singleton(AuthoritiesConstants.ADMIN)); @@ -421,12 +391,11 @@ void testSaveAccount() throws Exception { .andExpect(status().isOk()); User updatedUser = userRepository.findOneWithAuthoritiesByLogin(user.getLogin()).orElse(null); - // assertThat(updatedUser.getFirstName()).isEqualTo(userDTO.getFirstName()); - // assertThat(updatedUser.getLastName()).isEqualTo(userDTO.getLastName()); + assertThat(updatedUser.getEmail()).isEqualTo(userDTO.getEmail()); assertThat(updatedUser.getLangKey()).isEqualTo(userDTO.getLangKey()); assertThat(updatedUser.getPassword()).isEqualTo(user.getPassword()); - // assertThat(updatedUser.getImageUrl()).isEqualTo(userDTO.getImageUrl()); + assertThat(updatedUser.isActivated()).isTrue(); assertThat(updatedUser.getAuthorities()).isEmpty(); @@ -447,11 +416,10 @@ void testSaveInvalidEmail() throws Exception { AdminUserDTO userDTO = new AdminUserDTO(); userDTO.setLogin("not-used"); - // userDTO.setFirstName("firstname"); - // userDTO.setLastName("lastname"); + userDTO.setEmail("invalid email"); userDTO.setActivated(false); - // userDTO.setImageUrl("http://placehold.it/50x50"); + userDTO.setLangKey(Constants.DEFAULT_LANGUAGE); userDTO.setAuthorities(Collections.singleton(AuthoritiesConstants.ADMIN)); @@ -485,11 +453,10 @@ void testSaveExistingEmail() throws Exception { AdminUserDTO userDTO = new AdminUserDTO(); userDTO.setLogin("not-used"); - // userDTO.setFirstName("firstname"); - // userDTO.setLastName("lastname"); + userDTO.setEmail("save-existing-email2@example.com"); userDTO.setActivated(false); - // userDTO.setImageUrl("http://placehold.it/50x50"); + userDTO.setLangKey(Constants.DEFAULT_LANGUAGE); userDTO.setAuthorities(Collections.singleton(AuthoritiesConstants.ADMIN)); @@ -517,11 +484,10 @@ void testSaveExistingEmailAndLogin() throws Exception { AdminUserDTO userDTO = new AdminUserDTO(); userDTO.setLogin("not-used"); - // userDTO.setFirstName("firstname"); - // userDTO.setLastName("lastname"); + userDTO.setEmail("save-existing-email-and-login@example.com"); userDTO.setActivated(false); - // userDTO.setImageUrl("http://placehold.it/50x50"); + userDTO.setLangKey(Constants.DEFAULT_LANGUAGE); userDTO.setAuthorities(Collections.singleton(AuthoritiesConstants.ADMIN)); diff --git a/src/test/java/com/teamsixnus/scaleup/web/rest/UserResourceIT.java b/src/test/java/com/teamsixnus/scaleup/web/rest/UserResourceIT.java index 846af3f..cff15f2 100644 --- a/src/test/java/com/teamsixnus/scaleup/web/rest/UserResourceIT.java +++ b/src/test/java/com/teamsixnus/scaleup/web/rest/UserResourceIT.java @@ -43,21 +43,9 @@ class UserResourceIT { private static final Long DEFAULT_ID = 1L; - private static final String DEFAULT_PASSWORD = "passjohndoe"; - private static final String UPDATED_PASSWORD = "passjhipster"; - private static final String DEFAULT_EMAIL = "johndoe@localhost"; private static final String UPDATED_EMAIL = "jhipster@localhost"; - private static final String DEFAULT_FIRSTNAME = "john"; - private static final String UPDATED_FIRSTNAME = "jhipsterFirstName"; - - private static final String DEFAULT_LASTNAME = "doe"; - private static final String UPDATED_LASTNAME = "jhipsterLastName"; - - private static final String DEFAULT_IMAGEURL = "http://placehold.it/50x50"; - private static final String UPDATED_IMAGEURL = "http://placehold.it/40x40"; - private static final String DEFAULT_LANGKEY = "en"; private static final String UPDATED_LANGKEY = "fr"; @@ -146,7 +134,7 @@ void createUser() throws Exception { userDTO.setLogin(DEFAULT_LOGIN); userDTO.setEmail(DEFAULT_EMAIL); userDTO.setActivated(true); - // userDTO.setImageUrl(DEFAULT_IMAGEURL); + userDTO.setLangKey(DEFAULT_LANGKEY); userDTO.setAuthorities(Collections.singleton(AuthoritiesConstants.USER)); @@ -164,7 +152,7 @@ void createUser() throws Exception { // Validate the returned User assertThat(convertedUser.getLogin()).isEqualTo(DEFAULT_LOGIN); assertThat(convertedUser.getEmail()).isEqualTo(DEFAULT_EMAIL); - // assertThat(convertedUser.getImageUrl()).isEqualTo(DEFAULT_IMAGEURL); + assertThat(convertedUser.getLangKey()).isEqualTo(DEFAULT_LANGKEY); } @@ -202,7 +190,7 @@ void createUserWithExistingLogin() throws Exception { userDTO.setLogin(DEFAULT_LOGIN); // this login should already be used userDTO.setEmail("anothermail@localhost"); userDTO.setActivated(true); - // userDTO.setImageUrl(DEFAULT_IMAGEURL); + userDTO.setLangKey(DEFAULT_LANGKEY); userDTO.setAuthorities(Collections.singleton(AuthoritiesConstants.USER)); From 7b9ca34ff55a15ba2d404f684267afc3067b9fad Mon Sep 17 00:00:00 2001 From: "shenan.quek" <77522687+sayoungestguy@users.noreply.github.com> Date: Sun, 3 Nov 2024 22:00:35 +0800 Subject: [PATCH 5/6] fix backend test --- .../criteria/NotificationCriteria.java | 310 ------------------ .../criteria/NotificationCriteriaTest.java | 125 ------- 2 files changed, 435 deletions(-) delete mode 100644 src/main/java/com/teamsixnus/scaleup/service/criteria/NotificationCriteria.java delete mode 100644 src/test/java/com/teamsixnus/scaleup/service/criteria/NotificationCriteriaTest.java diff --git a/src/main/java/com/teamsixnus/scaleup/service/criteria/NotificationCriteria.java b/src/main/java/com/teamsixnus/scaleup/service/criteria/NotificationCriteria.java deleted file mode 100644 index c6138bb..0000000 --- a/src/main/java/com/teamsixnus/scaleup/service/criteria/NotificationCriteria.java +++ /dev/null @@ -1,310 +0,0 @@ -package com.teamsixnus.scaleup.service.criteria; - -import java.io.Serializable; -import java.util.Objects; -import java.util.Optional; -import org.springdoc.core.annotations.ParameterObject; -import tech.jhipster.service.Criteria; -import tech.jhipster.service.filter.*; - -/** - * Criteria class for the {@link com.teamsixnus.scaleup.domain.Notification} entity. This class is used - * in {@link com.teamsixnus.scaleup.web.rest.NotificationResource} to receive all the possible filtering options from - * the Http GET request parameters. - * For example the following could be a valid request: - * {@code /notifications?id.greaterThan=5&attr1.contains=something&attr2.specified=false} - * As Spring is unable to properly convert the types, unless specific {@link Filter} class are used, we need to use - * fix type specific filters. - */ -@ParameterObject -@SuppressWarnings("common-java:DuplicatedBlocks") -public class NotificationCriteria implements Serializable, Criteria { - - private static final long serialVersionUID = 1L; - - private LongFilter id; - - private UUIDFilter notificationRefId; - - private BooleanFilter isRead; - - private StringFilter createdBy; - - private InstantFilter createdDate; - - private StringFilter lastModifiedBy; - - private InstantFilter lastModifiedDate; - - private LongFilter userProfileId; - - private LongFilter typeId; - - private Boolean distinct; - - public NotificationCriteria() {} - - public NotificationCriteria(NotificationCriteria other) { - this.id = other.optionalId().map(LongFilter::copy).orElse(null); - this.notificationRefId = other.optionalNotificationRefId().map(UUIDFilter::copy).orElse(null); - this.isRead = other.optionalIsRead().map(BooleanFilter::copy).orElse(null); - this.createdBy = other.optionalCreatedBy().map(StringFilter::copy).orElse(null); - this.createdDate = other.optionalCreatedDate().map(InstantFilter::copy).orElse(null); - this.lastModifiedBy = other.optionalLastModifiedBy().map(StringFilter::copy).orElse(null); - this.lastModifiedDate = other.optionalLastModifiedDate().map(InstantFilter::copy).orElse(null); - this.userProfileId = other.optionalUserProfileId().map(LongFilter::copy).orElse(null); - this.typeId = other.optionalTypeId().map(LongFilter::copy).orElse(null); - this.distinct = other.distinct; - } - - @Override - public NotificationCriteria copy() { - return new NotificationCriteria(this); - } - - public LongFilter getId() { - return id; - } - - public Optional optionalId() { - return Optional.ofNullable(id); - } - - public LongFilter id() { - if (id == null) { - setId(new LongFilter()); - } - return id; - } - - public void setId(LongFilter id) { - this.id = id; - } - - public UUIDFilter getNotificationRefId() { - return notificationRefId; - } - - public Optional optionalNotificationRefId() { - return Optional.ofNullable(notificationRefId); - } - - public UUIDFilter notificationRefId() { - if (notificationRefId == null) { - setNotificationRefId(new UUIDFilter()); - } - return notificationRefId; - } - - public void setNotificationRefId(UUIDFilter notificationRefId) { - this.notificationRefId = notificationRefId; - } - - public BooleanFilter getIsRead() { - return isRead; - } - - public Optional optionalIsRead() { - return Optional.ofNullable(isRead); - } - - public BooleanFilter isRead() { - if (isRead == null) { - setIsRead(new BooleanFilter()); - } - return isRead; - } - - public void setIsRead(BooleanFilter isRead) { - this.isRead = isRead; - } - - public StringFilter getCreatedBy() { - return createdBy; - } - - public Optional optionalCreatedBy() { - return Optional.ofNullable(createdBy); - } - - public StringFilter createdBy() { - if (createdBy == null) { - setCreatedBy(new StringFilter()); - } - return createdBy; - } - - public void setCreatedBy(StringFilter createdBy) { - this.createdBy = createdBy; - } - - public InstantFilter getCreatedDate() { - return createdDate; - } - - public Optional optionalCreatedDate() { - return Optional.ofNullable(createdDate); - } - - public InstantFilter createdDate() { - if (createdDate == null) { - setCreatedDate(new InstantFilter()); - } - return createdDate; - } - - public void setCreatedDate(InstantFilter createdDate) { - this.createdDate = createdDate; - } - - public StringFilter getLastModifiedBy() { - return lastModifiedBy; - } - - public Optional optionalLastModifiedBy() { - return Optional.ofNullable(lastModifiedBy); - } - - public StringFilter lastModifiedBy() { - if (lastModifiedBy == null) { - setLastModifiedBy(new StringFilter()); - } - return lastModifiedBy; - } - - public void setLastModifiedBy(StringFilter lastModifiedBy) { - this.lastModifiedBy = lastModifiedBy; - } - - public InstantFilter getLastModifiedDate() { - return lastModifiedDate; - } - - public Optional optionalLastModifiedDate() { - return Optional.ofNullable(lastModifiedDate); - } - - public InstantFilter lastModifiedDate() { - if (lastModifiedDate == null) { - setLastModifiedDate(new InstantFilter()); - } - return lastModifiedDate; - } - - public void setLastModifiedDate(InstantFilter lastModifiedDate) { - this.lastModifiedDate = lastModifiedDate; - } - - public LongFilter getUserProfileId() { - return userProfileId; - } - - public Optional optionalUserProfileId() { - return Optional.ofNullable(userProfileId); - } - - public LongFilter userProfileId() { - if (userProfileId == null) { - setUserProfileId(new LongFilter()); - } - return userProfileId; - } - - public void setUserProfileId(LongFilter userProfileId) { - this.userProfileId = userProfileId; - } - - public LongFilter getTypeId() { - return typeId; - } - - public Optional optionalTypeId() { - return Optional.ofNullable(typeId); - } - - public LongFilter typeId() { - if (typeId == null) { - setTypeId(new LongFilter()); - } - return typeId; - } - - public void setTypeId(LongFilter typeId) { - this.typeId = typeId; - } - - public Boolean getDistinct() { - return distinct; - } - - public Optional optionalDistinct() { - return Optional.ofNullable(distinct); - } - - public Boolean distinct() { - if (distinct == null) { - setDistinct(true); - } - return distinct; - } - - public void setDistinct(Boolean distinct) { - this.distinct = distinct; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - final NotificationCriteria that = (NotificationCriteria) o; - return ( - Objects.equals(id, that.id) && - Objects.equals(notificationRefId, that.notificationRefId) && - Objects.equals(isRead, that.isRead) && - Objects.equals(createdBy, that.createdBy) && - Objects.equals(createdDate, that.createdDate) && - Objects.equals(lastModifiedBy, that.lastModifiedBy) && - Objects.equals(lastModifiedDate, that.lastModifiedDate) && - Objects.equals(userProfileId, that.userProfileId) && - Objects.equals(typeId, that.typeId) && - Objects.equals(distinct, that.distinct) - ); - } - - @Override - public int hashCode() { - return Objects.hash( - id, - notificationRefId, - isRead, - createdBy, - createdDate, - lastModifiedBy, - lastModifiedDate, - userProfileId, - typeId, - distinct - ); - } - - // prettier-ignore - @Override - public String toString() { - return "NotificationCriteria{" + - optionalId().map(f -> "id=" + f + ", ").orElse("") + - optionalNotificationRefId().map(f -> "notificationRefId=" + f + ", ").orElse("") + - optionalIsRead().map(f -> "isRead=" + f + ", ").orElse("") + - optionalCreatedBy().map(f -> "createdBy=" + f + ", ").orElse("") + - optionalCreatedDate().map(f -> "createdDate=" + f + ", ").orElse("") + - optionalLastModifiedBy().map(f -> "lastModifiedBy=" + f + ", ").orElse("") + - optionalLastModifiedDate().map(f -> "lastModifiedDate=" + f + ", ").orElse("") + - optionalUserProfileId().map(f -> "userProfileId=" + f + ", ").orElse("") + - optionalTypeId().map(f -> "typeId=" + f + ", ").orElse("") + - optionalDistinct().map(f -> "distinct=" + f + ", ").orElse("") + - "}"; - } -} diff --git a/src/test/java/com/teamsixnus/scaleup/service/criteria/NotificationCriteriaTest.java b/src/test/java/com/teamsixnus/scaleup/service/criteria/NotificationCriteriaTest.java deleted file mode 100644 index a4ef124..0000000 --- a/src/test/java/com/teamsixnus/scaleup/service/criteria/NotificationCriteriaTest.java +++ /dev/null @@ -1,125 +0,0 @@ -package com.teamsixnus.scaleup.service.criteria; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.util.function.BiFunction; -import java.util.function.Function; -import org.assertj.core.api.Condition; -import org.junit.jupiter.api.Test; - -class NotificationCriteriaTest { - - @Test - void newNotificationCriteriaHasAllFiltersNullTest() { - var notificationCriteria = new NotificationCriteria(); - assertThat(notificationCriteria).is(criteriaFiltersAre(filter -> filter == null)); - } - - @Test - void notificationCriteriaFluentMethodsCreatesFiltersTest() { - var notificationCriteria = new NotificationCriteria(); - - setAllFilters(notificationCriteria); - - assertThat(notificationCriteria).is(criteriaFiltersAre(filter -> filter != null)); - } - - @Test - void notificationCriteriaCopyCreatesNullFilterTest() { - var notificationCriteria = new NotificationCriteria(); - var copy = notificationCriteria.copy(); - - assertThat(notificationCriteria).satisfies( - criteria -> - assertThat(criteria).is( - copyFiltersAre(copy, (a, b) -> (a == null || a instanceof Boolean) ? a == b : (a != b && a.equals(b))) - ), - criteria -> assertThat(criteria).isEqualTo(copy), - criteria -> assertThat(criteria).hasSameHashCodeAs(copy) - ); - - assertThat(copy).satisfies( - criteria -> assertThat(criteria).is(criteriaFiltersAre(filter -> filter == null)), - criteria -> assertThat(criteria).isEqualTo(notificationCriteria) - ); - } - - @Test - void notificationCriteriaCopyDuplicatesEveryExistingFilterTest() { - var notificationCriteria = new NotificationCriteria(); - setAllFilters(notificationCriteria); - - var copy = notificationCriteria.copy(); - - assertThat(notificationCriteria).satisfies( - criteria -> - assertThat(criteria).is( - copyFiltersAre(copy, (a, b) -> (a == null || a instanceof Boolean) ? a == b : (a != b && a.equals(b))) - ), - criteria -> assertThat(criteria).isEqualTo(copy), - criteria -> assertThat(criteria).hasSameHashCodeAs(copy) - ); - - assertThat(copy).satisfies( - criteria -> assertThat(criteria).is(criteriaFiltersAre(filter -> filter != null)), - criteria -> assertThat(criteria).isEqualTo(notificationCriteria) - ); - } - - @Test - void toStringVerifier() { - var notificationCriteria = new NotificationCriteria(); - - assertThat(notificationCriteria).hasToString("NotificationCriteria{}"); - } - - private static void setAllFilters(NotificationCriteria notificationCriteria) { - notificationCriteria.id(); - notificationCriteria.notificationRefId(); - notificationCriteria.isRead(); - notificationCriteria.createdBy(); - notificationCriteria.createdDate(); - notificationCriteria.lastModifiedBy(); - notificationCriteria.lastModifiedDate(); - notificationCriteria.userProfileId(); - notificationCriteria.typeId(); - notificationCriteria.distinct(); - } - - private static Condition criteriaFiltersAre(Function condition) { - return new Condition<>( - criteria -> - condition.apply(criteria.getId()) && - condition.apply(criteria.getNotificationRefId()) && - condition.apply(criteria.getIsRead()) && - condition.apply(criteria.getCreatedBy()) && - condition.apply(criteria.getCreatedDate()) && - condition.apply(criteria.getLastModifiedBy()) && - condition.apply(criteria.getLastModifiedDate()) && - condition.apply(criteria.getUserProfileId()) && - condition.apply(criteria.getTypeId()) && - condition.apply(criteria.getDistinct()), - "every filter matches" - ); - } - - private static Condition copyFiltersAre( - NotificationCriteria copy, - BiFunction condition - ) { - return new Condition<>( - criteria -> - condition.apply(criteria.getId(), copy.getId()) && - condition.apply(criteria.getNotificationRefId(), copy.getNotificationRefId()) && - condition.apply(criteria.getIsRead(), copy.getIsRead()) && - condition.apply(criteria.getCreatedBy(), copy.getCreatedBy()) && - condition.apply(criteria.getCreatedDate(), copy.getCreatedDate()) && - condition.apply(criteria.getLastModifiedBy(), copy.getLastModifiedBy()) && - condition.apply(criteria.getLastModifiedDate(), copy.getLastModifiedDate()) && - condition.apply(criteria.getUserProfileId(), copy.getUserProfileId()) && - condition.apply(criteria.getTypeId(), copy.getTypeId()) && - condition.apply(criteria.getDistinct(), copy.getDistinct()), - "every filter matches" - ); - } -} From 3d6ade2c8521757f6766cb630e0782f8499cde76 Mon Sep 17 00:00:00 2001 From: "shenan.quek" <77522687+sayoungestguy@users.noreply.github.com> Date: Sun, 3 Nov 2024 22:38:01 +0800 Subject: [PATCH 6/6] Prepare for production --- dbscripts/insert_data.sql | 2 +- .../com/teamsixnus/scaleup/domain/User.java | 15 ------- .../scaleup/service/UserService.java | 3 +- .../scaleup/service/dto/AdminUserDTO.java | 39 ------------------- .../resources/config/application-prod.yml | 4 +- .../scaleup/domain/ActivityInviteAsserts.java | 13 ------- .../scaleup/service/UserServiceIT.java | 9 ----- .../service/mapper/UserMapperTest.java | 9 ----- .../web/rest/ActivityInviteResourceIT.java | 11 ------ .../scaleup/web/rest/UserResourceIT.java | 12 +++--- 10 files changed, 10 insertions(+), 107 deletions(-) diff --git a/dbscripts/insert_data.sql b/dbscripts/insert_data.sql index 729cfbf..49cb8ca 100644 --- a/dbscripts/insert_data.sql +++ b/dbscripts/insert_data.sql @@ -43,7 +43,7 @@ SELECT * FROM tbl_skill; -- View the inserted data SELECT * FROM tbl_code_tables; -- View the inserted data -SELECT * FROM tbl_user_profiles; +SELECT * FROM tbl_user_profile; diff --git a/src/main/java/com/teamsixnus/scaleup/domain/User.java b/src/main/java/com/teamsixnus/scaleup/domain/User.java index 795b965..f304b86 100644 --- a/src/main/java/com/teamsixnus/scaleup/domain/User.java +++ b/src/main/java/com/teamsixnus/scaleup/domain/User.java @@ -43,14 +43,6 @@ public class User extends AbstractAuditingEntity implements Serializable { @Column(name = "password_hash", length = 60, nullable = false) private String password; - // @Size(max = 50) - // @Column(name = "first_name", length = 50) - // private String firstName; - // - // @Size(max = 50) - // @Column(name = "last_name", length = 50) - // private String lastName; - @Email @Size(min = 5, max = 254) @Column(length = 254, unique = true) @@ -64,10 +56,6 @@ public class User extends AbstractAuditingEntity implements Serializable { @Column(name = "lang_key", length = 10) private String langKey; - // @Size(max = 256) - // @Column(name = "image_url", length = 256) - // private String imageUrl; - @Size(max = 20) @Column(name = "activation_key", length = 20) @JsonIgnore @@ -195,10 +183,7 @@ public int hashCode() { public String toString() { return "User{" + "login='" + login + '\'' + -// ", firstName='" + firstName + '\'' + -// ", lastName='" + lastName + '\'' + ", email='" + email + '\'' + -// ", imageUrl='" + imageUrl + '\'' + ", activated='" + activated + '\'' + ", langKey='" + langKey + '\'' + ", activationKey='" + activationKey + '\'' + diff --git a/src/main/java/com/teamsixnus/scaleup/service/UserService.java b/src/main/java/com/teamsixnus/scaleup/service/UserService.java index 0597b96..dfda8e7 100644 --- a/src/main/java/com/teamsixnus/scaleup/service/UserService.java +++ b/src/main/java/com/teamsixnus/scaleup/service/UserService.java @@ -199,7 +199,7 @@ public Optional updateUser(AdminUserDTO userDTO) { if (userDTO.getEmail() != null) { user.setEmail(userDTO.getEmail().toLowerCase()); } - // user.setImageUrl(userDTO.getImageUrl()); + user.setActivated(userDTO.isActivated()); user.setLangKey(userDTO.getLangKey()); Set managedAuthorities = user.getAuthorities(); @@ -243,7 +243,6 @@ public void updateUser(String email, String langKey) { user.setEmail(email.toLowerCase()); } user.setLangKey(langKey); - // user.setImageUrl(imageUrl); userRepository.save(user); this.clearUserCaches(user); log.debug("Changed Information for User: {}", user); diff --git a/src/main/java/com/teamsixnus/scaleup/service/dto/AdminUserDTO.java b/src/main/java/com/teamsixnus/scaleup/service/dto/AdminUserDTO.java index f6e36c7..38c4ca1 100644 --- a/src/main/java/com/teamsixnus/scaleup/service/dto/AdminUserDTO.java +++ b/src/main/java/com/teamsixnus/scaleup/service/dto/AdminUserDTO.java @@ -23,19 +23,10 @@ public class AdminUserDTO implements Serializable { @Size(min = 1, max = 50) private String login; - // @Size(max = 50) - // private String firstName; - // - // @Size(max = 50) - // private String lastName; - @Email @Size(min = 5, max = 254) private String email; - // @Size(max = 256) - // private String imageUrl; - private boolean activated = false; @Size(min = 2, max = 10) @@ -58,11 +49,8 @@ public AdminUserDTO() { public AdminUserDTO(User user) { this.id = user.getId(); this.login = user.getLogin(); - // this.firstName = user.getFirstName(); - // this.lastName = user.getLastName(); this.email = user.getEmail(); this.activated = user.isActivated(); - // this.imageUrl = user.getImageUrl(); this.langKey = user.getLangKey(); this.createdBy = user.getCreatedBy(); this.createdDate = user.getCreatedDate(); @@ -87,22 +75,6 @@ public void setLogin(String login) { this.login = login; } - // public String getFirstName() { - // return firstName; - // } - // - // public void setFirstName(String firstName) { - // this.firstName = firstName; - // } - // - // public String getLastName() { - // return lastName; - // } - // - // public void setLastName(String lastName) { - // this.lastName = lastName; - // } - public String getEmail() { return email; } @@ -111,14 +83,6 @@ public void setEmail(String email) { this.email = email; } - // public String getImageUrl() { - // return imageUrl; - // } - // - // public void setImageUrl(String imageUrl) { - // this.imageUrl = imageUrl; - // } - public boolean isActivated() { return activated; } @@ -180,10 +144,7 @@ public void setAuthorities(Set authorities) { public String toString() { return "AdminUserDTO{" + "login='" + login + '\'' + -// ", firstName='" + firstName + '\'' + -// ", lastName='" + lastName + '\'' + ", email='" + email + '\'' + -// ", imageUrl='" + imageUrl + '\'' + ", activated=" + activated + ", langKey='" + langKey + '\'' + ", createdBy=" + createdBy + diff --git a/src/main/resources/config/application-prod.yml b/src/main/resources/config/application-prod.yml index a4c3795..51b6845 100644 --- a/src/main/resources/config/application-prod.yml +++ b/src/main/resources/config/application-prod.yml @@ -33,7 +33,7 @@ spring: enabled: false datasource: type: com.zaxxer.hikari.HikariDataSource - url: jdbc:mysql://terraform-20241004101126193600000005.cxq0oswgswef.ap-southeast-1.rds.amazonaws.com:3306/scaleup?useUnicode=true&characterEncoding=utf8&useSSL=false&useLegacyDatetimeCode=false&createDatabaseIfNotExist=true + url: jdbc:mysql://terraform-20241008143513166800000005.cxq0oswgswef.ap-southeast-1.rds.amazonaws.com:3306/scaleup?useUnicode=true&characterEncoding=utf8&useSSL=false&useLegacyDatetimeCode=false&createDatabaseIfNotExist=true username: admin password: teamsixnusscaleup # send to secrets hikari: @@ -121,7 +121,7 @@ jhipster: token-validity-in-seconds: 86400 token-validity-in-seconds-for-remember-me: 2592000 mail: # specific JHipster mail property, for standard properties see MailProperties - base-url: http://ec2-52-77-34-58.ap-southeast-1.compute.amazonaws.com # Modify according to your server's URL + base-url: http://ec2-54-255-11-22.ap-southeast-1.compute.amazonaws.com # Modify according to your server's URL logging: use-json-format: false # By default, logs are not in Json format logstash: # Forward logs to logstash over a socket, used by LoggingConfiguration diff --git a/src/test/java/com/teamsixnus/scaleup/domain/ActivityInviteAsserts.java b/src/test/java/com/teamsixnus/scaleup/domain/ActivityInviteAsserts.java index 26b7d60..e34c1e9 100644 --- a/src/test/java/com/teamsixnus/scaleup/domain/ActivityInviteAsserts.java +++ b/src/test/java/com/teamsixnus/scaleup/domain/ActivityInviteAsserts.java @@ -22,7 +22,6 @@ public static void assertActivityInviteAllPropertiesEquals(ActivityInvite expect * @param actual the actual entity */ public static void assertActivityInviteAllUpdatablePropertiesEquals(ActivityInvite expected, ActivityInvite actual) { - //assertActivityInviteUpdatableFieldsEquals(expected, actual); assertActivityInviteUpdatableRelationshipsEquals(expected, actual); } @@ -40,18 +39,6 @@ public static void assertActivityInviteAutoGeneratedPropertiesEquals(ActivityInv .satisfies(e -> assertThat(e.getCreatedDate()).as("check createdDate").isEqualTo(actual.getCreatedDate())); } - // /** - // * Asserts that the entity has all the updatable fields set. - // * - // * @param expected the expected entity - // * @param actual the actual entity - // */ - // public static void assertActivityInviteUpdatableFieldsEquals(ActivityInvite expected, ActivityInvite actual) { - // assertThat(expected) - // .as("Verify ActivityInvite relevant properties") - // .satisfies(e -> assertThat(e.getWillParticipate()).as("check willParticipate").isEqualTo(actual.getWillParticipate())); - // } - /** * Asserts that the entity has all the updatable relationships set. * diff --git a/src/test/java/com/teamsixnus/scaleup/service/UserServiceIT.java b/src/test/java/com/teamsixnus/scaleup/service/UserServiceIT.java index 900d55b..bf1d223 100644 --- a/src/test/java/com/teamsixnus/scaleup/service/UserServiceIT.java +++ b/src/test/java/com/teamsixnus/scaleup/service/UserServiceIT.java @@ -36,15 +36,9 @@ class UserServiceIT { private static final String DEFAULT_EMAIL = "johndoe_service@localhost"; - private static final String DEFAULT_FIRSTNAME = "john"; - - private static final String DEFAULT_LASTNAME = "doe"; - @Autowired private CacheManager cacheManager; - private static final String DEFAULT_IMAGEURL = "http://placehold.it/50x50"; - private static final String DEFAULT_LANGKEY = "dummy"; @Autowired @@ -75,9 +69,6 @@ public void init() { user.setPassword(RandomStringUtils.randomAlphanumeric(60)); user.setActivated(true); user.setEmail(DEFAULT_EMAIL); - // user.setFirstName(DEFAULT_FIRSTNAME); - // user.setLastName(DEFAULT_LASTNAME); - // user.setImageUrl(DEFAULT_IMAGEURL); user.setLangKey(DEFAULT_LANGKEY); when(dateTimeProvider.getNow()).thenReturn(Optional.of(LocalDateTime.now())); diff --git a/src/test/java/com/teamsixnus/scaleup/service/mapper/UserMapperTest.java b/src/test/java/com/teamsixnus/scaleup/service/mapper/UserMapperTest.java index ac3fbf9..f2010ce 100644 --- a/src/test/java/com/teamsixnus/scaleup/service/mapper/UserMapperTest.java +++ b/src/test/java/com/teamsixnus/scaleup/service/mapper/UserMapperTest.java @@ -36,9 +36,6 @@ public void init() { user.setPassword(RandomStringUtils.randomAlphanumeric(60)); user.setActivated(true); user.setEmail("johndoe@localhost"); - // user.setFirstName("john"); - // user.setLastName("doe"); - // user.setImageUrl("image_url"); user.setCreatedBy(DEFAULT_LOGIN); user.setCreatedDate(Instant.now()); user.setLastModifiedBy(DEFAULT_LOGIN); @@ -60,11 +57,8 @@ void testUserToUserDTO() { assertThat(convertedUserDto.getId()).isEqualTo(user.getId()); assertThat(convertedUserDto.getLogin()).isEqualTo(user.getLogin()); - // assertThat(convertedUserDto.getFirstName()).isEqualTo(user.getFirstName()); - // assertThat(convertedUserDto.getLastName()).isEqualTo(user.getLastName()); assertThat(convertedUserDto.getEmail()).isEqualTo(user.getEmail()); assertThat(convertedUserDto.isActivated()).isEqualTo(user.isActivated()); - // assertThat(convertedUserDto.getImageUrl()).isEqualTo(user.getImageUrl()); assertThat(convertedUserDto.getCreatedBy()).isEqualTo(user.getCreatedBy()); assertThat(convertedUserDto.getCreatedDate()).isEqualTo(user.getCreatedDate()); assertThat(convertedUserDto.getLastModifiedBy()).isEqualTo(user.getLastModifiedBy()); @@ -79,11 +73,8 @@ void testUserDTOtoUser() { assertThat(convertedUser.getId()).isEqualTo(userDto.getId()); assertThat(convertedUser.getLogin()).isEqualTo(userDto.getLogin()); - // assertThat(convertedUser.getFirstName()).isEqualTo(userDto.getFirstName()); - // assertThat(convertedUser.getLastName()).isEqualTo(userDto.getLastName()); assertThat(convertedUser.getEmail()).isEqualTo(userDto.getEmail()); assertThat(convertedUser.isActivated()).isEqualTo(userDto.isActivated()); - // assertThat(convertedUser.getImageUrl()).isEqualTo(userDto.getImageUrl()); assertThat(convertedUser.getLangKey()).isEqualTo(userDto.getLangKey()); assertThat(convertedUser.getCreatedBy()).isEqualTo(userDto.getCreatedBy()); assertThat(convertedUser.getCreatedDate()).isEqualTo(userDto.getCreatedDate()); diff --git a/src/test/java/com/teamsixnus/scaleup/web/rest/ActivityInviteResourceIT.java b/src/test/java/com/teamsixnus/scaleup/web/rest/ActivityInviteResourceIT.java index b3c9292..5b8a808 100644 --- a/src/test/java/com/teamsixnus/scaleup/web/rest/ActivityInviteResourceIT.java +++ b/src/test/java/com/teamsixnus/scaleup/web/rest/ActivityInviteResourceIT.java @@ -1,7 +1,6 @@ package com.teamsixnus.scaleup.web.rest; import static com.teamsixnus.scaleup.domain.ActivityInviteAsserts.*; -import static com.teamsixnus.scaleup.web.rest.TestUtil.createUpdateProxyForBean; import static org.assertj.core.api.Assertions.assertThat; import static org.hamcrest.Matchers.hasItem; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; @@ -116,7 +115,6 @@ void createActivityInvite() throws Exception { // Validate the ActivityInvite in the database assertIncrementedRepositoryCount(databaseSizeBeforeCreate); var returnedActivityInvite = activityInviteMapper.toEntity(returnedActivityInviteDTO); - //assertActivityInviteUpdatableFieldsEquals(returnedActivityInvite, getPersistedActivityInvite(returnedActivityInvite)); insertedActivityInvite = returnedActivityInvite; } @@ -409,10 +407,6 @@ void partialUpdateActivityInviteWithPatch() throws Exception { // Validate the ActivityInvite in the database assertSameRepositoryCount(databaseSizeBeforeUpdate); - // assertActivityInviteUpdatableFieldsEquals( - // createUpdateProxyForBean(partialUpdatedActivityInvite, activityInvite), - // getPersistedActivityInvite(activityInvite) - // ); } @Test @@ -438,7 +432,6 @@ void fullUpdateActivityInviteWithPatch() throws Exception { // Validate the ActivityInvite in the database assertSameRepositoryCount(databaseSizeBeforeUpdate); - //assertActivityInviteUpdatableFieldsEquals(partialUpdatedActivityInvite, getPersistedActivityInvite(partialUpdatedActivityInvite)); } @Test @@ -543,8 +536,4 @@ protected ActivityInvite getPersistedActivityInvite(ActivityInvite activityInvit protected void assertPersistedActivityInviteToMatchAllProperties(ActivityInvite expectedActivityInvite) { assertActivityInviteAllPropertiesEquals(expectedActivityInvite, getPersistedActivityInvite(expectedActivityInvite)); } - - protected void assertPersistedActivityInviteToMatchUpdatableProperties(ActivityInvite expectedActivityInvite) { - assertActivityInviteAllUpdatablePropertiesEquals(expectedActivityInvite, getPersistedActivityInvite(expectedActivityInvite)); - } } diff --git a/src/test/java/com/teamsixnus/scaleup/web/rest/UserResourceIT.java b/src/test/java/com/teamsixnus/scaleup/web/rest/UserResourceIT.java index cff15f2..b227ab9 100644 --- a/src/test/java/com/teamsixnus/scaleup/web/rest/UserResourceIT.java +++ b/src/test/java/com/teamsixnus/scaleup/web/rest/UserResourceIT.java @@ -287,7 +287,7 @@ void updateUser() throws Exception { userDTO.setLogin(updatedUser.getLogin()); userDTO.setEmail(UPDATED_EMAIL); userDTO.setActivated(updatedUser.isActivated()); - // userDTO.setImageUrl(UPDATED_IMAGEURL); + userDTO.setLangKey(UPDATED_LANGKEY); userDTO.setCreatedBy(updatedUser.getCreatedBy()); userDTO.setCreatedDate(updatedUser.getCreatedDate()); @@ -304,7 +304,7 @@ void updateUser() throws Exception { assertThat(users).hasSize(databaseSizeBeforeUpdate); User testUser = users.stream().filter(usr -> usr.getId().equals(updatedUser.getId())).findFirst().orElseThrow(); assertThat(testUser.getEmail()).isEqualTo(UPDATED_EMAIL); - // assertThat(testUser.getImageUrl()).isEqualTo(UPDATED_IMAGEURL); + assertThat(testUser.getLangKey()).isEqualTo(UPDATED_LANGKEY); }); } @@ -324,7 +324,7 @@ void updateUserLogin() throws Exception { userDTO.setLogin(UPDATED_LOGIN); userDTO.setEmail(UPDATED_EMAIL); userDTO.setActivated(updatedUser.isActivated()); - // userDTO.setImageUrl(UPDATED_IMAGEURL); + userDTO.setLangKey(UPDATED_LANGKEY); userDTO.setCreatedBy(updatedUser.getCreatedBy()); userDTO.setCreatedDate(updatedUser.getCreatedDate()); @@ -342,7 +342,7 @@ void updateUserLogin() throws Exception { User testUser = users.stream().filter(usr -> usr.getId().equals(updatedUser.getId())).findFirst().orElseThrow(); assertThat(testUser.getLogin()).isEqualTo(UPDATED_LOGIN); assertThat(testUser.getEmail()).isEqualTo(UPDATED_EMAIL); - // assertThat(testUser.getImageUrl()).isEqualTo(UPDATED_IMAGEURL); + assertThat(testUser.getLangKey()).isEqualTo(UPDATED_LANGKEY); }); } @@ -369,7 +369,7 @@ void updateUserExistingEmail() throws Exception { userDTO.setLogin(updatedUser.getLogin()); userDTO.setEmail("jhipster@localhost"); // this email should already be used by anotherUser userDTO.setActivated(updatedUser.isActivated()); - // userDTO.setImageUrl(updatedUser.getImageUrl()); + userDTO.setLangKey(updatedUser.getLangKey()); userDTO.setCreatedBy(updatedUser.getCreatedBy()); userDTO.setCreatedDate(updatedUser.getCreatedDate()); @@ -404,7 +404,7 @@ void updateUserExistingLogin() throws Exception { userDTO.setLogin("jhipster"); // this login should already be used by anotherUser userDTO.setEmail(updatedUser.getEmail()); userDTO.setActivated(updatedUser.isActivated()); - // userDTO.setImageUrl(updatedUser.getImageUrl()); + userDTO.setLangKey(updatedUser.getLangKey()); userDTO.setCreatedBy(updatedUser.getCreatedBy()); userDTO.setCreatedDate(updatedUser.getCreatedDate());