class DocumentsController {

    @PostMapping(value = "/config/{documentConfigId}/upload", produces = "application/json")
    public RestResult<FileEntryResource> uploadDocument(@PathVariable("projectId") long projectId,
                                                        @PathVariable("documentConfigId") long documentConfigId,
                                                        @RequestHeader(value = "Content-Type", required = false) String contentType,
                                                        @RequestHeader(value = "Content-Length", required = false) String contentLength,
                                                        @RequestParam(value = "filename", required = false) String originalFilename,
                                                        HttpServletRequest request) {

        List<String> validMediaTypesForDocument = documentsService.getValidMediaTypesForDocument(documentConfigId).getSuccess();

        return fileControllerUtils.handleFileUpload(contentType, contentLength, originalFilename,
                fileValidator, validMediaTypesForDocument, maxFileSizeBytesForProjectSetupDocuments, request,
                (fileAttributes, inputStreamSupplier) ->
                        documentsService.createDocumentFileEntry(projectId, documentConfigId, fileAttributes.toFileEntryResource(), inputStreamSupplier));
    }

    public  DocumentsController();

}