Add Role, TimeRecord, TimetrackAccount and RecordType
Update User to have Roles and TimetrackAccounts
This commit is contained in:
parent
60f069b635
commit
92de6cc6f4
@ -0,0 +1,6 @@
|
||||
package de.hft.geotime.entities;
|
||||
|
||||
public enum RecordType {
|
||||
BREAK,
|
||||
PAID
|
||||
}
|
24
backend/src/main/java/de/hft/geotime/entities/Role.java
Normal file
24
backend/src/main/java/de/hft/geotime/entities/Role.java
Normal file
@ -0,0 +1,24 @@
|
||||
package de.hft.geotime.entities;
|
||||
|
||||
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;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Entity
|
||||
public class Role {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.AUTO)
|
||||
private long id;
|
||||
private String name;
|
||||
// TODO: Permission List
|
||||
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package de.hft.geotime.entities;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.hibernate.type.TimeType;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.OneToOne;
|
||||
import java.time.Duration;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Entity
|
||||
public class TimeRecord {
|
||||
@Id
|
||||
private long id;
|
||||
@OneToOne
|
||||
private TimetrackAccount account;
|
||||
private Date startdate;
|
||||
private Date enddate;
|
||||
private Duration time;
|
||||
private RecordType type;
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package de.hft.geotime.entities;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.persistence.*;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Entity
|
||||
public class TimetrackAccount {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.AUTO)
|
||||
private long id;
|
||||
@OneToOne
|
||||
private User user;
|
||||
private double revenue;
|
||||
private String name;
|
||||
private String description;
|
||||
}
|
@ -4,10 +4,8 @@ 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.*;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@ -21,7 +19,9 @@ public class User {
|
||||
private String username;
|
||||
private String firstname;
|
||||
private String lastname;
|
||||
//TODO: roleid(FK)
|
||||
//TODO: timetrackaccounts[List]
|
||||
@OneToMany
|
||||
private List<Role> roles;
|
||||
@OneToMany
|
||||
private List<TimetrackAccount> timetrackAccounts;
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user