-
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: list file content base64 request (#33)
* feat: list of fileContent in string base64 accepted * refactor: impl using file new dir & update docs * feat!: update Reference WCF to new update Gateway SOAP (file_rename) * feat: added file rename * refactor: add nullable location * feat!: update to new WSDL Gateway-SOAP * feat: file get added
- Loading branch information
1 parent
f755d51
commit 7b07e85
Showing
12 changed files
with
1,291 additions
and
195 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
using Microsoft.AspNetCore.Mvc; | ||
using proxy_net.Adapters; | ||
using proxy_net.Handler; | ||
using proxy_net.Models; | ||
using proxy_net.Repositories.File; | ||
using ServiceReference; | ||
|
||
namespace proxy_net.Controllers.File | ||
{ | ||
[ApiController] | ||
[Route("file")] | ||
public class FileGetControler : ControllerBase | ||
{ | ||
private readonly ILogger<FileGetControler> _logger; | ||
private readonly IFileRepository _fileRepository; | ||
|
||
public FileGetControler(ILogger<FileGetControler> logger, IFileRepository fileRepository) | ||
{ | ||
_logger = logger; | ||
_fileRepository = fileRepository; | ||
} | ||
|
||
[HttpPost("get", Name = "File_Get")] | ||
public async Task<IActionResult> Post([FromBody] reqFile request) | ||
{ | ||
if (request == null || string.IsNullOrEmpty(request.token) || string.IsNullOrEmpty(request.fileUUID)) | ||
{ | ||
return BadRequest(new ResponseError | ||
{ | ||
code = 400, | ||
msg = "El cuerpo de la solicitud es nulo o incompleto", | ||
error = true | ||
}); | ||
} | ||
|
||
var reqFile = new reqFile | ||
{ | ||
fileUUID = request.fileUUID, | ||
token = request.token | ||
}; | ||
|
||
try | ||
{ | ||
file_getResponse response = await _fileRepository.FileGetAsync(reqFile); | ||
if (response?.@return == null) | ||
{ | ||
return NotFound(new ResponseError | ||
{ | ||
code = 404, | ||
msg = "La respuesta del servicio SOAP es nula o inválida.", | ||
error = true | ||
}); | ||
} | ||
|
||
if (response.@return.error) | ||
{ | ||
var adapter = new ResponseAdapter(() => new ResponseError | ||
{ | ||
code = response.@return.code, | ||
msg = response.@return.msg, | ||
error = response.@return.error | ||
}); | ||
|
||
return this.HandleResponseError<IResponse>(adapter); | ||
} | ||
return Ok(new { response.@return.file, response.@return.msg }); | ||
} | ||
catch (Exception ex) | ||
{ | ||
_logger.LogError(ex, "Error en la llamada SOAP."); | ||
throw; | ||
} | ||
} | ||
} | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
using Microsoft.AspNetCore.Mvc; | ||
using proxy_net.Adapters; | ||
using proxy_net.Handler; | ||
using proxy_net.Models; | ||
using proxy_net.Repositories.File; | ||
using ServiceReference; | ||
|
||
namespace proxy_net.Controllers.File | ||
{ | ||
[ApiController] | ||
[Route("file")] | ||
public class FileRenameController : ControllerBase | ||
{ | ||
private readonly ILogger<FileRenameController> _logger; | ||
private readonly IFileRepository _fileRepository; | ||
|
||
public FileRenameController(ILogger<FileRenameController> logger, IFileRepository fileRepository) | ||
{ | ||
_logger = logger; | ||
_fileRepository = fileRepository; | ||
} | ||
|
||
[HttpPost("rename", Name = "File_Rename")] | ||
public async Task<IActionResult> Post([FromBody] reqFileRename reqFileRename) | ||
{ | ||
if (reqFileRename == null || string.IsNullOrEmpty(reqFileRename.fileUUID) | ||
|| string.IsNullOrEmpty(reqFileRename.newName) | ||
|| string.IsNullOrEmpty(reqFileRename.token)) | ||
{ | ||
return BadRequest(new ResponseError | ||
{ | ||
code = 400, | ||
msg = "El cuerpo de la solicitud es nulo o incompleto", | ||
error = true | ||
}); | ||
} | ||
|
||
try | ||
{ | ||
file_renameResponse response = await _fileRepository.FileRenameAsync(reqFileRename); | ||
if (response?.@return == null) | ||
{ | ||
return NotFound(new ResponseError | ||
{ | ||
code = 404, | ||
msg = "La respuesta del servicio SOAP es nula o inválida.", | ||
error = true | ||
}); | ||
} | ||
|
||
if (response.@return.error) | ||
{ | ||
var adapter = new ResponseAdapter(() => new ResponseError | ||
{ | ||
code = response.@return.code, | ||
msg = response.@return.msg, | ||
error = response.@return.error | ||
}); | ||
|
||
return this.HandleResponseError<IResponse>(adapter); | ||
} | ||
return Ok(new { response.@return.msg }); | ||
} | ||
catch (Exception ex) | ||
{ | ||
_logger.LogError(ex, "Error en la llamada SOAP."); | ||
throw; | ||
} | ||
} | ||
} | ||
} |
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
Oops, something went wrong.