Skip to content

Commit

Permalink
Prepare for production
Browse files Browse the repository at this point in the history
  • Loading branch information
sayoungestguy committed Nov 3, 2024
1 parent 7b9ca34 commit 3d6ade2
Show file tree
Hide file tree
Showing 10 changed files with 10 additions and 107 deletions.
2 changes: 1 addition & 1 deletion dbscripts/insert_data.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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;



Expand Down
15 changes: 0 additions & 15 deletions src/main/java/com/teamsixnus/scaleup/domain/User.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,6 @@ public class User extends AbstractAuditingEntity<Long> 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)
Expand All @@ -64,10 +56,6 @@ public class User extends AbstractAuditingEntity<Long> 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
Expand Down Expand Up @@ -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 + '\'' +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ public Optional<AdminUserDTO> 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<Authority> managedAuthorities = user.getAuthorities();
Expand Down Expand Up @@ -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);
Expand Down
39 changes: 0 additions & 39 deletions src/main/java/com/teamsixnus/scaleup/service/dto/AdminUserDTO.java
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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();
Expand All @@ -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;
}
Expand All @@ -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;
}
Expand Down Expand Up @@ -180,10 +144,7 @@ public void setAuthorities(Set<String> authorities) {
public String toString() {
return "AdminUserDTO{" +
"login='" + login + '\'' +
// ", firstName='" + firstName + '\'' +
// ", lastName='" + lastName + '\'' +
", email='" + email + '\'' +
// ", imageUrl='" + imageUrl + '\'' +
", activated=" + activated +
", langKey='" + langKey + '\'' +
", createdBy=" + createdBy +
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/config/application-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand All @@ -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.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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());
Expand All @@ -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());
Expand Down
Original file line number Diff line number Diff line change
@@ -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.*;
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -409,10 +407,6 @@ void partialUpdateActivityInviteWithPatch() throws Exception {
// Validate the ActivityInvite in the database

assertSameRepositoryCount(databaseSizeBeforeUpdate);
// assertActivityInviteUpdatableFieldsEquals(
// createUpdateProxyForBean(partialUpdatedActivityInvite, activityInvite),
// getPersistedActivityInvite(activityInvite)
// );
}

@Test
Expand All @@ -438,7 +432,6 @@ void fullUpdateActivityInviteWithPatch() throws Exception {
// Validate the ActivityInvite in the database

assertSameRepositoryCount(databaseSizeBeforeUpdate);
//assertActivityInviteUpdatableFieldsEquals(partialUpdatedActivityInvite, getPersistedActivityInvite(partialUpdatedActivityInvite));
}

@Test
Expand Down Expand Up @@ -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));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand All @@ -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);
});
}
Expand All @@ -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());
Expand All @@ -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);
});
}
Expand All @@ -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());
Expand Down Expand Up @@ -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());
Expand Down

0 comments on commit 3d6ade2

Please sign in to comment.