|
|
@@ -1,125 +1,133 @@
|
|
|
-using System;
|
|
|
-using System.Threading.Tasks;
|
|
|
-using BO.AppServer.Business.Services;
|
|
|
-using BO.AppServer.Metadata.Dto;
|
|
|
-using BO.AppServer.Metadata.Enums;
|
|
|
-using Microsoft.AspNetCore.Authorization;
|
|
|
-using Microsoft.AspNetCore.Http;
|
|
|
-using Microsoft.AspNetCore.Mvc;
|
|
|
-using Microsoft.Extensions.Logging;
|
|
|
-using Quadarax.Foundation.Core.Data.Interface.Entity.Dto;
|
|
|
-
|
|
|
-namespace BO.AppServer.Web.Services
|
|
|
-{
|
|
|
- [Authorize]
|
|
|
- [Route("api/[controller]")]
|
|
|
- [ApiController]
|
|
|
- public class PSController : Base<PSController>
|
|
|
+using System;
|
|
|
+using System.Threading.Tasks;
|
|
|
+using BO.AppServer.Business.Services;
|
|
|
+using BO.AppServer.Metadata.Dto;
|
|
|
+using BO.AppServer.Metadata.Enums;
|
|
|
+using Microsoft.AspNetCore.Authorization;
|
|
|
+using Microsoft.AspNetCore.Http;
|
|
|
+using Microsoft.AspNetCore.Mvc;
|
|
|
+using Microsoft.Extensions.Logging;
|
|
|
+using Quadarax.Foundation.Core.Data.Interface.Entity.Dto;
|
|
|
+
|
|
|
+namespace BO.AppServer.Web.Services
|
|
|
+{
|
|
|
+ [Authorize]
|
|
|
+ [Route("api/[controller]")]
|
|
|
+ [ApiController]
|
|
|
+ public class PSController : Base<PSController>
|
|
|
{
|
|
|
- #region *** Properties ***
|
|
|
+ #region *** Properties ***
|
|
|
protected override RoleEnum LoginRoleAllowed => RoleEnum.System;
|
|
|
- #endregion
|
|
|
+ #endregion
|
|
|
|
|
|
- #region *** Private fields ***
|
|
|
+ #region *** Private fields ***
|
|
|
private DocumentService _srvDocument;
|
|
|
- #endregion
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region *** Constructors ***
|
|
|
+
|
|
|
+ public PSController(ILoggerFactory logger, AccessService srvAccess) : base(logger, srvAccess)
|
|
|
+ {
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region *** Registrations ***
|
|
|
+ [HttpPost("{ticket}/register")]
|
|
|
+ public async Task<ResultValueDto<RegistrationRDto>> Register(string ticket, [FromBody] RegistrationCDto registration)
|
|
|
+ {
|
|
|
+ CheckAccess(ticket);
|
|
|
+ //return await Call(async () => await _srvUsers.CreateUserAsync(user));
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ [HttpPatch("{ticket}/register")]
|
|
|
+ public async Task<ResultValueDto<RegistrationRDto>> Register(string ticket, [FromBody] RegistrationUDto registration)
|
|
|
+ {
|
|
|
+ CheckAccess(ticket);
|
|
|
+ //return await Call(async () => await _srvUsers.CreateUserAsync(user));
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ [HttpGet("{ticket}/register")]
|
|
|
+ public async Task<ResultValueDto<RegistrationRDto>> RegisterEnsure(string ticket, [FromBody] RegistrationCDto registration)
|
|
|
+ {
|
|
|
+ CheckAccess(ticket);
|
|
|
+ //return await Call(async () => await _srvUsers.CreateUserAsync(user));
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
|
|
|
- #region *** Constructors ***
|
|
|
+ #region *** Document gathering ***
|
|
|
+ [HttpGet("{ticket}/queue/{registrationId}/pending")]
|
|
|
+ public async Task<ResultsValueDto<DocumentRDto>> GetQueueNew(string ticket, long registrationId)
|
|
|
+ {
|
|
|
+ CheckAccess(ticket);
|
|
|
+ //return await Call(async () => await _srvUsers.CreateUserAsync(user));
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ [HttpGet("{ticket}/queue/{registrationId}/working")]
|
|
|
+ public async Task<ResultsValueDto<DocumentRDto>> GetQueuePending(string ticket, long registrationId)
|
|
|
+ {
|
|
|
+ CheckAccess(ticket);
|
|
|
+ //return await Call(async () => await _srvUsers.CreateUserAsync(user));
|
|
|
+ return null;
|
|
|
+ }
|
|
|
|
|
|
- public PSController(ILoggerFactory logger, AccessService srvAccess) : base(logger, srvAccess)
|
|
|
- {
|
|
|
+ [HttpGet("{ticket}/queue/{registrationId}/document/{documentId}/artifact/{artifactId}")]
|
|
|
+ public async Task<IActionResult> GetDocumentArtifactContent(string ticket, long documentId, long artifactId)
|
|
|
+ {
|
|
|
+ // TODO: May wrap to better way
|
|
|
+ try
|
|
|
+ {
|
|
|
+ CheckAccess(ticket);
|
|
|
+ //var id = await _srvWorkspace.GetWorkspaceIdByAPIAccess(wrkspApiKey, apiKeyPassword, context);
|
|
|
+ //var content = await _srvDocument.GetArtifactAsync(id, documentId, artifactId);
|
|
|
+ //return new FileStreamResult(content.Item1, content.Item2);
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ catch (Exception e)
|
|
|
+ {
|
|
|
+ return Problem(e.Message);
|
|
|
+ }
|
|
|
}
|
|
|
- #endregion
|
|
|
|
|
|
- #region *** Registrations ***
|
|
|
- [HttpPost("{ticket}/register")]
|
|
|
- public async Task<ResultValueDto<RegistrationRDto>> Register(string ticket, [FromBody] RegistrationCDto registration)
|
|
|
- {
|
|
|
- CheckAccess(ticket);
|
|
|
- //return await Call(async () => await _srvUsers.CreateUserAsync(user));
|
|
|
- return null;
|
|
|
- }
|
|
|
-
|
|
|
- [HttpPatch("{ticket}/register")]
|
|
|
- public async Task<ResultValueDto<RegistrationRDto>> Register(string ticket, [FromBody] RegistrationUDto registration)
|
|
|
- {
|
|
|
- CheckAccess(ticket);
|
|
|
- //return await Call(async () => await _srvUsers.CreateUserAsync(user));
|
|
|
- return null;
|
|
|
- }
|
|
|
-
|
|
|
- [HttpGet("{ticket}/register")]
|
|
|
- public async Task<ResultValueDto<RegistrationRDto>> RegisterEnsure(string ticket, [FromBody] RegistrationCDto registration)
|
|
|
- {
|
|
|
- CheckAccess(ticket);
|
|
|
- //return await Call(async () => await _srvUsers.CreateUserAsync(user));
|
|
|
- return null;
|
|
|
- }
|
|
|
- #endregion
|
|
|
-
|
|
|
- #region *** Document gathering ***
|
|
|
- [HttpGet("{ticket}/queue/{registrationId}/pending")]
|
|
|
- public async Task<ResultsValueDto<DocumentRDto>> GetQueueNew(string ticket, long registrationId)
|
|
|
- {
|
|
|
- CheckAccess(ticket);
|
|
|
- //return await Call(async () => await _srvUsers.CreateUserAsync(user));
|
|
|
- return null;
|
|
|
- }
|
|
|
- [HttpGet("{ticket}/queue/{registrationId}/working")]
|
|
|
- public async Task<ResultsValueDto<DocumentRDto>> GetQueuePending(string ticket, long registrationId)
|
|
|
- {
|
|
|
- CheckAccess(ticket);
|
|
|
- //return await Call(async () => await _srvUsers.CreateUserAsync(user));
|
|
|
- return null;
|
|
|
- }
|
|
|
-
|
|
|
- [HttpGet("{ticket}/queue/{registrationId}/document/{documentId}/artifact/{artifactId}")]
|
|
|
- public async Task<IActionResult> GetDocumentArtifactContent(string ticket, long documentId, long artifactId)
|
|
|
- {
|
|
|
- // TODO: May wrap to better way
|
|
|
- try
|
|
|
- {
|
|
|
- CheckAccess(ticket);
|
|
|
- //var id = await _srvWorkspace.GetWorkspaceIdByAPIAccess(wrkspApiKey, apiKeyPassword, context);
|
|
|
- //var content = await _srvDocument.GetArtifactAsync(id, documentId, artifactId);
|
|
|
- //return new FileStreamResult(content.Item1, content.Item2);
|
|
|
- return null;
|
|
|
- }
|
|
|
- catch (Exception e)
|
|
|
- {
|
|
|
- return Problem(e.Message);
|
|
|
- }
|
|
|
- }
|
|
|
+ #endregion
|
|
|
|
|
|
- #endregion
|
|
|
+ #region *** Document state operations ***
|
|
|
+ [HttpPatch("{ticket}/queue/{registrationId}/document/{documentId}/status/{status}")]
|
|
|
+ public async Task<ResultValueDto<PingDto>> SetDocumentProcessingStatus(string ticket, long registrationId, long documentId, DocumentStatusEnum status)
|
|
|
+ {
|
|
|
+ CheckAccess(ticket);
|
|
|
+ //return await Call(async () => await _srvUsers.CreateUserAsync(user));
|
|
|
+ return null;
|
|
|
+ }
|
|
|
|
|
|
- #region *** Document state operations ***
|
|
|
- [HttpPatch("{ticket}/queue/{registrationId}/document/{documentId}/status/{status}")]
|
|
|
- public async Task<ResultValueDto<PingDto>> SetDocumentProcessingStatus(string ticket, long registrationId, long documentId, DocumentStatusEnum status)
|
|
|
- {
|
|
|
- CheckAccess(ticket);
|
|
|
- //return await Call(async () => await _srvUsers.CreateUserAsync(user));
|
|
|
- return null;
|
|
|
- }
|
|
|
-
|
|
|
- [HttpGet("{ticket}/queue/{registrationId}/document/{documentId}/status")]
|
|
|
- public async Task<ResultValueDto<PingDto>> GetDocumentProcessingStatus(string ticket, long registrationId, long documentId)
|
|
|
- {
|
|
|
- CheckAccess(ticket);
|
|
|
- //return await Call(async () => await _srvUsers.CreateUserAsync(user));
|
|
|
- return null;
|
|
|
- }
|
|
|
-
|
|
|
- #endregion
|
|
|
+ [HttpGet("{ticket}/queue/{registrationId}/document/{documentId}/status")]
|
|
|
+ public async Task<ResultValueDto<PingDto>> GetDocumentProcessingStatus(string ticket, long registrationId, long documentId)
|
|
|
+ {
|
|
|
+ CheckAccess(ticket);
|
|
|
+ //return await Call(async () => await _srvUsers.CreateUserAsync(user));
|
|
|
+ return null;
|
|
|
+ }
|
|
|
|
|
|
- #region *** Document uploading ***
|
|
|
- [HttpPatch("{ticket}/queue/{registrationId}/document/{documentId}")]
|
|
|
- public async Task<ResultValueDto<ArtifactRDto>> UploadDocumentArtifact(string ticket, long registrationId, long documentId,IFormFile content)
|
|
|
- {
|
|
|
- CheckAccess(ticket);
|
|
|
- //return await Call(async () => await _srvUsers.CreateUserAsync(user));
|
|
|
- return null;
|
|
|
- }
|
|
|
- #endregion
|
|
|
- }
|
|
|
-}
|
|
|
+ [HttpGet("{ticket}/queue/{registrationId}/document/{documentId}/info")]
|
|
|
+ public async Task<ResultValueDto<DocumentRDto>> GetDocumentInfo(string ticket, long registrationId, long documentId)
|
|
|
+ {
|
|
|
+ CheckAccess(ticket);
|
|
|
+ //return await Call(async () => await _srvUsers.CreateUserAsync(user));
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region *** Document uploading ***
|
|
|
+ [HttpPatch("{ticket}/queue/{registrationId}/document/{documentId}")]
|
|
|
+ public async Task<ResultValueDto<ArtifactRDto>> UploadDocumentArtifact(string ticket, long registrationId, long documentId,IFormFile content)
|
|
|
+ {
|
|
|
+ CheckAccess(ticket);
|
|
|
+ //return await Call(async () => await _srvUsers.CreateUserAsync(user));
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
+ }
|
|
|
+}
|