Skip to content

Commit

Permalink
feature: Delete salt columns, as they are not needed
Browse files Browse the repository at this point in the history
Task: 86977q49u
  • Loading branch information
KinTrae committed Dec 27, 2024
1 parent 6843272 commit cadbb52
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ public CommandLineRunner initData(RoleRepository roleRepository, UserRepository
user1.setEmail("[email protected]");
user1.setName("Jan");
user1.setSurname("Kos");
user1.setSalt("salt");
user1.setAccountNonLocked(false);
user1.setBirthdate(LocalDate.of(1990, 1, 1));
user1.setCredentialsNonExpired(true);
Expand All @@ -100,7 +99,6 @@ public CommandLineRunner initData(RoleRepository roleRepository, UserRepository
admin.setEmail("[email protected]");
admin.setName("Gustaw");
admin.setSurname("Jeleń");
admin.setSalt("salt");
admin.setAccountNonLocked(false);
admin.setBirthdate(LocalDate.of(1980, 1, 1));
admin.setCredentialsNonExpired(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ public void signUpUser(SignUpRequest request) {
.postsPrivacy(publicSettings)
.friendsPrivacy(publicSettings)
.birthdate(request.getBirthdate())
.salt("salt")
.password(passwordEncoder.encode(request.getPassword()))
.role(userRole)
.build();
Expand Down
5 changes: 0 additions & 5 deletions backend/src/main/java/meowhub/backend/users/models/HUser.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,6 @@ public class HUser {
@Column(name = "PASSWORD", nullable = false, length = 120)
private String password;

@Size(max = 20)
@NotNull
@Column(name = "SALT", nullable = false, length = 20)
private String salt;

@NotNull
@Column(name = "BIRTHDATE", nullable = false)
private LocalDate birthdate;
Expand Down
5 changes: 0 additions & 5 deletions backend/src/main/java/meowhub/backend/users/models/User.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,6 @@ public class User {
@Column(name = "PASSWORD", nullable = false, length = 120)
private String password;

@Size(max = 20)
@NotNull
@Column(name = "SALT", nullable = false, length = 20)
private String salt;

@NotNull
@Column(name = "BIRTHDATE", nullable = false)
private LocalDate birthdate;
Expand Down
1 change: 0 additions & 1 deletion database/scripts/120_create_tables.sql
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,6 @@ CREATE TABLE mh_users.Users
login varchar2(20) NOT NULL,
email varchar2(50) NOT NULL,
password varchar2(120) NOT NULL,
salt varchar2(20) NOT NULL,
birthdate date NOT NULL,
gender_id varchar2(36) NOT NULL,
profile_privacy_id varchar2(36) NOT NULL,
Expand Down
1 change: 0 additions & 1 deletion database/scripts/121_create_h_tables.sql
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ CREATE TABLE mh_users.h_users
login varchar2(20) NOT NULL,
email varchar2(50) NOT NULL,
password varchar2(120) NOT NULL,
salt varchar2(20) NOT NULL,
birthdate date NOT NULL,
gender_id varchar2(36) NOT NULL,
profile_privacy_id varchar2(36) NOT NULL,
Expand Down
12 changes: 6 additions & 6 deletions database/scripts/401_create_h_tables_triggers.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ CREATE OR REPLACE TRIGGER mh_users.h_users_trg
FOR EACH ROW
BEGIN
IF INSERTING THEN
INSERT INTO mh_users.h_users (user_id, operation_type, name, surname, login, email, password, salt, birthdate, gender_id, profile_privacy_id, posts_privacy_id, friends_privacy_id, role_id, account_non_locked, credentials_non_expired, credentials_expiry_date, created_at, created_by)
VALUES (:NEW.id,'INSERT', :NEW.name, :NEW.surname, :NEW.login, :NEW.email, :NEW.password, :NEW.salt, :NEW.birthdate, :NEW.gender_id, :NEW.profile_privacy_id, :NEW.posts_privacy_id, :NEW.friends_privacy_id, :NEW.role_id, :NEW.account_non_locked, :NEW.credentials_non_expired, :NEW.credentials_expiry_date, :NEW.created_at, :NEW.created_by);
INSERT INTO mh_users.h_users (user_id, operation_type, name, surname, login, email, password, birthdate, gender_id, profile_privacy_id, posts_privacy_id, friends_privacy_id, role_id, account_non_locked, credentials_non_expired, credentials_expiry_date, created_at, created_by)
VALUES (:NEW.id,'INSERT', :NEW.name, :NEW.surname, :NEW.login, :NEW.email, :NEW.password, :NEW.birthdate, :NEW.gender_id, :NEW.profile_privacy_id, :NEW.posts_privacy_id, :NEW.friends_privacy_id, :NEW.role_id, :NEW.account_non_locked, :NEW.credentials_non_expired, :NEW.credentials_expiry_date, :NEW.created_at, :NEW.created_by);
ELSIF UPDATING THEN
INSERT INTO mh_users.h_users (user_id, operation_type, name, surname, login, email, password, salt, birthdate, gender_id, profile_privacy_id, posts_privacy_id, friends_privacy_id, role_id, account_non_locked, credentials_non_expired, credentials_expiry_date, created_at, created_by)
VALUES (:NEW.id, 'UPDATE', :NEW.name, :NEW.surname, :NEW.login, :NEW.email, :NEW.password, :NEW.salt, :NEW.birthdate, :NEW.gender_id, :NEW.profile_privacy_id, :NEW.posts_privacy_id, :NEW.friends_privacy_id, :NEW.role_id, :NEW.account_non_locked, :NEW.credentials_non_expired, :NEW.credentials_expiry_date, :NEW.created_at, :NEW.created_by);
INSERT INTO mh_users.h_users (user_id, operation_type, name, surname, login, email, password, birthdate, gender_id, profile_privacy_id, posts_privacy_id, friends_privacy_id, role_id, account_non_locked, credentials_non_expired, credentials_expiry_date, created_at, created_by)
VALUES (:NEW.id, 'UPDATE', :NEW.name, :NEW.surname, :NEW.login, :NEW.email, :NEW.password, :NEW.birthdate, :NEW.gender_id, :NEW.profile_privacy_id, :NEW.posts_privacy_id, :NEW.friends_privacy_id, :NEW.role_id, :NEW.account_non_locked, :NEW.credentials_non_expired, :NEW.credentials_expiry_date, :NEW.created_at, :NEW.created_by);
ELSIF DELETING THEN
INSERT INTO mh_users.h_users (user_id, operation_type, name, surname, login, email, password, salt, birthdate, gender_id, profile_privacy_id, posts_privacy_id, friends_privacy_id, role_id, account_non_locked, credentials_non_expired, credentials_expiry_date, created_at, created_by)
VALUES (:OLD.id, 'DELETE', :OLD.name, :OLD.surname, :OLD.login, :OLD.email, :OLD.password, :OLD.salt, :OLD.birthdate, :OLD.gender_id, :OLD.profile_privacy_id, :OLD.posts_privacy_id, :OLD.friends_privacy_id, :OLD.role_id, :OLD.account_non_locked, :OLD.credentials_non_expired, :OLD.credentials_expiry_date, :OLD.created_at, :OLD.created_by);
INSERT INTO mh_users.h_users (user_id, operation_type, name, surname, login, email, password, birthdate, gender_id, profile_privacy_id, posts_privacy_id, friends_privacy_id, role_id, account_non_locked, credentials_non_expired, credentials_expiry_date, created_at, created_by)
VALUES (:OLD.id, 'DELETE', :OLD.name, :OLD.surname, :OLD.login, :OLD.email, :OLD.password, :OLD.birthdate, :OLD.gender_id, :OLD.profile_privacy_id, :OLD.posts_privacy_id, :OLD.friends_privacy_id, :OLD.role_id, :OLD.account_non_locked, :OLD.credentials_non_expired, :OLD.credentials_expiry_date, :OLD.created_at, :OLD.created_by);
END IF;
END;

0 comments on commit cadbb52

Please sign in to comment.