Return name only. Path will be calculated from the name and the files will be stored on disk
This commit is contained in:
18
openapi.yml
18
openapi.yml
@ -130,13 +130,27 @@ components:
|
|||||||
properties:
|
properties:
|
||||||
id:
|
id:
|
||||||
type: string
|
type: string
|
||||||
signingRequestDocumentIds:
|
signingRequestDocuments:
|
||||||
type: array
|
type: array
|
||||||
items:
|
items:
|
||||||
type: string
|
$ref: "#/components/schemas/GetSigningRequestResponseSigningRequestDocument"
|
||||||
signed:
|
signed:
|
||||||
type: boolean
|
type: boolean
|
||||||
|
|
||||||
|
GetSigningRequestResponseSigningRequestDocument:
|
||||||
|
type: object
|
||||||
|
required:
|
||||||
|
- id
|
||||||
|
- name
|
||||||
|
- confirmed
|
||||||
|
properties:
|
||||||
|
id:
|
||||||
|
type: string
|
||||||
|
name:
|
||||||
|
type: string
|
||||||
|
confirmed:
|
||||||
|
type: boolean
|
||||||
|
|
||||||
ErrorResponse:
|
ErrorResponse:
|
||||||
type: object
|
type: object
|
||||||
required:
|
required:
|
||||||
|
@ -4,6 +4,7 @@ import ch.dlmw.swisssignchallenge.services.impl.SigningRequestService;
|
|||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import org.openapitools.api.SigningRequestApi;
|
import org.openapitools.api.SigningRequestApi;
|
||||||
import org.openapitools.model.GetSigningRequestResponse;
|
import org.openapitools.model.GetSigningRequestResponse;
|
||||||
|
import org.openapitools.model.GetSigningRequestResponseSigningRequestDocument;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
@ -16,6 +17,14 @@ public class SigningRequestController implements SigningRequestApi {
|
|||||||
var signingRequest = signingRequestService.getSigningRequest(id);
|
var signingRequest = signingRequestService.getSigningRequest(id);
|
||||||
var response = new GetSigningRequestResponse(signingRequest.getId().toString(), signingRequest.isSigned());
|
var response = new GetSigningRequestResponse(signingRequest.getId().toString(), signingRequest.isSigned());
|
||||||
|
|
||||||
|
for (var doc : signingRequest.getDocuments()) {
|
||||||
|
response.addSigningRequestDocumentsItem(new GetSigningRequestResponseSigningRequestDocument(
|
||||||
|
doc.getId().toString(),
|
||||||
|
doc.getName(),
|
||||||
|
doc.isConfirmed()
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
return ResponseEntity.ok(response);
|
return ResponseEntity.ok(response);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,6 @@ package ch.dlmw.swisssignchallenge.entities;
|
|||||||
import jakarta.persistence.*;
|
import jakarta.persistence.*;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import org.hibernate.annotations.Type;
|
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
@ -26,8 +25,4 @@ public class SigningRequestDocument {
|
|||||||
|
|
||||||
@Column(name = "confirmed", nullable = false)
|
@Column(name = "confirmed", nullable = false)
|
||||||
private boolean confirmed;
|
private boolean confirmed;
|
||||||
|
|
||||||
// @Lob
|
|
||||||
// @Column(name = "data", nullable = false, columnDefinition = "BYTEA")
|
|
||||||
// private byte[] data;
|
|
||||||
}
|
}
|
@ -13,6 +13,5 @@ CREATE TABLE signing_request_document (
|
|||||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||||
signing_request_id UUID NOT NULL REFERENCES signing_request(id) ON DELETE CASCADE,
|
signing_request_id UUID NOT NULL REFERENCES signing_request(id) ON DELETE CASCADE,
|
||||||
name VARCHAR(255) NOT NULL,
|
name VARCHAR(255) NOT NULL,
|
||||||
confirmed BOOLEAN NOT NULL DEFAULT FALSE,
|
confirmed BOOLEAN NOT NULL DEFAULT FALSE
|
||||||
data BYTEA NOT NULL
|
|
||||||
);
|
);
|
@ -3,4 +3,7 @@ VALUES ('6313d131-f8b6-41f0-8e1c-c07adc6e0cc1', 'john', '$2a$10$urXz.BOEG0BtbvU7
|
|||||||
|
|
||||||
INSERT INTO signing_request (id, signed)
|
INSERT INTO signing_request (id, signed)
|
||||||
VALUES
|
VALUES
|
||||||
('a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11', FALSE);
|
('a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11', FALSE);
|
||||||
|
|
||||||
|
INSERT INTO signing_request_document (id, signing_request_id, name, confirmed)
|
||||||
|
VALUES ('a618c940-05a5-4396-a379-b42fbf0a8839', 'a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11', 'cv-actual.pdf', false);
|
Reference in New Issue
Block a user