Implement skeleton for patch document
This commit is contained in:
@ -0,0 +1,20 @@
|
||||
package ch.dlmw.swisssignchallenge.controllers;
|
||||
|
||||
import ch.dlmw.swisssignchallenge.services.SigningRequestDocumentService;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.openapitools.api.SigningRequestDocumentApi;
|
||||
import org.openapitools.model.PatchSigningRequestDocumentRequest;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
public class SigningRequestDocumentController implements SigningRequestDocumentApi {
|
||||
private final SigningRequestDocumentService signingRequestDocumentService;
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Void> patchSigningRequestDocument(String id, PatchSigningRequestDocumentRequest patchSigningRequestDocumentRequest) {
|
||||
signingRequestDocumentService.patchSigningRequestDocument(id, patchSigningRequestDocumentRequest);
|
||||
return ResponseEntity.noContent().build();
|
||||
}
|
||||
}
|
@ -63,8 +63,8 @@ public class JwtRequestFilter extends OncePerRequestFilter {
|
||||
filterChain.doFilter(request, response);
|
||||
} catch (Exception e) {
|
||||
response.setContentType("application/json");
|
||||
response.setStatus(HttpStatus.BAD_REQUEST.value());
|
||||
response.getWriter().write(objectMapper.writeValueAsString(new ErrorResponse("Couldn't authenticate", HttpStatus.BAD_REQUEST.value())));
|
||||
response.setStatus(HttpStatus.UNAUTHORIZED.value());
|
||||
response.getWriter().write(objectMapper.writeValueAsString(new ErrorResponse("Couldn't authenticate", HttpStatus.UNAUTHORIZED.value())));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,7 @@
|
||||
package ch.dlmw.swisssignchallenge.services;
|
||||
|
||||
import org.openapitools.model.PatchSigningRequestDocumentRequest;
|
||||
|
||||
public interface SigningRequestDocumentService {
|
||||
void patchSigningRequestDocument(String id, PatchSigningRequestDocumentRequest patchSigningRequestDocumentRequest);
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package ch.dlmw.swisssignchallenge.services.impl;
|
||||
|
||||
import ch.dlmw.swisssignchallenge.repositories.SigningRequestDocumentRepository;
|
||||
import ch.dlmw.swisssignchallenge.services.SigningRequestDocumentService;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.openapitools.model.PatchSigningRequestDocumentRequest;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class SigningRequestDocumentServiceImpl implements SigningRequestDocumentService {
|
||||
private final SigningRequestDocumentRepository signingRequestDocumentRepository;
|
||||
private final ObjectMapper objectMapper;
|
||||
|
||||
@Override
|
||||
public void patchSigningRequestDocument(String id, PatchSigningRequestDocumentRequest patchSigningRequestDocumentRequest) {
|
||||
var document = signingRequestDocumentRepository.findById(UUID.fromString(id)).orElseThrow();
|
||||
|
||||
System.out.println(document.isConfirmed());
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user