Merge branch '70-fix-duplicate-key-in-timetrackaccounts-tabe' into 'master'
Resolve "Fix duplicate key in timetrackAccounts table" Closes #70 See merge request marcel.schwarz/2020ss-qbc-geofence-timetracking!43
This commit is contained in:
commit
7cd4d52138
@ -1,13 +1,11 @@
|
||||
package de.hft.geotime.timetrackaccount;
|
||||
|
||||
import de.hft.geotime.user.TimetrackUser;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.*;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@ -21,5 +19,7 @@ public class TimetrackAccount {
|
||||
private double revenue;
|
||||
private String name;
|
||||
private String description;
|
||||
@ManyToOne
|
||||
private TimetrackUser user;
|
||||
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ public class TimetrackUser {
|
||||
@OneToOne
|
||||
private Role role;
|
||||
|
||||
@OneToMany(fetch = FetchType.LAZY)
|
||||
@OneToMany(mappedBy = "user", fetch = FetchType.LAZY, cascade = CascadeType.ALL)
|
||||
private List<TimetrackAccount> accounts;
|
||||
|
||||
}
|
||||
|
@ -6,10 +6,6 @@ DELETE FROM role;
|
||||
INSERT INTO role (id, `name`) VALUES
|
||||
(1, 'Admin');
|
||||
|
||||
INSERT INTO timetrack_account (id, description, `name`, revenue) VALUES
|
||||
(1, 'Gleitzeit Marcel', 'Primary Marcel', 16.0),
|
||||
(2, 'Festgeld Marcel', 'Secondary Marcel', 25.0);
|
||||
|
||||
/* password is the firstname in lowercase e.g. marcel or tobias
|
||||
https://bcrypt-generator.com/ with 10 rounds
|
||||
*/
|
||||
@ -19,8 +15,8 @@ INSERT INTO timetrack_user (id, firstname, lastname, password, username, role_id
|
||||
(3, 'Tim', 'Zieger' ,'$2y$10$pYGHZhoaelceImO7aIN4nOkWJBp.oqNGFYaRAonHkYF4u9ljqPelC', 'ziti', 1),
|
||||
(4, 'Simon', 'Kellner' ,'$2y$10$Puzm/Nr/Dyq3nQxlkXGIfubS5JPtXJSOf2e6mrQ6HhVYQN9YiQQsC', 'kesi', 1);
|
||||
|
||||
INSERT INTO timetrack_user_accounts (timetrack_user_id, accounts_id) VALUES
|
||||
(1, 1),
|
||||
(1, 2);
|
||||
INSERT INTO timetrack_account (description, `name`, revenue, user_id) VALUES
|
||||
('Gleitzeit Marcel', 'Primary Marcel', 16.0, 1),
|
||||
('Festgeld Marcel', 'Secondary Marcel', 25.0, 1);
|
||||
|
||||
SET FOREIGN_KEY_CHECKS=1;
|
Loading…
Reference in New Issue
Block a user