diff --git a/backend/src/main/java/de/hft/geotime/entities/RecordType.java b/backend/src/main/java/de/hft/geotime/entities/RecordType.java new file mode 100644 index 0000000..5f3a684 --- /dev/null +++ b/backend/src/main/java/de/hft/geotime/entities/RecordType.java @@ -0,0 +1,6 @@ +package de.hft.geotime.entities; + +public enum RecordType { + BREAK, + PAID +} diff --git a/backend/src/main/java/de/hft/geotime/entities/Role.java b/backend/src/main/java/de/hft/geotime/entities/Role.java new file mode 100644 index 0000000..31bc9df --- /dev/null +++ b/backend/src/main/java/de/hft/geotime/entities/Role.java @@ -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 + +} diff --git a/backend/src/main/java/de/hft/geotime/entities/TimeRecord.java b/backend/src/main/java/de/hft/geotime/entities/TimeRecord.java new file mode 100644 index 0000000..6a1cb94 --- /dev/null +++ b/backend/src/main/java/de/hft/geotime/entities/TimeRecord.java @@ -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; +} diff --git a/backend/src/main/java/de/hft/geotime/entities/TimetrackAccount.java b/backend/src/main/java/de/hft/geotime/entities/TimetrackAccount.java new file mode 100644 index 0000000..b262bdc --- /dev/null +++ b/backend/src/main/java/de/hft/geotime/entities/TimetrackAccount.java @@ -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; +} diff --git a/backend/src/main/java/de/hft/geotime/entities/User.java b/backend/src/main/java/de/hft/geotime/entities/User.java index 0a3ee10..40fed8a 100644 --- a/backend/src/main/java/de/hft/geotime/entities/User.java +++ b/backend/src/main/java/de/hft/geotime/entities/User.java @@ -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 roles; + @OneToMany + private List timetrackAccounts; }