This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
namespace Tnsu.ApprovalRoute.Application.RequestTypes;
|
||||
|
||||
public sealed record RequestTypeDto(int Id, string Name, string PageUrl, string? ListName, string? SiteUrl, string Section);
|
||||
public sealed record RequestTypeDto(int Id, string Name, string PageUrl, string? ListId, string? SiteUrl, string Section);
|
||||
|
||||
public sealed record CreateRequestTypeRequest(string Name, string PageUrl, string? ListName, string? SiteUrl, string Section);
|
||||
public sealed record CreateRequestTypeRequest(string Name, string PageUrl, string? ListId, string? SiteUrl, string Section);
|
||||
|
||||
public sealed record UpdateRequestTypeRequest(string Name, string PageUrl, string? ListName, string? SiteUrl, string Section);
|
||||
public sealed record UpdateRequestTypeRequest(string Name, string PageUrl, string? ListId, string? SiteUrl, string Section);
|
||||
|
||||
public sealed record PatchRequestTypeRequest(string? Name, string? PageUrl, string? ListName, string? SiteUrl, string? Section);
|
||||
public sealed record PatchRequestTypeRequest(string? Name, string? PageUrl, string? ListId, string? SiteUrl, string? Section);
|
||||
|
||||
@@ -12,7 +12,7 @@ public sealed class RequestTypeService(ApprovalRouteDbContext db)
|
||||
{
|
||||
var items = await db.RequestTypes.AsNoTracking()
|
||||
.OrderBy(x => x.Name)
|
||||
.Select(x => new RequestTypeDto(x.Id, x.Name, x.PageUrl, x.ListName, x.SiteUrl, x.Section))
|
||||
.Select(x => new RequestTypeDto(x.Id, x.Name, x.PageUrl, x.ListId, x.SiteUrl, x.Section))
|
||||
.ToListAsync(cancellationToken);
|
||||
|
||||
return Result.Ok<IReadOnlyList<RequestTypeDto>>(items);
|
||||
@@ -29,15 +29,15 @@ public sealed class RequestTypeService(ApprovalRouteDbContext db)
|
||||
|
||||
public async Task<Result<RequestTypeDto>> CreateAsync(CreateRequestTypeRequest request, CancellationToken cancellationToken)
|
||||
{
|
||||
if (!RequestTypeFields.IsListReferenceValid(request.ListName, request.SiteUrl))
|
||||
if (!RequestTypeFields.IsListReferenceValid(request.ListId, request.SiteUrl))
|
||||
return Result.Fail<RequestTypeDto>(new ValidationError(
|
||||
"Имя списка и url сайта SharePoint должны быть заполнены оба вместе или не заполнены вовсе."));
|
||||
"Id списка и url сайта SharePoint должны быть заполнены оба вместе или не заполнены вовсе."));
|
||||
|
||||
var entity = new RequestType
|
||||
{
|
||||
Name = request.Name,
|
||||
PageUrl = request.PageUrl,
|
||||
ListName = request.ListName,
|
||||
ListId = request.ListId,
|
||||
SiteUrl = request.SiteUrl,
|
||||
Section = request.Section
|
||||
};
|
||||
@@ -53,13 +53,13 @@ public sealed class RequestTypeService(ApprovalRouteDbContext db)
|
||||
if (entity is null)
|
||||
return Result.Fail<RequestTypeDto>(new NotFoundError("Тип заявки", id));
|
||||
|
||||
if (!RequestTypeFields.IsListReferenceValid(request.ListName, request.SiteUrl))
|
||||
if (!RequestTypeFields.IsListReferenceValid(request.ListId, request.SiteUrl))
|
||||
return Result.Fail<RequestTypeDto>(new ValidationError(
|
||||
"Имя списка и url сайта SharePoint должны быть заполнены оба вместе или не заполнены вовсе."));
|
||||
"Id списка и url сайта SharePoint должны быть заполнены оба вместе или не заполнены вовсе."));
|
||||
|
||||
entity.Name = request.Name;
|
||||
entity.PageUrl = request.PageUrl;
|
||||
entity.ListName = request.ListName;
|
||||
entity.ListId = request.ListId;
|
||||
entity.SiteUrl = request.SiteUrl;
|
||||
entity.Section = request.Section;
|
||||
await db.SaveChangesAsync(cancellationToken);
|
||||
@@ -73,16 +73,16 @@ public sealed class RequestTypeService(ApprovalRouteDbContext db)
|
||||
if (entity is null)
|
||||
return Result.Fail<RequestTypeDto>(new NotFoundError("Тип заявки", id));
|
||||
|
||||
var listName = request.ListName ?? entity.ListName;
|
||||
var listId = request.ListId ?? entity.ListId;
|
||||
var siteUrl = request.SiteUrl ?? entity.SiteUrl;
|
||||
|
||||
if (!RequestTypeFields.IsListReferenceValid(listName, siteUrl))
|
||||
if (!RequestTypeFields.IsListReferenceValid(listId, siteUrl))
|
||||
return Result.Fail<RequestTypeDto>(new ValidationError(
|
||||
"Имя списка и url сайта SharePoint должны быть заполнены оба вместе или не заполнены вовсе."));
|
||||
"Id списка и url сайта SharePoint должны быть заполнены оба вместе или не заполнены вовсе."));
|
||||
|
||||
entity.Name = request.Name ?? entity.Name;
|
||||
entity.PageUrl = request.PageUrl ?? entity.PageUrl;
|
||||
entity.ListName = listName;
|
||||
entity.ListId = listId;
|
||||
entity.SiteUrl = siteUrl;
|
||||
entity.Section = request.Section ?? entity.Section;
|
||||
await db.SaveChangesAsync(cancellationToken);
|
||||
@@ -102,5 +102,5 @@ public sealed class RequestTypeService(ApprovalRouteDbContext db)
|
||||
return Result.Ok();
|
||||
}
|
||||
|
||||
private static RequestTypeDto ToDto(RequestType e) => new(e.Id, e.Name, e.PageUrl, e.ListName, e.SiteUrl, e.Section);
|
||||
private static RequestTypeDto ToDto(RequestType e) => new(e.Id, e.Name, e.PageUrl, e.ListId, e.SiteUrl, e.Section);
|
||||
}
|
||||
|
||||
@@ -10,8 +10,8 @@ public sealed class CreateRequestTypeRequestValidator : AbstractValidator<Create
|
||||
RuleFor(x => x.PageUrl).NotEmpty().WithMessage("Url страницы обязателен.");
|
||||
RuleFor(x => x.Section).NotEmpty().WithMessage("Раздел обязателен.");
|
||||
RuleFor(x => x)
|
||||
.Must(x => RequestTypeFields.IsListReferenceValid(x.ListName, x.SiteUrl))
|
||||
.WithMessage("Имя списка и url сайта SharePoint должны быть заполнены оба вместе или не заполнены вовсе.");
|
||||
.Must(x => RequestTypeFields.IsListReferenceValid(x.ListId, x.SiteUrl))
|
||||
.WithMessage("Id списка и url сайта SharePoint должны быть заполнены оба вместе или не заполнены вовсе.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,8 +23,8 @@ public sealed class UpdateRequestTypeRequestValidator : AbstractValidator<Update
|
||||
RuleFor(x => x.PageUrl).NotEmpty().WithMessage("Url страницы обязателен.");
|
||||
RuleFor(x => x.Section).NotEmpty().WithMessage("Раздел обязателен.");
|
||||
RuleFor(x => x)
|
||||
.Must(x => RequestTypeFields.IsListReferenceValid(x.ListName, x.SiteUrl))
|
||||
.WithMessage("Имя списка и url сайта SharePoint должны быть заполнены оба вместе или не заполнены вовсе.");
|
||||
.Must(x => RequestTypeFields.IsListReferenceValid(x.ListId, x.SiteUrl))
|
||||
.WithMessage("Id списка и url сайта SharePoint должны быть заполнены оба вместе или не заполнены вовсе.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,6 +43,6 @@ public sealed class PatchRequestTypeRequestValidator : AbstractValidator<PatchRe
|
||||
|
||||
internal static class RequestTypeFields
|
||||
{
|
||||
public static bool IsListReferenceValid(string? listName, string? siteUrl) =>
|
||||
string.IsNullOrWhiteSpace(listName) == string.IsNullOrWhiteSpace(siteUrl);
|
||||
public static bool IsListReferenceValid(string? listId, string? siteUrl) =>
|
||||
string.IsNullOrWhiteSpace(listId) == string.IsNullOrWhiteSpace(siteUrl);
|
||||
}
|
||||
|
||||
+7
-7
@@ -46,9 +46,9 @@ public sealed class TemplateRouteStepService(ApprovalRouteDbContext db)
|
||||
return Result.Fail<TemplateRouteStepDto>(new ValidationError(
|
||||
"Поля условия (field_name, operation, value) должны быть заполнены все вместе или не заполнены вовсе."));
|
||||
|
||||
if (RequiresListName(r.FieldName, r.Operation, r.Value) && string.IsNullOrWhiteSpace(route.RequestType?.ListName))
|
||||
if (RequiresList(r.FieldName, r.Operation, r.Value) && string.IsNullOrWhiteSpace(route.RequestType?.ListId))
|
||||
return Result.Fail<TemplateRouteStepDto>(new ValidationError(
|
||||
"Поля условия (field_name, operation, value) можно указывать только если у типа заявки указано имя списка (list_name)."));
|
||||
"Поля условия (field_name, operation, value) можно указывать только если у типа заявки указано id списка (list_id)."));
|
||||
|
||||
var duplicate = await HasDuplicateAsync(
|
||||
route.Id, r.ExecutorEmail, r.Position, r.ProjectRole, r.HeadType, r.Status, excludeId: null, cancellationToken);
|
||||
@@ -95,9 +95,9 @@ public sealed class TemplateRouteStepService(ApprovalRouteDbContext db)
|
||||
return Result.Fail<TemplateRouteStepDto>(new ValidationError(
|
||||
"Поля условия (field_name, operation, value) должны быть заполнены все вместе или не заполнены вовсе."));
|
||||
|
||||
if (RequiresListName(r.FieldName, r.Operation, r.Value) && string.IsNullOrWhiteSpace(route.RequestType?.ListName))
|
||||
if (RequiresList(r.FieldName, r.Operation, r.Value) && string.IsNullOrWhiteSpace(route.RequestType?.ListId))
|
||||
return Result.Fail<TemplateRouteStepDto>(new ValidationError(
|
||||
"Поля условия (field_name, operation, value) можно указывать только если у типа заявки указано имя списка (list_name)."));
|
||||
"Поля условия (field_name, operation, value) можно указывать только если у типа заявки указано id списка (list_id)."));
|
||||
|
||||
var duplicate = await HasDuplicateAsync(
|
||||
route.Id, r.ExecutorEmail, r.Position, r.ProjectRole, r.HeadType, r.Status, excludeId: entity.Id, cancellationToken);
|
||||
@@ -155,9 +155,9 @@ public sealed class TemplateRouteStepService(ApprovalRouteDbContext db)
|
||||
return Result.Fail<TemplateRouteStepDto>(new ValidationError(
|
||||
"Поля условия (field_name, operation, value) должны быть заполнены все вместе или не заполнены вовсе."));
|
||||
|
||||
if (RequiresListName(fieldName, operation, value) && string.IsNullOrWhiteSpace(route.RequestType?.ListName))
|
||||
if (RequiresList(fieldName, operation, value) && string.IsNullOrWhiteSpace(route.RequestType?.ListId))
|
||||
return Result.Fail<TemplateRouteStepDto>(new ValidationError(
|
||||
"Поля условия (field_name, operation, value) можно указывать только если у типа заявки указано имя списка (list_name)."));
|
||||
"Поля условия (field_name, operation, value) можно указывать только если у типа заявки указано id списка (list_id)."));
|
||||
|
||||
var duplicate = await HasDuplicateAsync(
|
||||
route.Id, executorEmail, position, projectRole, headType, status, excludeId: entity.Id, cancellationToken);
|
||||
@@ -192,7 +192,7 @@ public sealed class TemplateRouteStepService(ApprovalRouteDbContext db)
|
||||
return Result.Ok();
|
||||
}
|
||||
|
||||
private static bool RequiresListName(string? fieldName, ComparisonOperator? operation, string? value) =>
|
||||
private static bool RequiresList(string? fieldName, ComparisonOperator? operation, string? value) =>
|
||||
TemplateRouteStepFields.CountConditionFilled(fieldName, operation, value) > 0;
|
||||
|
||||
private Task<bool> HasDuplicateAsync(
|
||||
|
||||
@@ -5,7 +5,7 @@ public class RequestType
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public string PageUrl { get; set; } = string.Empty;
|
||||
public string? ListName { get; set; }
|
||||
public string? ListId { get; set; }
|
||||
public string? SiteUrl { get; set; }
|
||||
public string Section { get; set; } = string.Empty;
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ public class ApprovalRouteDbContext(DbContextOptions<ApprovalRouteDbContext> opt
|
||||
e.HasKey(x => x.Id);
|
||||
e.Property(x => x.Name).HasMaxLength(256).IsRequired();
|
||||
e.Property(x => x.PageUrl).HasMaxLength(512).IsRequired();
|
||||
e.Property(x => x.ListName).HasMaxLength(256);
|
||||
e.Property(x => x.ListId).HasMaxLength(512);
|
||||
e.Property(x => x.SiteUrl).HasMaxLength(512);
|
||||
e.Property(x => x.Section).HasMaxLength(256).IsRequired();
|
||||
});
|
||||
|
||||
+217
@@ -0,0 +1,217 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
using Tnsu.ApprovalRoute.Infrastructure.Persistence;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Tnsu.ApprovalRoute.Infrastructure.Persistence.Migrations
|
||||
{
|
||||
[DbContext(typeof(ApprovalRouteDbContext))]
|
||||
[Migration("20260803110943_RenameRequestTypeListNameToListId")]
|
||||
partial class RenameRequestTypeListNameToListId
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "10.0.10")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("Tnsu.ApprovalRoute.Domain.Entities.RequestType", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("ListId")
|
||||
.HasMaxLength(512)
|
||||
.HasColumnType("character varying(512)")
|
||||
.HasColumnName("list_id");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("character varying(256)")
|
||||
.HasColumnName("name");
|
||||
|
||||
b.Property<string>("PageUrl")
|
||||
.IsRequired()
|
||||
.HasMaxLength(512)
|
||||
.HasColumnType("character varying(512)")
|
||||
.HasColumnName("page_url");
|
||||
|
||||
b.Property<string>("Section")
|
||||
.IsRequired()
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("character varying(256)")
|
||||
.HasColumnName("section");
|
||||
|
||||
b.Property<string>("SiteUrl")
|
||||
.HasMaxLength(512)
|
||||
.HasColumnType("character varying(512)")
|
||||
.HasColumnName("site_url");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_request_types");
|
||||
|
||||
b.ToTable("request_types", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Tnsu.ApprovalRoute.Domain.Entities.TemplateRoute", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<bool>("ByProject")
|
||||
.HasColumnType("boolean")
|
||||
.HasColumnName("by_project");
|
||||
|
||||
b.Property<Guid?>("CompanyId")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("company_id");
|
||||
|
||||
b.Property<Guid?>("DepartmentId")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("department_id");
|
||||
|
||||
b.Property<int>("RequestTypeId")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("request_type_id");
|
||||
|
||||
b.Property<bool>("RequiresControl")
|
||||
.HasColumnType("boolean")
|
||||
.HasColumnName("requires_control");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_template_routes");
|
||||
|
||||
b.HasIndex("RequestTypeId", "DepartmentId", "CompanyId", "ByProject")
|
||||
.IsUnique()
|
||||
.HasDatabaseName("ix_template_routes_request_type_id_department_id_company_id_by");
|
||||
|
||||
b.ToTable("template_routes", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Tnsu.ApprovalRoute.Domain.Entities.TemplateRouteStep", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<bool>("AllowReassignToOtherApprovers")
|
||||
.HasColumnType("boolean")
|
||||
.HasColumnName("allow_reassign_to_other_approvers");
|
||||
|
||||
b.Property<string>("ExecutorEmail")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("character varying(256)")
|
||||
.HasColumnName("executor_email");
|
||||
|
||||
b.Property<string>("FieldName")
|
||||
.HasMaxLength(128)
|
||||
.HasColumnType("character varying(128)")
|
||||
.HasColumnName("field_name");
|
||||
|
||||
b.Property<string>("HeadType")
|
||||
.HasMaxLength(32)
|
||||
.HasColumnType("character varying(32)")
|
||||
.HasColumnName("head_type");
|
||||
|
||||
b.Property<string>("Operation")
|
||||
.HasMaxLength(32)
|
||||
.HasColumnType("character varying(32)")
|
||||
.HasColumnName("operation");
|
||||
|
||||
b.Property<int>("OrderNo")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("order_no");
|
||||
|
||||
b.Property<string>("Position")
|
||||
.HasMaxLength(128)
|
||||
.HasColumnType("character varying(128)")
|
||||
.HasColumnName("position");
|
||||
|
||||
b.Property<string>("ProjectRole")
|
||||
.HasMaxLength(32)
|
||||
.HasColumnType("character varying(32)")
|
||||
.HasColumnName("project_role");
|
||||
|
||||
b.Property<int>("RouteId")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("route_id");
|
||||
|
||||
b.Property<string>("Status")
|
||||
.IsRequired()
|
||||
.HasMaxLength(32)
|
||||
.HasColumnType("character varying(32)")
|
||||
.HasColumnName("status");
|
||||
|
||||
b.Property<string>("Value")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("character varying(256)")
|
||||
.HasColumnName("value");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_template_route_steps");
|
||||
|
||||
b.HasIndex("RouteId", "OrderNo")
|
||||
.HasDatabaseName("ix_template_route_steps_route_id_order_no");
|
||||
|
||||
b.ToTable("template_route_steps", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Tnsu.ApprovalRoute.Domain.Entities.TemplateRoute", b =>
|
||||
{
|
||||
b.HasOne("Tnsu.ApprovalRoute.Domain.Entities.RequestType", "RequestType")
|
||||
.WithMany("Routes")
|
||||
.HasForeignKey("RequestTypeId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("fk_template_routes_request_types_request_type_id");
|
||||
|
||||
b.Navigation("RequestType");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Tnsu.ApprovalRoute.Domain.Entities.TemplateRouteStep", b =>
|
||||
{
|
||||
b.HasOne("Tnsu.ApprovalRoute.Domain.Entities.TemplateRoute", "Route")
|
||||
.WithMany("Steps")
|
||||
.HasForeignKey("RouteId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("fk_template_route_steps_template_routes_route_id");
|
||||
|
||||
b.Navigation("Route");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Tnsu.ApprovalRoute.Domain.Entities.RequestType", b =>
|
||||
{
|
||||
b.Navigation("Routes");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Tnsu.ApprovalRoute.Domain.Entities.TemplateRoute", b =>
|
||||
{
|
||||
b.Navigation("Steps");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Tnsu.ApprovalRoute.Infrastructure.Persistence.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class RenameRequestTypeListNameToListId : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "list_name",
|
||||
table: "request_types");
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "list_id",
|
||||
table: "request_types",
|
||||
type: "character varying(512)",
|
||||
maxLength: 512,
|
||||
nullable: true);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "list_id",
|
||||
table: "request_types");
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "list_name",
|
||||
table: "request_types",
|
||||
type: "character varying(256)",
|
||||
maxLength: 256,
|
||||
nullable: true);
|
||||
}
|
||||
}
|
||||
}
|
||||
+4
-4
@@ -31,10 +31,10 @@ namespace Tnsu.ApprovalRoute.Infrastructure.Persistence.Migrations
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("ListName")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("character varying(256)")
|
||||
.HasColumnName("list_name");
|
||||
b.Property<string>("ListId")
|
||||
.HasMaxLength(512)
|
||||
.HasColumnType("character varying(512)")
|
||||
.HasColumnName("list_id");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
|
||||
+7
-7
@@ -74,7 +74,7 @@ public sealed class RequestTypeServiceTests(PostgresDatabaseFixture fixture) : I
|
||||
|
||||
// Action
|
||||
var patched = await _service.PatchAsync(
|
||||
created.Value.Id, new PatchRequestTypeRequest(Name: "Patched name", PageUrl: null, ListName: null, SiteUrl: null, Section: null), CancellationToken.None);
|
||||
created.Value.Id, new PatchRequestTypeRequest(Name: "Patched name", PageUrl: null, ListId: null, SiteUrl: null, Section: null), CancellationToken.None);
|
||||
|
||||
// Assert
|
||||
patched.IsSuccess.ShouldBeTrue();
|
||||
@@ -87,7 +87,7 @@ public sealed class RequestTypeServiceTests(PostgresDatabaseFixture fixture) : I
|
||||
{
|
||||
// Action
|
||||
var result = await _service.PatchAsync(
|
||||
999999, new PatchRequestTypeRequest(Name: "X", PageUrl: null, ListName: null, SiteUrl: null, Section: null), CancellationToken.None);
|
||||
999999, new PatchRequestTypeRequest(Name: "X", PageUrl: null, ListId: null, SiteUrl: null, Section: null), CancellationToken.None);
|
||||
|
||||
// Assert
|
||||
result.IsFailed.ShouldBeTrue();
|
||||
@@ -109,8 +109,8 @@ public sealed class RequestTypeServiceTests(PostgresDatabaseFixture fixture) : I
|
||||
fetched.IsFailed.ShouldBeTrue();
|
||||
}
|
||||
|
||||
[Fact(DisplayName = "Создание типа заявки с list_name без site_url возвращает неуспешный результат")]
|
||||
public async Task CreateAsync_ListNameWithoutSiteUrl_ReturnsFailedResult()
|
||||
[Fact(DisplayName = "Создание типа заявки с list_id без site_url возвращает неуспешный результат")]
|
||||
public async Task CreateAsync_ListIdWithoutSiteUrl_ReturnsFailedResult()
|
||||
{
|
||||
// Action
|
||||
var result = await _service.CreateAsync(
|
||||
@@ -120,8 +120,8 @@ public sealed class RequestTypeServiceTests(PostgresDatabaseFixture fixture) : I
|
||||
result.IsFailed.ShouldBeTrue();
|
||||
}
|
||||
|
||||
[Fact(DisplayName = "Создание типа заявки с list_name и site_url успешно")]
|
||||
public async Task CreateAsync_ListNameWithSiteUrl_ReturnsCreatedEntity()
|
||||
[Fact(DisplayName = "Создание типа заявки с list_id и site_url успешно")]
|
||||
public async Task CreateAsync_ListIdWithSiteUrl_ReturnsCreatedEntity()
|
||||
{
|
||||
// Action
|
||||
var created = await _service.CreateAsync(
|
||||
@@ -131,7 +131,7 @@ public sealed class RequestTypeServiceTests(PostgresDatabaseFixture fixture) : I
|
||||
|
||||
// Assert
|
||||
created.IsSuccess.ShouldBeTrue();
|
||||
created.Value.ListName.ShouldBe("Requests");
|
||||
created.Value.ListId.ShouldBe("Requests");
|
||||
created.Value.SiteUrl.ShouldBe("https://tnsukz.sharepoint.com/sites/hrm");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user