-
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.
added check to see of submission has attachments (#225)
- Loading branch information
1 parent
031d475
commit 46db7a1
Showing
6 changed files
with
88 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,4 +26,6 @@ public class LambdaSubmissionDefinition { | |
|
||
private Integer schemeVersion; | ||
|
||
private boolean hasAttachments; | ||
|
||
} |
57 changes: 57 additions & 0 deletions
57
src/main/java/gov/cabinetoffice/gap/adminbackend/entities/GrantAttachment.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,57 @@ | ||
package gov.cabinetoffice.gap.adminbackend.entities; | ||
|
||
import gov.cabinetoffice.gap.adminbackend.dtos.submission.GrantApplicant; | ||
import gov.cabinetoffice.gap.adminbackend.enums.GrantAttachmentStatus; | ||
import lombok.*; | ||
|
||
import javax.persistence.*; | ||
import java.time.Instant; | ||
import java.util.UUID; | ||
|
||
@Entity | ||
@Table(name = "grant_attachment") | ||
@Getter | ||
@Setter | ||
@ToString | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
@Builder | ||
public class GrantAttachment { | ||
|
||
@Id | ||
@GeneratedValue | ||
@Column(name = "grant_attachment_id") | ||
private UUID id; | ||
|
||
@ManyToOne | ||
@JoinColumn(name = "submission_id", referencedColumnName = "id") | ||
private Submission submission; | ||
|
||
@Column(name = "question_id", nullable = false) | ||
private String questionId; | ||
|
||
@Column(name = "version", nullable = false) | ||
@Builder.Default | ||
private Integer version = 1; | ||
|
||
@Column(name = "created", nullable = false) | ||
@Builder.Default | ||
private Instant created = Instant.now(); | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "created_by", referencedColumnName = "id") | ||
private GrantApplicant createdBy; | ||
|
||
@Column(name = "last_updated", nullable = false) | ||
private Instant lastUpdated; | ||
|
||
@Column(name = "status", nullable = false) | ||
@Enumerated(EnumType.STRING) | ||
private GrantAttachmentStatus status; | ||
|
||
@Column(name = "filename", nullable = false) | ||
private String filename; | ||
|
||
@Column(name = "location", nullable = false, columnDefinition = "TEXT") | ||
private String location; | ||
} |
7 changes: 7 additions & 0 deletions
7
src/main/java/gov/cabinetoffice/gap/adminbackend/enums/GrantAttachmentStatus.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,7 @@ | ||
package gov.cabinetoffice.gap.adminbackend.enums; | ||
|
||
public enum GrantAttachmentStatus { | ||
AWAITING_SCAN, | ||
QUARANTINED, | ||
AVAILABLE | ||
} |
12 changes: 12 additions & 0 deletions
12
src/main/java/gov/cabinetoffice/gap/adminbackend/repositories/GrantAttachmentRepository.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,12 @@ | ||
package gov.cabinetoffice.gap.adminbackend.repositories; | ||
|
||
import gov.cabinetoffice.gap.adminbackend.entities.GrantAttachment; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.stereotype.Repository; | ||
|
||
import java.util.UUID; | ||
|
||
@Repository | ||
public interface GrantAttachmentRepository extends JpaRepository<GrantAttachment, UUID> { | ||
boolean existsBySubmissionId(UUID id); | ||
} |
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