diff --git a/src/Modules/Identity/Application/Commands/BecomePerformerCommand.cs b/src/Modules/Identity/Application/Commands/BecomePerformerCommand.cs index c1f3c41..5b9b231 100644 --- a/src/Modules/Identity/Application/Commands/BecomePerformerCommand.cs +++ b/src/Modules/Identity/Application/Commands/BecomePerformerCommand.cs @@ -1,10 +1,20 @@ using MediatR; using Nashel.BuildingBlocks.Application.Abstractions; +using Nashel.Modules.Identity.Domain.Entities; using Nashel.Modules.Identity.Domain.Repositories; namespace Nashel.Modules.Identity.Application.Commands; -public record BecomePerformerCommand : IRequest; +public record BecomePerformerCommand : IRequest +{ + public string Description { get; init; } = default!; + public List CompetencyNames { get; init; } = default!; + public bool Is24_7 { get; init; } + public bool IsAlwaysReady { get; init; } + public List? WorkingDays { get; init; } + public string? WorkingHoursStart { get; init; } + public string? WorkingHoursEnd { get; init; } +} public class BecomePerformerCommandHandler : IRequestHandler { @@ -25,13 +35,52 @@ public class BecomePerformerCommandHandler : IRequestHandler Competency.Create(name)) + .ToList(); + + // Создаем график работы + WorkSchedule? workSchedule = null; + if (request.Is24_7 || request.IsAlwaysReady || (request.WorkingDays != null && request.WorkingDays.Any())) + { + string? workingDaysJson = null; + string? workingHoursJson = null; + + if (request.WorkingDays != null && request.WorkingDays.Any()) + { + workingDaysJson = System.Text.Json.JsonSerializer.Serialize(request.WorkingDays); + } + + if (!string.IsNullOrEmpty(request.WorkingHoursStart) && !string.IsNullOrEmpty(request.WorkingHoursEnd)) + { + workingHoursJson = System.Text.Json.JsonSerializer.Serialize(new + { + start = request.WorkingHoursStart, + end = request.WorkingHoursEnd + }); + } + + workSchedule = WorkSchedule.Create( + request.Is24_7, + request.IsAlwaysReady, + workingDaysJson, + workingHoursJson + ); + } + + // Обновляем данные исполнителя + account.UpdatePerformerData(request.Description, competencies, workSchedule); + + // Добавляем роль исполнителя account.BecomePerformer(); + await _accountRepository.UpdateAsync(account, cancellationToken); return Unit.Value; diff --git a/src/Modules/Identity/Application/Queries/GetProfile/GetProfileQuery.cs b/src/Modules/Identity/Application/Queries/GetProfile/GetProfileQuery.cs index 297f64b..9099f4d 100644 --- a/src/Modules/Identity/Application/Queries/GetProfile/GetProfileQuery.cs +++ b/src/Modules/Identity/Application/Queries/GetProfile/GetProfileQuery.cs @@ -6,6 +6,14 @@ namespace Nashel.Modules.Identity.Application.Queries.GetProfile; public record GetProfileQuery : IRequest; +public record WorkScheduleResponse( + bool Is24_7, + bool IsAlwaysReady, + List? WorkingDays, + string? WorkingHoursStart, + string? WorkingHoursEnd +); + public record ProfileResponse( Guid Id, string Phone, @@ -18,7 +26,8 @@ public record ProfileResponse( string? Description, string FullName, string? AvatarUrl, - List Competencies); + List Competencies, + WorkScheduleResponse? WorkSchedule); public class GetProfileQueryHandler : IRequestHandler { @@ -51,6 +60,38 @@ public class GetProfileQueryHandler : IRequestHandler>(account.Profile.WorkSchedule.WorkingDays) + : null; + + string? workingHoursStart = null; + string? workingHoursEnd = null; + if (account.Profile.WorkSchedule.WorkingHours != null) + { + var workingHours = System.Text.Json.JsonSerializer.Deserialize(account.Profile.WorkSchedule.WorkingHours); + if (workingHours.TryGetProperty("start", out var start)) + { + workingHoursStart = start.GetString(); + } + if (workingHours.TryGetProperty("end", out var end)) + { + workingHoursEnd = end.GetString(); + } + } + + workScheduleResponse = new WorkScheduleResponse( + account.Profile.WorkSchedule.Is24_7, + account.Profile.WorkSchedule.IsAlwaysReady, + workingDays, + workingHoursStart, + workingHoursEnd + ); + } + return new ProfileResponse( account.Id, account.Phone, @@ -63,6 +104,7 @@ public class GetProfileQueryHandler : IRequestHandler c.Name).ToList()); + account.Profile.Competencies.Select(c => c.Name).ToList(), + workScheduleResponse); } } diff --git a/src/Modules/Identity/Domain/Aggregates/Account.cs b/src/Modules/Identity/Domain/Aggregates/Account.cs index a1e999c..6af3986 100644 --- a/src/Modules/Identity/Domain/Aggregates/Account.cs +++ b/src/Modules/Identity/Domain/Aggregates/Account.cs @@ -1,4 +1,5 @@ using Nashel.BuildingBlocks.Domain; +using Nashel.Modules.Identity.Domain.Entities; using Nashel.Modules.Identity.Domain.Enums; using Nashel.Modules.Identity.Domain.Events; @@ -40,17 +41,17 @@ public class Account : AggregateRoot public void BecomePerformer() { - if (!Roles.Contains(Role.Candidate) && !Roles.Contains(Role.Master)) + if (!Roles.Contains(Role.Newbie) && !Roles.Contains(Role.Master)) { - Roles.Add(Role.Candidate); + Roles.Add(Role.Newbie); } } public void PromoteToMaster() { - if (Roles.Contains(Role.Candidate)) + if (Roles.Contains(Role.Newbie)) { - Roles.Remove(Role.Candidate); + Roles.Remove(Role.Newbie); } if (!Roles.Contains(Role.Master)) @@ -58,4 +59,19 @@ public class Account : AggregateRoot Roles.Add(Role.Master); } } + + public void UpdatePerformerData(string description, IEnumerable competencies, WorkSchedule? workSchedule) + { + Profile.UpdatePerformerData(description, competencies, workSchedule); + } + + public void UpdateWorkSchedule(WorkSchedule workSchedule) + { + Profile.SetWorkSchedule(workSchedule); + } + + public bool IsPerformer() + { + return Roles.Contains(Role.Newbie) || Roles.Contains(Role.Master); + } } diff --git a/src/Modules/Identity/Domain/Aggregates/UserProfile.cs b/src/Modules/Identity/Domain/Aggregates/UserProfile.cs index 99f96ea..fa917ec 100644 --- a/src/Modules/Identity/Domain/Aggregates/UserProfile.cs +++ b/src/Modules/Identity/Domain/Aggregates/UserProfile.cs @@ -17,6 +17,7 @@ public class UserProfile : Entity public string? Description { get; private set; } public string? AvatarUrl { get; private set; } public IReadOnlyCollection Competencies => _competencies.AsReadOnly(); + public WorkSchedule? WorkSchedule { get; private set; } // EF Core constructor private UserProfile() { } @@ -68,4 +69,29 @@ public class UserProfile : Entity _competencies.Clear(); _competencies.AddRange(competencyList); } + + public void UpdatePerformerData(string description, IEnumerable competencies, WorkSchedule? workSchedule) + { + if (string.IsNullOrWhiteSpace(description) || description.Length < 50) + throw new ArgumentException($"Описание должно содержать минимум 50 символов", nameof(description)); + + if (description.Length > MaxDescriptionLength) + throw new ArgumentException($"Описание не может превышать {MaxDescriptionLength} символов", nameof(description)); + + Description = description; + + var competencyList = competencies.ToList(); + if (competencyList.Count > MaxCompetencies) + throw new InvalidOperationException($"Нельзя добавить больше {MaxCompetencies} компетенций"); + + _competencies.Clear(); + _competencies.AddRange(competencyList); + + WorkSchedule = workSchedule; + } + + public void SetWorkSchedule(WorkSchedule workSchedule) + { + WorkSchedule = workSchedule; + } } diff --git a/src/Modules/Identity/Domain/Entities/WorkSchedule.cs b/src/Modules/Identity/Domain/Entities/WorkSchedule.cs new file mode 100644 index 0000000..3712677 --- /dev/null +++ b/src/Modules/Identity/Domain/Entities/WorkSchedule.cs @@ -0,0 +1,49 @@ +namespace Nashel.Modules.Identity.Domain.Entities; + +public class WorkSchedule +{ + public Guid Id { get; private set; } + public bool Is24_7 { get; private set; } + public bool IsAlwaysReady { get; private set; } + public string? WorkingDays { get; private set; } // JSON-массив дней недели: ["Mon", "Tue", ...] + public string? WorkingHours { get; private set; } // JSON: {"start": "09:00", "end": "18:00"} + + // EF Core constructor + private WorkSchedule() { } + + private WorkSchedule(bool is24_7, bool isAlwaysReady, string? workingDays, string? workingHours) + { + Id = Guid.NewGuid(); + Is24_7 = is24_7; + IsAlwaysReady = isAlwaysReady; + WorkingDays = workingDays; + WorkingHours = workingHours; + } + + public static WorkSchedule Create(bool is24_7, bool isAlwaysReady, string? workingDays, string? workingHours) + { + // Если 24/7 или Always Ready, то дни и часы не нужны + if (is24_7 || isAlwaysReady) + { + workingDays = null; + workingHours = null; + } + + return new WorkSchedule(is24_7, isAlwaysReady, workingDays, workingHours); + } + + public void Update(bool is24_7, bool isAlwaysReady, string? workingDays, string? workingHours) + { + // Если 24/7 или Always Ready, то дни и часы не нужны + if (is24_7 || isAlwaysReady) + { + workingDays = null; + workingHours = null; + } + + Is24_7 = is24_7; + IsAlwaysReady = isAlwaysReady; + WorkingDays = workingDays; + WorkingHours = workingHours; + } +} diff --git a/src/Modules/Identity/Domain/Enums/Role.cs b/src/Modules/Identity/Domain/Enums/Role.cs index eaba16a..54f91d2 100644 --- a/src/Modules/Identity/Domain/Enums/Role.cs +++ b/src/Modules/Identity/Domain/Enums/Role.cs @@ -6,7 +6,7 @@ namespace Nashel.Modules.Identity.Domain.Enums; public enum Role { User = 0, - Candidate, + Newbie, Master, Company, Admin diff --git a/src/Modules/Identity/Infrastructure/Persistence/Configurations/UserProfileConfiguration.cs b/src/Modules/Identity/Infrastructure/Persistence/Configurations/UserProfileConfiguration.cs index 480950d..e84dadb 100644 --- a/src/Modules/Identity/Infrastructure/Persistence/Configurations/UserProfileConfiguration.cs +++ b/src/Modules/Identity/Infrastructure/Persistence/Configurations/UserProfileConfiguration.cs @@ -37,6 +37,12 @@ public class UserProfileConfiguration : IEntityTypeConfiguration builder.Property(x => x.AvatarUrl) .HasMaxLength(500); + // Optional 1:1 relationship with WorkSchedule + builder.HasOne(x => x.WorkSchedule) + .WithOne() + .HasForeignKey(x => x.Id) + .OnDelete(DeleteBehavior.Cascade); + // Many-to-Many relationship with Competencies builder.HasMany(x => x.Competencies) .WithMany() diff --git a/src/Modules/Identity/Infrastructure/Persistence/Configurations/WorkScheduleConfiguration.cs b/src/Modules/Identity/Infrastructure/Persistence/Configurations/WorkScheduleConfiguration.cs new file mode 100644 index 0000000..e43cd12 --- /dev/null +++ b/src/Modules/Identity/Infrastructure/Persistence/Configurations/WorkScheduleConfiguration.cs @@ -0,0 +1,27 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Nashel.Modules.Identity.Domain.Entities; + +namespace Nashel.Modules.Identity.Infrastructure.Persistence.Configurations; + +public class WorkScheduleConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("WorkSchedules", "identity"); + + builder.HasKey(x => x.Id); + + builder.Property(x => x.Is24_7) + .IsRequired(); + + builder.Property(x => x.IsAlwaysReady) + .IsRequired(); + + builder.Property(x => x.WorkingDays) + .HasMaxLength(100); // JSON-массив дней недели + + builder.Property(x => x.WorkingHours) + .HasMaxLength(100); // JSON с часами работы + } +} diff --git a/src/Modules/Identity/Infrastructure/Persistence/IdentityDbContext.cs b/src/Modules/Identity/Infrastructure/Persistence/IdentityDbContext.cs index 5c58599..c3365b6 100644 --- a/src/Modules/Identity/Infrastructure/Persistence/IdentityDbContext.cs +++ b/src/Modules/Identity/Infrastructure/Persistence/IdentityDbContext.cs @@ -14,12 +14,14 @@ public class IdentityDbContext : DbContext public DbSet Accounts { get; set; } public DbSet UserProfiles { get; set; } public DbSet Competencies { get; set; } + public DbSet WorkSchedules { get; set; } protected override void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder.ApplyConfiguration(new AccountConfiguration()); modelBuilder.ApplyConfiguration(new UserProfileConfiguration()); modelBuilder.ApplyConfiguration(new CompetencyConfiguration()); + modelBuilder.ApplyConfiguration(new WorkScheduleConfiguration()); base.OnModelCreating(modelBuilder); } } diff --git a/src/Modules/Identity/Infrastructure/Persistence/Migrations/20260216085438_AddWorkScheduleToUserProfile.Designer.cs b/src/Modules/Identity/Infrastructure/Persistence/Migrations/20260216085438_AddWorkScheduleToUserProfile.Designer.cs new file mode 100644 index 0000000..6f59f6b --- /dev/null +++ b/src/Modules/Identity/Infrastructure/Persistence/Migrations/20260216085438_AddWorkScheduleToUserProfile.Designer.cs @@ -0,0 +1,200 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Nashel.Modules.Identity.Infrastructure.Persistence; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace Nashel.Modules.Identity.Infrastructure.Persistence.Migrations +{ + [DbContext(typeof(IdentityDbContext))] + [Migration("20260216085438_AddWorkScheduleToUserProfile")] + partial class AddWorkScheduleToUserProfile + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "10.0.2") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("Nashel.Modules.Identity.Domain.Aggregates.Account", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("PasswordHash") + .IsRequired() + .HasColumnType("text"); + + b.Property("Phone") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("character varying(20)"); + + b.Property("Roles") + .IsRequired() + .HasColumnType("jsonb"); + + b.HasKey("Id"); + + b.HasIndex("Phone") + .IsUnique(); + + b.ToTable("Accounts", "identity"); + }); + + modelBuilder.Entity("Nashel.Modules.Identity.Domain.Aggregates.UserProfile", b => + { + b.Property("Id") + .HasColumnType("uuid"); + + b.Property("AvatarUrl") + .HasMaxLength(500) + .HasColumnType("character varying(500)"); + + b.Property("CompanyName") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("Description") + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); + + b.Property("FirstName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("character varying(100)"); + + b.Property("Inn") + .HasMaxLength(10) + .HasColumnType("character varying(10)"); + + b.Property("LastName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("character varying(100)"); + + b.Property("Patronymic") + .HasMaxLength(100) + .HasColumnType("character varying(100)"); + + b.HasKey("Id"); + + b.ToTable("UserProfiles", "identity"); + }); + + modelBuilder.Entity("Nashel.Modules.Identity.Domain.Entities.Competency", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("character varying(100)"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique() + .HasDatabaseName("IX_Competencies_Name"); + + b.ToTable("Competencies", "identity"); + }); + + modelBuilder.Entity("Nashel.Modules.Identity.Domain.Entities.WorkSchedule", b => + { + b.Property("Id") + .HasColumnType("uuid"); + + b.Property("Is24_7") + .HasColumnType("boolean"); + + b.Property("IsAlwaysReady") + .HasColumnType("boolean"); + + b.Property("WorkingDays") + .HasMaxLength(100) + .HasColumnType("character varying(100)"); + + b.Property("WorkingHours") + .HasMaxLength(100) + .HasColumnType("character varying(100)"); + + b.HasKey("Id"); + + b.ToTable("WorkSchedules", "identity"); + }); + + modelBuilder.Entity("UserProfileCompetencies", b => + { + b.Property("UserProfileId") + .HasColumnType("uuid"); + + b.Property("CompetencyId") + .HasColumnType("uuid"); + + b.HasKey("UserProfileId", "CompetencyId"); + + b.HasIndex("CompetencyId"); + + b.ToTable("UserProfileCompetencies", "identity"); + }); + + modelBuilder.Entity("Nashel.Modules.Identity.Domain.Aggregates.UserProfile", b => + { + b.HasOne("Nashel.Modules.Identity.Domain.Aggregates.Account", null) + .WithOne("Profile") + .HasForeignKey("Nashel.Modules.Identity.Domain.Aggregates.UserProfile", "Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Nashel.Modules.Identity.Domain.Entities.WorkSchedule", b => + { + b.HasOne("Nashel.Modules.Identity.Domain.Aggregates.UserProfile", null) + .WithOne("WorkSchedule") + .HasForeignKey("Nashel.Modules.Identity.Domain.Entities.WorkSchedule", "Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("UserProfileCompetencies", b => + { + b.HasOne("Nashel.Modules.Identity.Domain.Entities.Competency", null) + .WithMany() + .HasForeignKey("CompetencyId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Nashel.Modules.Identity.Domain.Aggregates.UserProfile", null) + .WithMany() + .HasForeignKey("UserProfileId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Nashel.Modules.Identity.Domain.Aggregates.Account", b => + { + b.Navigation("Profile") + .IsRequired(); + }); + + modelBuilder.Entity("Nashel.Modules.Identity.Domain.Aggregates.UserProfile", b => + { + b.Navigation("WorkSchedule"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/Modules/Identity/Infrastructure/Persistence/Migrations/20260216085438_AddWorkScheduleToUserProfile.cs b/src/Modules/Identity/Infrastructure/Persistence/Migrations/20260216085438_AddWorkScheduleToUserProfile.cs new file mode 100644 index 0000000..73aed38 --- /dev/null +++ b/src/Modules/Identity/Infrastructure/Persistence/Migrations/20260216085438_AddWorkScheduleToUserProfile.cs @@ -0,0 +1,46 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Nashel.Modules.Identity.Infrastructure.Persistence.Migrations +{ + /// + public partial class AddWorkScheduleToUserProfile : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "WorkSchedules", + schema: "identity", + columns: table => new + { + Id = table.Column(type: "uuid", nullable: false), + Is24_7 = table.Column(type: "boolean", nullable: false), + IsAlwaysReady = table.Column(type: "boolean", nullable: false), + WorkingDays = table.Column(type: "character varying(100)", maxLength: 100, nullable: true), + WorkingHours = table.Column(type: "character varying(100)", maxLength: 100, nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_WorkSchedules", x => x.Id); + table.ForeignKey( + name: "FK_WorkSchedules_UserProfiles_Id", + column: x => x.Id, + principalSchema: "identity", + principalTable: "UserProfiles", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "WorkSchedules", + schema: "identity"); + } + } +} diff --git a/src/Modules/Identity/Infrastructure/Persistence/Migrations/IdentityDbContextModelSnapshot.cs b/src/Modules/Identity/Infrastructure/Persistence/Migrations/IdentityDbContextModelSnapshot.cs index 041a5a4..9596a70 100644 --- a/src/Modules/Identity/Infrastructure/Persistence/Migrations/IdentityDbContextModelSnapshot.cs +++ b/src/Modules/Identity/Infrastructure/Persistence/Migrations/IdentityDbContextModelSnapshot.cs @@ -109,6 +109,30 @@ namespace Nashel.Modules.Identity.Infrastructure.Persistence.Migrations b.ToTable("Competencies", "identity"); }); + modelBuilder.Entity("Nashel.Modules.Identity.Domain.Entities.WorkSchedule", b => + { + b.Property("Id") + .HasColumnType("uuid"); + + b.Property("Is24_7") + .HasColumnType("boolean"); + + b.Property("IsAlwaysReady") + .HasColumnType("boolean"); + + b.Property("WorkingDays") + .HasMaxLength(100) + .HasColumnType("character varying(100)"); + + b.Property("WorkingHours") + .HasMaxLength(100) + .HasColumnType("character varying(100)"); + + b.HasKey("Id"); + + b.ToTable("WorkSchedules", "identity"); + }); + modelBuilder.Entity("UserProfileCompetencies", b => { b.Property("UserProfileId") @@ -133,6 +157,15 @@ namespace Nashel.Modules.Identity.Infrastructure.Persistence.Migrations .IsRequired(); }); + modelBuilder.Entity("Nashel.Modules.Identity.Domain.Entities.WorkSchedule", b => + { + b.HasOne("Nashel.Modules.Identity.Domain.Aggregates.UserProfile", null) + .WithOne("WorkSchedule") + .HasForeignKey("Nashel.Modules.Identity.Domain.Entities.WorkSchedule", "Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + modelBuilder.Entity("UserProfileCompetencies", b => { b.HasOne("Nashel.Modules.Identity.Domain.Entities.Competency", null) @@ -153,6 +186,11 @@ namespace Nashel.Modules.Identity.Infrastructure.Persistence.Migrations b.Navigation("Profile") .IsRequired(); }); + + modelBuilder.Entity("Nashel.Modules.Identity.Domain.Aggregates.UserProfile", b => + { + b.Navigation("WorkSchedule"); + }); #pragma warning restore 612, 618 } } diff --git a/src/Modules/Identity/Presentation/Endpoints/IdentityEndpoints.cs b/src/Modules/Identity/Presentation/Endpoints/IdentityEndpoints.cs index 5cd9c55..5114bc0 100644 --- a/src/Modules/Identity/Presentation/Endpoints/IdentityEndpoints.cs +++ b/src/Modules/Identity/Presentation/Endpoints/IdentityEndpoints.cs @@ -56,9 +56,18 @@ public static class IdentityEndpoints .WithName("ChangePhone") .WithOpenApi(operation => new(operation) { Summary = "Сменить номер телефона" }); - profileGroup.MapPost("/become-performer", async (ISender sender) => + profileGroup.MapPost("/become-performer", async (BecomePerformerRequest request, ISender sender) => { - await sender.Send(new BecomePerformerCommand()); + await sender.Send(new BecomePerformerCommand + { + Description = request.Description, + CompetencyNames = request.Competencies, + Is24_7 = request.Is24_7, + IsAlwaysReady = request.IsAlwaysReady, + WorkingDays = request.WorkingDays, + WorkingHoursStart = request.WorkingHoursStart, + WorkingHoursEnd = request.WorkingHoursEnd + }); return Results.Ok(); }) .WithName("BecomePerformer") @@ -95,3 +104,12 @@ public static class IdentityEndpoints public record LoginResponse(string AccessToken, string RefreshToken); public record UpdateCompetenciesRequest(List Competencies); +public record BecomePerformerRequest( + string Description, + List Competencies, + bool Is24_7, + bool IsAlwaysReady, + List? WorkingDays, + string? WorkingHoursStart, + string? WorkingHoursEnd +);