Compare commits
18 Commits
35e03269e7
...
dd9c1c7ca2
| Author | SHA1 | Date | |
|---|---|---|---|
| dd9c1c7ca2 | |||
| f9cc735318 | |||
| 2a8eb3c0ad | |||
| 7a4cdb3d1f | |||
| 453b6d1813 | |||
| bd2b5ff62f | |||
| 849de7a204 | |||
| c7423fb6fd | |||
| ad51e4b1eb | |||
| df2ebe0cc2 | |||
| 5c06f287ab | |||
| c3e3a0377d | |||
| cf34a54170 | |||
| 16f48f125b | |||
| e3faa2f570 | |||
| 0d30b5ff87 | |||
| 563375f6e3 | |||
| 3864b0f68b |
17
src/ReC.API/Controllers/CommonController.cs
Normal file
17
src/ReC.API/Controllers/CommonController.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using MediatR;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ReC.Application.Common.Procedures.InsertProcedure;
|
||||
|
||||
namespace ReC.API.Controllers;
|
||||
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class CommonController(IMediator mediator) : ControllerBase
|
||||
{
|
||||
[HttpPost]
|
||||
public async Task<IActionResult> CreateObject([FromBody] InsertObjectProcedure procedure, CancellationToken cancel)
|
||||
{
|
||||
var id = await mediator.Send(procedure, cancel);
|
||||
return StatusCode(StatusCodes.Status201Created, id);
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,6 @@ using ReC.Application.OutResults.Queries;
|
||||
|
||||
namespace ReC.API.Controllers;
|
||||
|
||||
[Obsolete("This controller is deprecated and will be removed in future versions. Use the new ResultViewController instead.")]
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class OutResController(IMediator mediator, IConfiguration config) : ControllerBase
|
||||
@@ -20,7 +19,7 @@ public class OutResController(IMediator mediator, IConfiguration config) : Contr
|
||||
/// <returns>A list of output results matching the query.</returns>
|
||||
[HttpGet]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
public async Task<IActionResult> Get([FromQuery] ReadOutResQuery query, CancellationToken cancel) => Ok(await mediator.Send(query, cancel));
|
||||
public async Task<IActionResult> Get([FromQuery] ReadResultViewQuery query, CancellationToken cancel) => Ok(await mediator.Send(query, cancel));
|
||||
|
||||
/// <summary>
|
||||
/// Gets output results for a fake/test profile.
|
||||
@@ -29,8 +28,7 @@ public class OutResController(IMediator mediator, IConfiguration config) : Contr
|
||||
/// <returns>A list of output results for the fake profile.</returns>
|
||||
[HttpGet("fake")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[Obsolete("Use the related procedure or view.")]
|
||||
public async Task<IActionResult> Get(CancellationToken cancel) => Ok(await mediator.Send(new ReadOutResQuery()
|
||||
public async Task<IActionResult> Get(CancellationToken cancel) => Ok(await mediator.Send(new ReadResultViewQuery()
|
||||
{
|
||||
ProfileId = config.GetFakeProfileId()
|
||||
}, cancel));
|
||||
@@ -44,10 +42,9 @@ public class OutResController(IMediator mediator, IConfiguration config) : Contr
|
||||
/// <returns>The requested output result or a part of it (header/body).</returns>
|
||||
[HttpGet("fake/{actionId}")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[Obsolete("Use the related procedure or view.")]
|
||||
public async Task<IActionResult> Get([FromRoute] long actionId, CancellationToken cancel, ResultType resultType = ResultType.Full)
|
||||
{
|
||||
var res = (await mediator.Send(new ReadOutResQuery()
|
||||
var res = (await mediator.Send(new ReadResultViewQuery()
|
||||
{
|
||||
ProfileId = config.GetFakeProfileId(),
|
||||
ActionId = actionId
|
||||
@@ -69,6 +66,7 @@ public class OutResController(IMediator mediator, IConfiguration config) : Contr
|
||||
/// <returns>An empty response indicating success.</returns>
|
||||
[HttpDelete]
|
||||
[ProducesResponseType(StatusCodes.Status204NoContent)]
|
||||
[Obsolete("Use the related procedure or view.")]
|
||||
public async Task<IActionResult> Delete([FromQuery] DeleteOutResCommand command, CancellationToken cancel)
|
||||
{
|
||||
await mediator.Send(command, cancel);
|
||||
@@ -83,6 +81,7 @@ public class OutResController(IMediator mediator, IConfiguration config) : Contr
|
||||
[HttpDelete("fake")]
|
||||
[ProducesResponseType(StatusCodes.Status204NoContent)]
|
||||
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
||||
[Obsolete("Use the related procedure or view.")]
|
||||
public async Task<IActionResult> Delete(CancellationToken cancel)
|
||||
{
|
||||
await mediator.Send(new DeleteOutResCommand() { ProfileId = config.GetFakeProfileId() }, cancel);
|
||||
|
||||
16
src/ReC.API/Controllers/ProfileController.cs
Normal file
16
src/ReC.API/Controllers/ProfileController.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using MediatR;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ReC.Application.Profile.Queries;
|
||||
|
||||
namespace ReC.API.Controllers;
|
||||
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class ProfileController(IMediator mediator) : ControllerBase
|
||||
{
|
||||
[HttpGet]
|
||||
public async Task<IActionResult> GetProfile([FromQuery] ReadProfileViewQuery query, CancellationToken cancel)
|
||||
{
|
||||
return Ok(await mediator.Send(query, cancel));
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,9 @@
|
||||
using MediatR;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ReC.API.Extensions;
|
||||
using ReC.API.Models;
|
||||
using ReC.Application.Common.Procedures.InsertProcedure;
|
||||
using ReC.Application.RecActions.Commands;
|
||||
using ReC.Application.RecActions.Queries;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace ReC.API.Controllers;
|
||||
|
||||
@@ -72,51 +71,11 @@ public class RecActionController(IMediator mediator, IConfiguration config) : Co
|
||||
/// <returns>An HTTP 201 Created response.</returns>
|
||||
[HttpPost]
|
||||
[ProducesResponseType(StatusCodes.Status201Created)]
|
||||
[Obsolete("Use the related procedure.")]
|
||||
public async Task<IActionResult> CreateAction([FromBody] CreateRecActionCommand command, CancellationToken cancel)
|
||||
public async Task<IActionResult> CreateAction([FromBody] InsertActionProcedure command, CancellationToken cancel)
|
||||
{
|
||||
await mediator.Send(command, cancel);
|
||||
await mediator.ExecuteInsertProcedure(command, config["AddedWho"], cancel);
|
||||
|
||||
return CreatedAtAction(nameof(CreateAction), null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new fake RecAction for testing purposes.
|
||||
/// </summary>
|
||||
/// <param name="cancel">A token to cancel the operation.</param>
|
||||
/// <param name="request">The optional request body and header for the fake action.</param>
|
||||
/// <param name="endpointUri">The target endpoint URI.</param>
|
||||
/// <param name="endpointPath">The optional path to append to the endpoint URI.</param>
|
||||
/// <param name="type">The HTTP method type (e.g., GET, POST).</param>
|
||||
/// <returns>An HTTP 201 Created response.</returns>
|
||||
[HttpPost("fake")]
|
||||
[ProducesResponseType(StatusCodes.Status201Created)]
|
||||
[Obsolete("Use the related procedure.")]
|
||||
public async Task<IActionResult> CreateFakeAction(
|
||||
CancellationToken cancel,
|
||||
[FromBody] FakeRequest? request = null,
|
||||
[FromQuery] string endpointUri = "https://jsonplaceholder.typicode.com/posts",
|
||||
[FromQuery] string? endpointPath = "1",
|
||||
[FromQuery] string type = "GET")
|
||||
{
|
||||
if (endpointPath is not null)
|
||||
endpointUri = new Uri(new Uri(endpointUri.TrimEnd('/') + "/"), endpointPath.TrimStart('/')).ToString();
|
||||
|
||||
var bodyJson = request?.Body is not null ? JsonSerializer.Serialize(request.Body, options: new() { WriteIndented = false }) : null;
|
||||
var headerJson = request?.Header is not null ? JsonSerializer.Serialize(request.Header, options: new() { WriteIndented = false }) : null;
|
||||
|
||||
await mediator.Send(new CreateRecActionCommand()
|
||||
{
|
||||
ProfileId = config.GetFakeProfileId(),
|
||||
EndpointUri = endpointUri,
|
||||
Type = type,
|
||||
BodyQuery = $@"SELECT '{bodyJson ?? "NULL"}' AS REQUEST_BODY;",
|
||||
HeaderQuery = headerJson is not null ? $@"SELECT '{headerJson}' AS REQUEST_HEADER;" : null,
|
||||
Active = true,
|
||||
EndpointAuthId = 4
|
||||
}, cancel);
|
||||
|
||||
return CreatedAtAction(nameof(CreateFakeAction), null);
|
||||
return StatusCode(StatusCodes.Status201Created);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ReC.API.Extensions;
|
||||
using ReC.API.Models;
|
||||
using ReC.Application.OutResults.Commands;
|
||||
using ReC.Application.Common.Procedures.InsertProcedure;
|
||||
using ReC.Application.OutResults.Queries;
|
||||
|
||||
namespace ReC.API.Controllers;
|
||||
@@ -41,9 +41,9 @@ public class ResultViewController(IMediator mediator, IConfiguration config) : C
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<IActionResult> Create([FromBody] CreateResultViewCommand command, CancellationToken cancel)
|
||||
public async Task<IActionResult> Create([FromBody] InsertResultProcedure procedure, CancellationToken cancel)
|
||||
{
|
||||
await mediator.Send(command, cancel);
|
||||
return CreatedAtAction(nameof(Get), new { actionId = command.ActionId }, command);
|
||||
await mediator.Send(procedure, cancel);
|
||||
return CreatedAtAction(nameof(Get), new { actionId = procedure.ActionId }, procedure);
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@ namespace ReC.Application.Common.Interfaces;
|
||||
public interface IRecDbContext
|
||||
{
|
||||
#region DbSets
|
||||
[Obsolete("Use Views instead.")]
|
||||
public DbSet<EndpointParam> EndpointParams { get; set; }
|
||||
|
||||
public DbSet<RecActionView> RecActionViews { get; set; }
|
||||
@@ -16,20 +17,26 @@ public interface IRecDbContext
|
||||
|
||||
public DbSet<ResultView> RecResultViews { get; set; }
|
||||
|
||||
[Obsolete("Use Views instead.")]
|
||||
public DbSet<OutRes> OutRes { get; set; }
|
||||
|
||||
public DbSet<HeaderQueryResult> HeaderQueryResults { get; set; }
|
||||
|
||||
public DbSet<BodyQueryResult> BodyQueryResults { get; set; }
|
||||
|
||||
[Obsolete("Use Views instead.")]
|
||||
public DbSet<Connection> Connections { get; set; }
|
||||
|
||||
[Obsolete("Use Views instead.")]
|
||||
public DbSet<Endpoint> Endpoints { get; set; }
|
||||
|
||||
[Obsolete("Use Views instead.")]
|
||||
public DbSet<EndpointAuth> EndpointAuths { get; set; }
|
||||
|
||||
public DbSet<Profile> Profiles { get; set; }
|
||||
[Obsolete("Use Views instead.")]
|
||||
public DbSet<Domain.Entities.Profile> Profiles { get; set; }
|
||||
|
||||
[Obsolete("Use Views instead.")]
|
||||
public DbSet<RecAction> RecActions { get; set; }
|
||||
|
||||
public DbSet<InsertObjectResult> RecResults { get; set; }
|
||||
|
||||
@@ -2,5 +2,5 @@
|
||||
|
||||
public interface IInsertProcedure
|
||||
{
|
||||
public InsertObjectProcedure ToObjectProcedure(string addedWho = "Rec.API");
|
||||
public InsertObjectProcedure ToObjectProcedure(string? addedWho = null);
|
||||
}
|
||||
@@ -16,7 +16,7 @@ public record InsertActionProcedure : IInsertProcedure
|
||||
public string? PostSql { get; set; }
|
||||
public byte? ErrorActionId { get; set; }
|
||||
|
||||
public InsertObjectProcedure ToObjectProcedure(string addedWho = "Rec.API")
|
||||
public InsertObjectProcedure ToObjectProcedure(string? addedWho = null)
|
||||
{
|
||||
return new InsertObjectProcedure
|
||||
{
|
||||
|
||||
@@ -14,7 +14,7 @@ public record InsertEndpointAuthProcedure : IInsertProcedure
|
||||
public string? Domain { get; set; }
|
||||
public string? Workstation { get; set; }
|
||||
|
||||
public InsertObjectProcedure ToObjectProcedure(string addedWho = "Rec.API")
|
||||
public InsertObjectProcedure ToObjectProcedure(string? addedWho = null)
|
||||
{
|
||||
return new InsertObjectProcedure
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ public record InsertEndpointParamsProcedure : IInsertProcedure
|
||||
public string? Key { get; set; }
|
||||
public string? Value { get; set; }
|
||||
|
||||
public InsertObjectProcedure ToObjectProcedure(string addedWho = "Rec.API")
|
||||
public InsertObjectProcedure ToObjectProcedure(string? addedWho = null)
|
||||
{
|
||||
return new InsertObjectProcedure
|
||||
{
|
||||
|
||||
@@ -6,7 +6,7 @@ public record InsertEndpointProcedure : IInsertProcedure
|
||||
public string? Description { get; set; }
|
||||
public string? Uri { get; set; }
|
||||
|
||||
public InsertObjectProcedure ToObjectProcedure(string addedWho = "Rec.API")
|
||||
public InsertObjectProcedure ToObjectProcedure(string? addedWho = null)
|
||||
{
|
||||
return new InsertObjectProcedure
|
||||
{
|
||||
|
||||
@@ -14,9 +14,9 @@ public record InsertObjectProcedure : IRequest<long>
|
||||
|
||||
internal string? AddedWho { get; private set; }
|
||||
|
||||
public InsertObjectProcedure AddedBy(string addedWho)
|
||||
public InsertObjectProcedure AddedBy(string? addedWho = null)
|
||||
{
|
||||
AddedWho = addedWho;
|
||||
AddedWho = addedWho ?? "ReC.API";
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -28,6 +28,14 @@ public record InsertObjectProcedure : IRequest<long>
|
||||
public InsertEndpointParamsProcedure EndpointParams { get; set; } = new();
|
||||
}
|
||||
|
||||
public static class InsertObjectProcedureExtensions
|
||||
{
|
||||
public static Task<long> ExecuteInsertProcedure(this ISender sender, IInsertProcedure procedure, string? addedWho = null, CancellationToken cancel = default)
|
||||
{
|
||||
return sender.Send(procedure.ToObjectProcedure(addedWho ?? "Rec.API"), cancel);
|
||||
}
|
||||
}
|
||||
|
||||
public class InsertObjectProcedureHandler(IRepository repo) : IRequestHandler<InsertObjectProcedure, long>
|
||||
{
|
||||
public async Task<long> Handle(InsertObjectProcedure request, CancellationToken cancel)
|
||||
|
||||
@@ -10,7 +10,7 @@ public record InsertProfileProcedure : IInsertProcedure
|
||||
public byte? LogLevelId { get; set; }
|
||||
public short? LanguageId { get; set; }
|
||||
|
||||
public InsertObjectProcedure ToObjectProcedure(string addedWho = "Rec.API")
|
||||
public InsertObjectProcedure ToObjectProcedure(string? addedWho = null)
|
||||
{
|
||||
return new InsertObjectProcedure
|
||||
{
|
||||
|
||||
@@ -7,12 +7,12 @@ public record InsertResultProcedure : IInsertProcedure
|
||||
public string? Header { get; set; }
|
||||
public string? Body { get; set; }
|
||||
|
||||
public InsertObjectProcedure ToObjectProcedure(string addedWho = "Rec.API")
|
||||
public InsertObjectProcedure ToObjectProcedure(string? addedWho = null)
|
||||
{
|
||||
return new InsertObjectProcedure
|
||||
{
|
||||
Entity = "RESULT",
|
||||
Result = this
|
||||
}.AddedBy(addedWho);
|
||||
}.AddedBy(addedWho ?? "Rec.API");
|
||||
}
|
||||
}
|
||||
@@ -16,11 +16,11 @@ public class InsertObjectProcedureValidator : AbstractValidator<InsertObjectProc
|
||||
// ACTION validation
|
||||
When(x => x.Entity == "ACTION", () =>
|
||||
{
|
||||
RuleFor(x => x.ActionProfileId)
|
||||
RuleFor(x => x.Action.ProfileId)
|
||||
.NotNull()
|
||||
.WithMessage("ACTION requires ActionProfileId (maps to @pACTION_PROFILE_ID).");
|
||||
|
||||
RuleFor(x => x.ActionEndpointId)
|
||||
RuleFor(x => x.Action.EndpointId)
|
||||
.NotNull()
|
||||
.WithMessage("ACTION requires ActionEndpointId (maps to @pACTION_ENDPOINT_ID).");
|
||||
});
|
||||
@@ -28,7 +28,7 @@ public class InsertObjectProcedureValidator : AbstractValidator<InsertObjectProc
|
||||
// ENDPOINT validation
|
||||
When(x => x.Entity == "ENDPOINT", () =>
|
||||
{
|
||||
RuleFor(x => x.EndpointUri)
|
||||
RuleFor(x => x.Endpoint.Uri)
|
||||
.NotEmpty()
|
||||
.WithMessage("ENDPOINT requires EndpointUri (maps to @pENDPOINT_URI).")
|
||||
.MaximumLength(2000);
|
||||
@@ -37,28 +37,28 @@ public class InsertObjectProcedureValidator : AbstractValidator<InsertObjectProc
|
||||
// PROFILE validation
|
||||
When(x => x.Entity == "PROFILE", () =>
|
||||
{
|
||||
RuleFor(x => x.ProfileName)
|
||||
RuleFor(x => x.Profile.Name)
|
||||
.NotEmpty()
|
||||
.WithMessage("PROFILE requires ProfileName (maps to @pPROFILE_NAME).")
|
||||
.MaximumLength(50);
|
||||
|
||||
RuleFor(x => x.ProfileMandantor)
|
||||
RuleFor(x => x.Profile.Mandantor)
|
||||
.MaximumLength(50)
|
||||
.When(x => x.ProfileMandantor != null);
|
||||
.When(x => x.Profile.Mandantor != null);
|
||||
|
||||
RuleFor(x => x.ProfileDescription)
|
||||
RuleFor(x => x.Profile.Description)
|
||||
.MaximumLength(250)
|
||||
.When(x => x.ProfileDescription != null);
|
||||
.When(x => x.Profile.Description != null);
|
||||
});
|
||||
|
||||
// RESULT validation
|
||||
When(x => x.Entity == "RESULT", () =>
|
||||
{
|
||||
RuleFor(x => x.ResultActionId)
|
||||
RuleFor(x => x.Result.ActionId)
|
||||
.NotNull()
|
||||
.WithMessage("RESULT requires ResultActionId (maps to @pRESULT_ACTION_ID).");
|
||||
|
||||
RuleFor(x => x.ResultStatusId)
|
||||
RuleFor(x => x.Result.StatusId)
|
||||
.NotNull()
|
||||
.WithMessage("RESULT requires ResultStatusId (maps to @pRESULT_STATUS_ID).");
|
||||
});
|
||||
@@ -66,7 +66,7 @@ public class InsertObjectProcedureValidator : AbstractValidator<InsertObjectProc
|
||||
// ENDPOINT_PARAMS validation
|
||||
When(x => x.Entity == "ENDPOINT_PARAMS", () =>
|
||||
{
|
||||
RuleFor(x => x.EndpointParamsGroupId)
|
||||
RuleFor(x => x.EndpointParams.GroupId)
|
||||
.NotNull()
|
||||
.WithMessage("ENDPOINT_PARAMS requires EndpointParamsGroupId (maps to @pENDPOINT_PARAMS_GROUP_ID).");
|
||||
});
|
||||
@@ -76,12 +76,12 @@ public class InsertObjectProcedureValidator : AbstractValidator<InsertObjectProc
|
||||
.MaximumLength(50)
|
||||
.When(x => x.AddedWho != null);
|
||||
|
||||
RuleFor(x => x.EndpointDescription)
|
||||
RuleFor(x => x.Endpoint.Description)
|
||||
.MaximumLength(250)
|
||||
.When(x => x.EndpointDescription != null);
|
||||
.When(x => x.Endpoint.Description != null);
|
||||
|
||||
RuleFor(x => x.EndpointAuthDescription)
|
||||
RuleFor(x => x.EndpointAuth.Description)
|
||||
.MaximumLength(250)
|
||||
.When(x => x.EndpointAuthDescription != null);
|
||||
.When(x => x.EndpointAuth.Description != null);
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ using System.Text.Json.Serialization;
|
||||
|
||||
namespace ReC.Application.OutResults.Commands;
|
||||
|
||||
[Obsolete("Use the related procedure or view.")]
|
||||
public class CreateResultViewCommand : IAuthScoped, IRequest
|
||||
{
|
||||
public required long ActionId { get; set; }
|
||||
@@ -20,6 +21,7 @@ public class CreateResultViewCommand : IAuthScoped, IRequest
|
||||
public AuthScope Scope { get; } = new();
|
||||
}
|
||||
|
||||
[Obsolete("Use the related procedure or view.")]
|
||||
public class CreateResultViewCommandHandler(IRepository<ResultView> repo) : IRequestHandler<CreateResultViewCommand>
|
||||
{
|
||||
public Task Handle(CreateResultViewCommand request, CancellationToken cancel) => repo.CreateAsync(request, cancel);
|
||||
|
||||
36
src/ReC.Application/Profile/Queries/ReadProfileViewQuery.cs
Normal file
36
src/ReC.Application/Profile/Queries/ReadProfileViewQuery.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using AutoMapper;
|
||||
using DigitalData.Core.Abstraction.Application.Repository;
|
||||
using DigitalData.Core.Exceptions;
|
||||
using MediatR;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using ReC.Application.Common.Dto;
|
||||
using ReC.Domain.Views;
|
||||
|
||||
namespace ReC.Application.Profile.Queries;
|
||||
|
||||
public record ReadProfileViewQuery : IRequest<IEnumerable<ProfileViewDto>>
|
||||
{
|
||||
public long? Id { get; init; } = null;
|
||||
|
||||
public bool IncludeActions { get; init; } = true;
|
||||
}
|
||||
|
||||
public class ReadProfileViewQueryHandler(IRepository<ProfileView> repo, IMapper mapper)
|
||||
: IRequestHandler<ReadProfileViewQuery, IEnumerable<ProfileViewDto>>
|
||||
{
|
||||
public async Task<IEnumerable<ProfileViewDto>> Handle(ReadProfileViewQuery request, CancellationToken cancel)
|
||||
{
|
||||
var query = request.IncludeActions
|
||||
? repo.Query.Include(p => p.Actions)
|
||||
: repo.Query;
|
||||
|
||||
if (request.Id is long id)
|
||||
query = query.Where(p => p.Id == id);
|
||||
|
||||
var profiles = await query.ToListAsync(cancel);
|
||||
|
||||
return profiles is null || profiles.Count == 0
|
||||
? throw new NotFoundException($"Profile {request.Id} not found.")
|
||||
: mapper.Map<IEnumerable<ProfileViewDto>>(profiles);
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ using ReC.Application.Common;
|
||||
using ReC.Application.Common.Constants;
|
||||
using ReC.Application.Common.Dto;
|
||||
using ReC.Application.Common.Exceptions;
|
||||
using ReC.Application.Common.Procedures.InsertProcedure;
|
||||
using ReC.Application.OutResults.Commands;
|
||||
using ReC.Domain.Constants;
|
||||
using System.Net;
|
||||
@@ -133,14 +134,13 @@ public class InvokeRecActionViewCommandHandler(
|
||||
|
||||
var statusCode = (short)response.StatusCode;
|
||||
|
||||
await sender.Send(new CreateOutResCommand
|
||||
await sender.ExecuteInsertProcedure(new InsertResultProcedure()
|
||||
{
|
||||
Status = statusCode,
|
||||
StatusId = statusCode,
|
||||
ActionId = action.Id,
|
||||
Header = JsonSerializer.Serialize(resHeaders, options: new() { WriteIndented = false }),
|
||||
Body = resBody,
|
||||
AddedWho = config?["AddedWho"]
|
||||
}, cancel);
|
||||
Body = resBody
|
||||
}, config?["AddedWho"], cancel);
|
||||
|
||||
return response.IsSuccessStatusCode;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace ReC.Domain.Entities;
|
||||
|
||||
[Obsolete("Use Views instead.")]
|
||||
[Table("TBDD_CONNECTION")]
|
||||
public class Connection
|
||||
{
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace ReC.Domain.Entities;
|
||||
|
||||
[Obsolete("Use Views instead.")]
|
||||
[Table("TBREC_CFG_ENDPOINT")]
|
||||
public class Endpoint
|
||||
{
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace ReC.Domain.Entities;
|
||||
|
||||
[Obsolete("Use Views instead.")]
|
||||
[Table("TBREC_CFG_ENDPOINT_AUTH")]
|
||||
public class EndpointAuth
|
||||
{
|
||||
|
||||
@@ -7,6 +7,7 @@ namespace ReC.Domain.Entities;
|
||||
/// All properties are nullable to provide flexibility on the database side,
|
||||
/// preventing breaking changes if columns are altered to be nullable in production.
|
||||
/// </summary>
|
||||
[Obsolete("Use Views instead.")]
|
||||
[Table("TBREC_CFG_ENDPOINT_PARAMS", Schema = "dbo")]
|
||||
public class EndpointParam
|
||||
{
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace ReC.Domain.Entities;
|
||||
|
||||
[Obsolete("Use Views instead.")]
|
||||
[Table("TBREC_OUT_RESULT", Schema = "dbo")]
|
||||
public class OutRes
|
||||
{
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace ReC.Domain.Entities;
|
||||
|
||||
[Obsolete("Use Views instead.")]
|
||||
[Table("TBREC_CFG_PROFILE", Schema = "dbo")]
|
||||
public class Profile
|
||||
{
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace ReC.Domain.Entities;
|
||||
|
||||
[Obsolete("Use Views instead.")]
|
||||
[Table("TBREC_CFG_ACTION")]
|
||||
public class RecAction
|
||||
{
|
||||
|
||||
@@ -23,7 +23,11 @@ public static class DependencyInjection
|
||||
|
||||
services.AddScoped<IRecDbContext>(provider => provider.GetRequiredService<TRecDbContext>());
|
||||
|
||||
services.AddDbRepository(opt => opt.RegisterFromAssembly<TRecDbContext>(typeof(RecActionView).Assembly));
|
||||
services.AddDbRepository(opt =>
|
||||
{
|
||||
opt.RegisterFromAssembly<TRecDbContext>(typeof(RecActionView).Assembly);
|
||||
opt.RegisterDefaultRepository<TRecDbContext>();
|
||||
});
|
||||
|
||||
services.AddValidatorsFromAssembly(typeof(AuthScopedValidator).Assembly);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user