Some improvements:

* Switches to PostgreSQL
* Added Minio storage
* Added attachments to properties
* Introduced DTOs for improved security
This commit is contained in:
2025-09-03 15:40:26 +02:00
parent 9735f1f398
commit 5eb6b6e738
26 changed files with 879 additions and 67 deletions

View File

@@ -0,0 +1,72 @@
package de.iwomm.propify_api.entity;
import jakarta.persistence.*;
import java.time.LocalDateTime;
import java.util.UUID;
@Entity
public class Attachment {
@Id
@GeneratedValue(strategy = GenerationType.UUID)
@Column(nullable = false)
private UUID id;
@Column(nullable = false)
private String storagePath;
@Column(nullable = false)
private String fileName;
@ManyToOne()
@JoinColumn(name = "property_id")
private Property property;
@Column(nullable = false)
private LocalDateTime createdAt;
@PrePersist
protected void onCreate() {
this.createdAt = LocalDateTime.now();
}
public LocalDateTime getCreatedAt() {
return createdAt;
}
public void setCreatedAt(LocalDateTime createdAt) {
this.createdAt = createdAt;
}
public void setProperty(Property property) {
this.property = property;
}
public Property getProperty() {
return property;
}
public String getStoragePath() {
return storagePath;
}
public void setStoragePath(String storagePath) {
this.storagePath = storagePath;
}
public UUID getId() {
return id;
}
public void setId(UUID id) {
this.id = id;
}
public String getFileName() {
return fileName;
}
public void setFileName(String fileName) {
this.fileName = fileName;
}
}

View File

@@ -1,9 +1,9 @@
package de.iwomm.propify_api.entity;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.Id;
import jakarta.persistence.*;
import java.time.LocalDateTime;
import java.util.List;
import java.util.UUID;
@Entity
@@ -12,16 +12,83 @@ public class Property {
@GeneratedValue
private UUID id;
@Column(nullable = false)
private String name;
@Column(nullable = false)
private String street;
@Column(nullable = false)
private String houseNumber;
@Column(nullable = false)
private String zipCode;
@Column(nullable = false)
private String city;
private String country;
private String notes;
@Column(nullable = false)
private String country;
@OneToMany(mappedBy = "property", orphanRemoval = true)
@OrderBy("fileName")
private List<Attachment> attachments;
@Column(nullable = false)
private LocalDateTime createdAt;
private LocalDateTime updatedAt;
public List<Attachment> getAttachments() {
return attachments;
}
public void setAttachments(List<Attachment> attachment) {
this.attachments = attachment;
}
public Property() {}
public Property(String name, String street, String houseNumber, String zipCode, String city, String country, String notes) {
this.name = name;
this.street = street;
this.houseNumber = houseNumber;
this.zipCode = zipCode;
this.city = city;
this.country = country;
this.notes = notes;
}
@PrePersist
protected void onCreate() {
this.createdAt = LocalDateTime.now();
this.updatedAt = LocalDateTime.now();
}
@PreUpdate
protected void onUpdate() {
this.updatedAt = LocalDateTime.now();
}
public LocalDateTime getCreatedAt() {
return createdAt;
}
public void setCreatedAt(LocalDateTime createdAt) {
this.createdAt = createdAt;
}
public LocalDateTime getUpdatedAt() {
return updatedAt;
}
public void setUpdatedAt(LocalDateTime updatedAt) {
this.updatedAt = updatedAt;
}
public void setId(UUID id) {
this.id = id;
}