This repository has been archived by the owner on Apr 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add attribute attackedFiles to transactions
- Loading branch information
1 parent
d18eab5
commit e3e116c
Showing
4 changed files
with
124 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
src/main/java/de/budgetbuddy/backend/transaction/file/TransactionFile.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package de.budgetbuddy.backend.transaction.file; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnore; | ||
import de.budgetbuddy.backend.transaction.Transaction; | ||
import de.budgetbuddy.backend.user.User; | ||
import jakarta.persistence.*; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
import org.hibernate.annotations.ColumnDefault; | ||
|
||
import java.util.Date; | ||
import java.util.UUID; | ||
|
||
@Entity | ||
@Table(name = "transaction_file", schema = "public") | ||
@Data | ||
@Builder | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class TransactionFile { | ||
|
||
@Id | ||
@GeneratedValue | ||
@Column(columnDefinition = "uuid", updatable = false, nullable = false) | ||
private UUID uuid; | ||
|
||
@JsonIgnore | ||
@ManyToOne | ||
@JoinColumn(name = "owner") | ||
private User owner; | ||
|
||
@JsonIgnore | ||
@ManyToOne | ||
@JoinColumn(name = "transaction") | ||
private Transaction transaction; | ||
|
||
@Column(name = "file_name") | ||
private String fileName; | ||
|
||
@Column(name = "file_size") | ||
private int fileSize; | ||
|
||
@Column(name = "mimetype", length = 20) | ||
private String mimeType; | ||
|
||
@Column(name = "location", length = 100) | ||
private String location; | ||
|
||
@Column(name = "created_at", nullable = false, updatable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP") | ||
@ColumnDefault("CURRENT_TIMESTAMP") | ||
private Date createdAt = new Date(); | ||
|
||
} |
8 changes: 8 additions & 0 deletions
8
src/main/java/de/budgetbuddy/backend/transaction/file/TransactionFileRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package de.budgetbuddy.backend.transaction.file; | ||
|
||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
import java.util.UUID; | ||
|
||
public interface TransactionFileRepository extends JpaRepository<TransactionFile, UUID> { | ||
} |