diff --git a/src/TimeLogIdentityService/IdentityService.Application/Features/AddAzureInfo/AddAzureInfoCommand.cs b/src/TimeLogIdentityService/IdentityService.Application/Features/AddAzureInfo/AddAzureInfoCommand.cs index cbcb035..9227819 100644 --- a/src/TimeLogIdentityService/IdentityService.Application/Features/AddAzureInfo/AddAzureInfoCommand.cs +++ b/src/TimeLogIdentityService/IdentityService.Application/Features/AddAzureInfo/AddAzureInfoCommand.cs @@ -9,4 +9,4 @@ namespace IdentityService.Application.Features.AddAzureInfo internal class AddAzureInfoCommand { } -} +} \ No newline at end of file diff --git a/src/TimeLogService/TimeLogService.Application/Feature/MessageBroker/Consumer/ProfileUser/ProfileUserConsumer.cs b/src/TimeLogService/TimeLogService.Application/Feature/MessageBroker/Consumer/ProfileUser/ProfileUserConsumer.cs index 148b2c2..b415c58 100644 --- a/src/TimeLogService/TimeLogService.Application/Feature/MessageBroker/Consumer/ProfileUser/ProfileUserConsumer.cs +++ b/src/TimeLogService/TimeLogService.Application/Feature/MessageBroker/Consumer/ProfileUser/ProfileUserConsumer.cs @@ -48,7 +48,7 @@ public async Task Consume(ConsumeContext context) if (organizations.Count > 0) { - await _mediator.Send(new AddOrganizationListCommand(organizations)); + await _mediator.Send(new AddOrganizationListCommand(organizations.AsReadOnly())); } } diff --git a/src/TimeLogService/TimeLogService.Application/Feature/OrganizationAction/Commands/AddOrganizationList/AddOrganizationListCommand.cs b/src/TimeLogService/TimeLogService.Application/Feature/OrganizationAction/Commands/AddOrganizationList/AddOrganizationListCommand.cs index bdb234d..a03a0a5 100644 --- a/src/TimeLogService/TimeLogService.Application/Feature/OrganizationAction/Commands/AddOrganizationList/AddOrganizationListCommand.cs +++ b/src/TimeLogService/TimeLogService.Application/Feature/OrganizationAction/Commands/AddOrganizationList/AddOrganizationListCommand.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Collections.ObjectModel; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -7,4 +8,4 @@ namespace TimeLogService.Application.Feature.OrganizationAction.Commands.AddOrganizationList; -public record class AddOrganizationListCommand(List Organizations) : IRequest; +public record class AddOrganizationListCommand(ReadOnlyCollection Organizations) : IRequest; \ No newline at end of file diff --git a/src/TimeLogService/TimeLogService.Application/Feature/OrganizationAction/Commands/AddOrganizationList/AddOrganizationListCommandHandler.cs b/src/TimeLogService/TimeLogService.Application/Feature/OrganizationAction/Commands/AddOrganizationList/AddOrganizationListCommandHandler.cs index c06e759..54f6a6b 100644 --- a/src/TimeLogService/TimeLogService.Application/Feature/OrganizationAction/Commands/AddOrganizationList/AddOrganizationListCommandHandler.cs +++ b/src/TimeLogService/TimeLogService.Application/Feature/OrganizationAction/Commands/AddOrganizationList/AddOrganizationListCommandHandler.cs @@ -9,4 +9,4 @@ public async Task Handle(AddOrganizationListCommand request, CancellationToken c await _repository.AddRangeAsync(request.Organizations); } } -} +} \ No newline at end of file diff --git a/src/TimeLogService/TimeLogService.Application/Feature/UserAction/Commands/AddUser/AddUserCommandHandler.cs b/src/TimeLogService/TimeLogService.Application/Feature/UserAction/Commands/AddUser/AddUserCommandHandler.cs index 4be2758..a38c9b9 100644 --- a/src/TimeLogService/TimeLogService.Application/Feature/UserAction/Commands/AddUser/AddUserCommandHandler.cs +++ b/src/TimeLogService/TimeLogService.Application/Feature/UserAction/Commands/AddUser/AddUserCommandHandler.cs @@ -5,23 +5,20 @@ namespace TimeLogService.Application.Feature.UserAction.Commands.AddUser { - public class AddUserCommandHandler(IRepository repository, IMapper mapper) : IRequestHandler + public class AddUserCommandHandler(IRepository repository) : IRequestHandler { private readonly IRepository _repository = repository; - private readonly IMapper _mapper = mapper; public async Task Handle(AddUserCommand request, CancellationToken cancellationToken) { - - User user = new() - { - CoreRevision = request.UserProfile!.CoreRevision, - EmailAddress = request.UserProfile!.EmailAddress, - PublicAlias = request.UserProfile!.PublicAlias, - Revision = request.UserProfile!.Revision, - TimeStamp = request.UserProfile!.TimeStamp, - UserId = request.UserProfile!.Id, - }; + User user = new + ( + coreRevision: request.UserProfile!.CoreRevision, + emailAddress: request.UserProfile!.EmailAddress, + publicAlias: request.UserProfile!.PublicAlias, + revision: request.UserProfile!.Revision, + timeStamp: request.UserProfile!.TimeStamp, + userId: request.UserProfile!.Id); await _repository.AddAsync(user); } diff --git a/src/TimeLogService/TimeLogService.Domain/Models/Partials/User.cs b/src/TimeLogService/TimeLogService.Domain/Models/Partials/User.cs new file mode 100644 index 0000000..80bfc56 --- /dev/null +++ b/src/TimeLogService/TimeLogService.Domain/Models/Partials/User.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace TimeLogService.Domain.Models.Dbo; + +public partial class User +{ + public User( + string userId, + string emailAddress, + string publicAlias, + int coreRevision, + DateTime timeStamp, + int revision) + { + UserId = userId; + EmailAddress = emailAddress; + PublicAlias = publicAlias; + CoreRevision = coreRevision; + TimeStamp = timeStamp; + Revision = revision; + } +} \ No newline at end of file diff --git a/src/TimeLogService/TimeLogService.Infrastructure/AionTimeContext/Configurations/UserConfiguration.cs b/src/TimeLogService/TimeLogService.Infrastructure/AionTimeContext/Configurations/UserConfiguration.cs index 27627fa..9b74486 100644 --- a/src/TimeLogService/TimeLogService.Infrastructure/AionTimeContext/Configurations/UserConfiguration.cs +++ b/src/TimeLogService/TimeLogService.Infrastructure/AionTimeContext/Configurations/UserConfiguration.cs @@ -1,24 +1,22 @@ - -namespace TimeLogService.Infrastructure.AionTimeContext.Configurations +namespace TimeLogService.Infrastructure.AionTimeContext.Configurations; + +public partial class UserConfiguration : IEntityTypeConfiguration { - public partial class UserConfiguration : IEntityTypeConfiguration + public void Configure(EntityTypeBuilder builder) { - public void Configure(EntityTypeBuilder builder) - { - _ = builder.ToTable("User"); - - _ = builder.HasIndex(e => e.UserId, "IX_User_UserId").IsUnique(); + _ = builder.ToTable("User"); - _ = builder.Property(e => e.EmailAddress) - .HasMaxLength(50) - .IsUnicode(false); - _ = builder.Property(e => e.PublicAlias).HasMaxLength(100); - _ = builder.Property(e => e.TimeStamp).HasColumnType("datetime"); - _ = builder.Property(e => e.UserId).HasMaxLength(100); + _ = builder.HasIndex(e => e.UserId, "IX_User_UserId").IsUnique(); - OnConfigurePartial(builder); - } + _ = builder.Property(e => e.EmailAddress) + .HasMaxLength(50) + .IsUnicode(false); + _ = builder.Property(e => e.PublicAlias).HasMaxLength(100); + _ = builder.Property(e => e.TimeStamp).HasColumnType("datetime"); + _ = builder.Property(e => e.UserId).HasMaxLength(100); - partial void OnConfigurePartial(EntityTypeBuilder entity); + OnConfigurePartial(builder); } + + partial void OnConfigurePartial(EntityTypeBuilder entity); } \ No newline at end of file diff --git a/src/TimeLogService/TimeLogService.Infrastructure/AionTimeContext/Configurations/WorkItemConfiguration.cs b/src/TimeLogService/TimeLogService.Infrastructure/AionTimeContext/Configurations/WorkItemConfiguration.cs index 90be76a..333026d 100644 --- a/src/TimeLogService/TimeLogService.Infrastructure/AionTimeContext/Configurations/WorkItemConfiguration.cs +++ b/src/TimeLogService/TimeLogService.Infrastructure/AionTimeContext/Configurations/WorkItemConfiguration.cs @@ -1,23 +1,21 @@ - -namespace TimeLogService.Infrastructure.AionTimeContext.Configurations +namespace TimeLogService.Infrastructure.AionTimeContext.Configurations; + +public partial class WorkItemConfiguration : IEntityTypeConfiguration { - public partial class WorkItemConfiguration : IEntityTypeConfiguration + public void Configure(EntityTypeBuilder builder) { - public void Configure(EntityTypeBuilder builder) - { - _ = builder.ToTable("WorkItem"); - - _ = builder.Property(e => e.Discription) - .HasMaxLength(1000) - .IsUnicode(false); + _ = builder.ToTable("WorkItem"); - _ = builder.HasOne(d => d.Project).WithMany(p => p.WorkItems) - .HasForeignKey(d => d.ProjectId) - .HasConstraintName("FKProjectTicket"); + _ = builder.Property(e => e.Discription) + .HasMaxLength(1000) + .IsUnicode(false); - OnConfigurePartial(builder); - } + _ = builder.HasOne(d => d.Project).WithMany(p => p.WorkItems) + .HasForeignKey(d => d.ProjectId) + .HasConstraintName("FKProjectTicket"); - partial void OnConfigurePartial(EntityTypeBuilder entity); + OnConfigurePartial(builder); } + + partial void OnConfigurePartial(EntityTypeBuilder entity); } \ No newline at end of file diff --git a/src/TimeLogService/TimeLogService.Infrastructure/AionTimeContext/TimeLogServiceDataBaseContext.cs b/src/TimeLogService/TimeLogService.Infrastructure/AionTimeContext/TimeLogServiceDataBaseContext.cs index 1cafe01..42ea60b 100644 --- a/src/TimeLogService/TimeLogService.Infrastructure/AionTimeContext/TimeLogServiceDataBaseContext.cs +++ b/src/TimeLogService/TimeLogService.Infrastructure/AionTimeContext/TimeLogServiceDataBaseContext.cs @@ -1,4 +1,7 @@ -using TimeLogService.Infrastructure.AionTimeContext.Configurations; +using TimeLogService.Infrastructure.AionTimeContext; +using TimeLogService.Infrastructure.AionTimeContext.Configurations; + +namespace TimeLogService.Infrastructure.AionTimeContext; public partial class TimeLogServiceDataBaseContext(DbContextOptions options) : DbContext(options) { diff --git a/src/TimeLogService/TimeLogService.Infrastructure/GlobalUsings.cs b/src/TimeLogService/TimeLogService.Infrastructure/GlobalUsings.cs index 8e3e31a..de9cede 100644 --- a/src/TimeLogService/TimeLogService.Infrastructure/GlobalUsings.cs +++ b/src/TimeLogService/TimeLogService.Infrastructure/GlobalUsings.cs @@ -7,9 +7,9 @@ global using System.Collections.Generic; global using TimeLogService; global using TimeLogService.Domain.Interfaces.Repositories; +global using TimeLogService.Domain.Models; global using TimeLogService.Domain.Models.Dbo; global using TimeLogService.Infrastructure; global using TimeLogService.Infrastructure.AionTimeContext; global using TimeLogService.Infrastructure.MultiTenancy; -global using TimeLogService.Infrastructure.Repositories; -global using TimeLogService.Domain.Models; \ No newline at end of file +global using TimeLogService.Infrastructure.Repositories; \ No newline at end of file