Skip to content

Commit

Permalink
fix code rules errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Nieze-BenMansour committed Dec 25, 2024
1 parent a6d07dc commit 95785c5
Show file tree
Hide file tree
Showing 10 changed files with 75 additions and 52 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ namespace IdentityService.Application.Features.AddAzureInfo
internal class AddAzureInfoCommand
{
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public async Task Consume(ConsumeContext<UserProfile> context)

if (organizations.Count > 0)
{
await _mediator.Send(new AddOrganizationListCommand(organizations));
await _mediator.Send(new AddOrganizationListCommand(organizations.AsReadOnly()));
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TimeLogService.Domain.Models.Dbo;

namespace TimeLogService.Application.Feature.OrganizationAction.Commands.AddOrganizationList;

public record class AddOrganizationListCommand(List<Organization> Organizations) : IRequest;
public record class AddOrganizationListCommand(ReadOnlyCollection<Organization> Organizations) : IRequest;
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ public async Task Handle(AddOrganizationListCommand request, CancellationToken c
await _repository.AddRangeAsync(request.Organizations);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,20 @@

namespace TimeLogService.Application.Feature.UserAction.Commands.AddUser
{
public class AddUserCommandHandler(IRepository<User> repository, IMapper mapper) : IRequestHandler<AddUserCommand>
public class AddUserCommandHandler(IRepository<User> repository) : IRequestHandler<AddUserCommand>
{
private readonly IRepository<User> _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);
}
Expand Down
26 changes: 26 additions & 0 deletions src/TimeLogService/TimeLogService.Domain/Models/Partials/User.cs
Original file line number Diff line number Diff line change
@@ -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;
}
}
Original file line number Diff line number Diff line change
@@ -1,24 +1,22 @@

namespace TimeLogService.Infrastructure.AionTimeContext.Configurations
namespace TimeLogService.Infrastructure.AionTimeContext.Configurations;

public partial class UserConfiguration : IEntityTypeConfiguration<User>
{
public partial class UserConfiguration : IEntityTypeConfiguration<User>
public void Configure(EntityTypeBuilder<User> builder)
{
public void Configure(EntityTypeBuilder<User> 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<User> entity);
OnConfigurePartial(builder);
}

partial void OnConfigurePartial(EntityTypeBuilder<User> entity);
}
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@

namespace TimeLogService.Infrastructure.AionTimeContext.Configurations
namespace TimeLogService.Infrastructure.AionTimeContext.Configurations;

public partial class WorkItemConfiguration : IEntityTypeConfiguration<WorkItem>
{
public partial class WorkItemConfiguration : IEntityTypeConfiguration<WorkItem>
public void Configure(EntityTypeBuilder<WorkItem> builder)
{
public void Configure(EntityTypeBuilder<WorkItem> 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<WorkItem> entity);
OnConfigurePartial(builder);
}

partial void OnConfigurePartial(EntityTypeBuilder<WorkItem> entity);
}
Original file line number Diff line number Diff line change
@@ -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<TimeLogServiceDataBaseContext> options) : DbContext(options)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
global using TimeLogService.Infrastructure.Repositories;

0 comments on commit 95785c5

Please sign in to comment.