Skip to content

Commit

Permalink
Merge pull request TunNetCom#68 from TunNetCom/Revert
Browse files Browse the repository at this point in the history
Revert
  • Loading branch information
MarwenSaad authored Sep 22, 2024
2 parents ceb336c + 1f75306 commit 980496e
Show file tree
Hide file tree
Showing 27 changed files with 110 additions and 105 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public async Task<OneOf<UserProfile, CustomProblemDetailsResponce>> GetAdminInfo
{
UserProfile user = await userProfileResult.Content.ReadFromJsonAsync<UserProfile>();

user.Path = request.Path;
user!.Path = request.Path;
user.Email = request.Email;

return user;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
using TimeLogService.Application.AutoMapping;
using TimeLogService.Contracts.DTOs.Request;
using TimeLogService.Domain.Models.Dbo;
using Project = TimeLogService.Domain.Models.Project;
using WorkItem = TimeLogService.Domain.Models.WorkItem;
using Project = TimeLogService.Domain.Models.Dbo.Project;
using WorkItem = TimeLogService.Domain.Models.Dbo.WorkItem;
using WorkItemRequest = TimeLogService.Contracts.DTOs.Request.WorkItemRequest;

namespace TimeLogService.Application.AutoMapping
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,31 +9,31 @@ public class ProfileUserConsumer(ILogger<ProfileUserConsumer> logger, IMediator

public async Task Consume(ConsumeContext<UserProfile> context)
{
User user = await _repository.GetSingleAsync(x => x.UserId == context.Message.Id);
User user = await _repository.GetSingleAsync(x => x.UserId == context.Message!.Id);

if (user is null)
{
await _mediator.Send(new AddUserCommand(context.Message));
}

if (context.Message.UserAccount is not null and context.Message.UserAccount!.Count > 0)
if (context.Message.UserAccount is not null && context.Message.UserAccount!.Count > 0)
{
IReadOnlyList<Organization> organizationList = await _repositoryOrganization.GetManyAsync(x => x.UserId == context.Message!.Id);

var existingAccountIds = new HashSet<string>(organizationList.Select(x => x.AccountId));
HashSet<string> existingAccountIds = new(organizationList.Select(x => x.AccountId));

List<Organization> organizations = new List<Organization>();
List<Organization> organizations = [];

foreach (UserOrganization org in context.Message.UserAccount!.Value)
{
if (!existingAccountIds.Contains(org.AccountId))
{
organizations.Add(new Organization
{
AccountId = org.AccountId,
AccountUri = org.AccountUri.ToString(),
AccountId = org!.AccountId,
AccountUri = org!.AccountUri!.ToString(),
Name = org.AccountName,
UserId = context.Message.Id,
UserId = context.Message!.Id,
IsAionTimeApproved = false,
});
}
Expand All @@ -45,7 +45,6 @@ public async Task Consume(ConsumeContext<UserProfile> context)
}
}


_logger.LogInformation(JsonConvert.SerializeObject(context.Message));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TimeLogService.Domain.Models.Dbo;

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

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace TimeLogService.Application.Feature.OrganizationAction.Commands.AddOrganizationList
namespace TimeLogService.Application.Feature.OrganizationAction.Commands.AddOrganizationList
{
public class AddOrganizationListCommandHandler(IRepository<Organization> repository) : IRequestHandler<AddOrganizationListCommand>
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using NPOI.SS.Formula.Functions;
using TimeLogService.Domain.Interfaces.Repositories;
using TimeLogService.Domain.Models;
using TimeLogService.Domain.Models.Dbo;

namespace TimeLogService.Application.Feature.UserAction.Commands.AddUser
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<ItemGroup>
<PackageReference Include="AutoMapper" Version="13.0.1" />
<PackageReference Include="AzureDevopsService.Contracts" Version="1.0.3" />
<PackageReference Include="AzureDevopsService.Contracts" Version="1.0.4" />
<PackageReference Include="MassTransit" Version="8.2.5" />
<PackageReference Include="MassTransit.Newtonsoft" Version="8.2.5" />
<PackageReference Include="MassTransit.RabbitMQ" Version="8.2.5" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,6 @@
<Build Include="dbo\Tables\User.sql" />
<Build Include="dbo\Tables\AionTimeSubscription.sql" />
<Build Include="dbo\Tables\AionTimeSubscriptionHistory.sql" />
<Build Include="dbo\Tables\UserPath.sql" />
<Build Include="dbo\Tables\UserPathOrganizations.sql" />
</ItemGroup>
<ItemGroup>
<None Include="TimeLogService.Database.publish.xml" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
CREATE TABLE [dbo].[Organization]
(
[Id] INT IDENTITY (1, 1) PRIMARY KEY NOT NULL,
[UserId] NVARCHAR(100) not null,
[Name] Varchar(255) not null,
[AccountId] NVARCHAR(100) NOT NULL unique,
[AccountUri] VARCHAR(200) NOT NULL,
[IsAionTimeApproved] BIT NOT NULL,
[CreationDate] datetime not null
[IsAionTimeApproved] BIT NOT NULL

CONSTRAINT FKUserOrganization
FOREIGN KEY (UserId)
REFERENCES [dbo].[User] (UserId)
ON DELETE CASCADE
ON UPDATE CASCADE,
)

GO
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
CREATE TABLE [dbo].[User]
(
[Id] INT IDENTITY (1, 1) PRIMARY KEY NOT NULL,
[EmailAddress] VARCHAR(50) NOT NULL UNIQUE,
[UserId] NVARCHAR(100) NOT NULL UNIQUE,
[EmailAddress] VARCHAR(50) NOT NULL,
[PublicAlias] NVARCHAR(100) NOT NULL,
[CoreRevision] INT NOT NULL,
[TimeStamp] DATETIME NOT NULL,
[Revision] INT NOT NULL
)
12 changes: 0 additions & 12 deletions src/TimeLogService/TimeLogService.DataBase/dbo/Tables/UserPath.sql

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace TimeLogService.Domain.Models;
namespace TimeLogService.Domain.Models.Dbo;

public partial class AionTimeSubscription : BaseEntity
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
namespace TimeLogService.Domain.Models;
using TimeLogService;
using TimeLogService.Domain;
using TimeLogService.Domain.Models;

namespace TimeLogService.Domain.Models.Dbo;

public partial class AionTimeSubscriptionHistory : BaseEntity
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace TimeLogService.Domain.Models;
namespace TimeLogService.Domain.Models.Dbo;

public partial class Organization : BaseEntity
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace TimeLogService.Domain.Models;
namespace TimeLogService.Domain.Models.Dbo;

public partial class Project : BaseEntity
{
Expand Down
6 changes: 5 additions & 1 deletion src/TimeLogService/TimeLogService.Domain/Models/dbo/User.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
namespace TimeLogService.Domain.Models;
using TimeLogService;
using TimeLogService.Domain;
using TimeLogService.Domain.Models;

namespace TimeLogService.Domain.Models.Dbo;

public partial class User : BaseEntity
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
namespace TimeLogService.Domain.Models;
using TimeLogService;
using TimeLogService.Domain;
using TimeLogService.Domain.Models;

namespace TimeLogService.Domain.Models.Dbo;

public partial class WorkItem : BaseEntity
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
namespace TimeLogService.Domain.Models;
using TimeLogService;
using TimeLogService.Domain;
using TimeLogService.Domain.Models;

namespace TimeLogService.Domain.Models.Dbo;

public partial class WorkItemHistory : BaseEntity
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
namespace TimeLogService.Domain.Models;
using TimeLogService;
using TimeLogService.Domain;
using TimeLogService.Domain.Models;

namespace TimeLogService.Domain.Models.Dbo;

public partial class WorkItemTimeLog : BaseEntity
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@
{
public partial class AionTimeSubscriptionConfiguration : IEntityTypeConfiguration<AionTimeSubscription>
{
public void Configure(EntityTypeBuilder<AionTimeSubscription> entity)
public void Configure(EntityTypeBuilder<AionTimeSubscription> builder)
{
_ = entity.ToTable("AionTimeSubscription");
_ = builder.ToTable("AionTimeSubscription");

_ = entity.Property(e => e.ExpirationDate).HasColumnType("datetime");
_ = entity.Property(e => e.SubsecriptionDate).HasColumnType("datetime");
_ = builder.Property(e => e.ExpirationDate).HasColumnType("datetime");
_ = builder.Property(e => e.SubsecriptionDate).HasColumnType("datetime");

_ = entity.HasOne(d => d.Organization).WithMany(p => p.AionTimeSubscriptions)
_ = builder.HasOne(d => d.Organization).WithMany(p => p.AionTimeSubscriptions)
.HasForeignKey(d => d.OrganizationId)
.HasConstraintName("FKOrganizationSubscription");

OnConfigurePartial(entity);
OnConfigurePartial(builder);
}

partial void OnConfigurePartial(EntityTypeBuilder<AionTimeSubscription> entity);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@
{
public partial class AionTimeSubscriptionHistoryConfiguration : IEntityTypeConfiguration<AionTimeSubscriptionHistory>
{
public void Configure(EntityTypeBuilder<AionTimeSubscriptionHistory> entity)
public void Configure(EntityTypeBuilder<AionTimeSubscriptionHistory> builder)
{
_ = entity.ToTable("AionTimeSubscriptionHistory");
_ = builder.ToTable("AionTimeSubscriptionHistory");

_ = entity.Property(e => e.Id).ValueGeneratedNever();
_ = entity.Property(e => e.SubscriptionDate).HasColumnType("date");
_ = builder.Property(e => e.Id).ValueGeneratedNever();
_ = builder.Property(e => e.SubscriptionDate).HasColumnType("date");

_ = entity.HasOne(d => d.Subscription).WithMany(p => p.AionTimeSubscriptionHistories)
_ = builder.HasOne(d => d.Subscription).WithMany(p => p.AionTimeSubscriptionHistories)
.HasForeignKey(d => d.SubscriptionId)
.HasConstraintName("FKSubscriptionSubscriptionHistory");

OnConfigurePartial(entity);
OnConfigurePartial(builder);
}

partial void OnConfigurePartial(EntityTypeBuilder<AionTimeSubscriptionHistory> entity);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,29 @@
{
public partial class OrganizationConfiguration : IEntityTypeConfiguration<Organization>
{
public void Configure(EntityTypeBuilder<Organization> entity)
public void Configure(EntityTypeBuilder<Organization> builder)
{
_ = entity.ToTable("Organization");
_ = builder.ToTable("Organization");

_ = entity.HasIndex(e => e.AccountId, "IX_Organization_AccountId").IsUnique();
_ = builder.HasIndex(e => e.AccountId, "IX_Organization_AccountId").IsUnique();

_ = entity.HasIndex(e => e.Name, "IX_Organization_Name_Unique").IsUnique();
_ = builder.HasIndex(e => e.Name, "IX_Organization_Name_Unique").IsUnique();

_ = entity.Property(e => e.AccountId).HasMaxLength(100);
_ = entity.Property(e => e.AccountUri)
_ = builder.Property(e => e.AccountId).HasMaxLength(100);
_ = builder.Property(e => e.AccountUri)
.HasMaxLength(200)
.IsUnicode(false);
_ = entity.Property(e => e.Name)
_ = builder.Property(e => e.Name)
.HasMaxLength(255)
.IsUnicode(false);
_ = entity.Property(e => e.UserId).HasMaxLength(100);
_ = builder.Property(e => e.UserId).HasMaxLength(100);

_ = entity.HasOne(d => d.User).WithMany(p => p.Organizations)
_ = builder.HasOne(d => d.User).WithMany(p => p.Organizations)
.HasPrincipalKey(p => p.UserId)
.HasForeignKey(d => d.UserId)
.HasConstraintName("FKUserOrganization");

OnConfigurePartial(entity);
OnConfigurePartial(builder);
}

partial void OnConfigurePartial(EntityTypeBuilder<Organization> entity);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,29 @@
{
public partial class ProjectConfiguration : IEntityTypeConfiguration<Project>
{
public void Configure(EntityTypeBuilder<Project> entity)
public void Configure(EntityTypeBuilder<Project> builder)
{
_ = entity.ToTable("Project");
_ = builder.ToTable("Project");

_ = entity.HasIndex(e => e.ProjectId, "IX_Project_ProjectId").IsUnique();
_ = builder.HasIndex(e => e.ProjectId, "IX_Project_ProjectId").IsUnique();

_ = entity.Property(e => e.LastUpdateTime).HasColumnType("datetime");
_ = entity.Property(e => e.Name)
_ = builder.Property(e => e.LastUpdateTime).HasColumnType("datetime");
_ = builder.Property(e => e.Name)
.HasMaxLength(50)
.IsUnicode(false);
_ = entity.Property(e => e.ProjectId).HasMaxLength(100);
_ = entity.Property(e => e.Url)
_ = builder.Property(e => e.ProjectId).HasMaxLength(100);
_ = builder.Property(e => e.Url)
.HasMaxLength(200)
.IsUnicode(false);
_ = entity.Property(e => e.Visibility)
_ = builder.Property(e => e.Visibility)
.HasMaxLength(50)
.IsUnicode(false);

_ = entity.HasOne(d => d.Organization).WithMany(p => p.Projects)
_ = builder.HasOne(d => d.Organization).WithMany(p => p.Projects)
.HasForeignKey(d => d.OrganizationId)
.HasConstraintName("FKOrganisationProject");

OnConfigurePartial(entity);
OnConfigurePartial(builder);
}

partial void OnConfigurePartial(EntityTypeBuilder<Project> entity);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
namespace TimeLogService.Infrastructure.AionTimeContext.Configurations

namespace TimeLogService.Infrastructure.AionTimeContext.Configurations
{
public partial class UserConfiguration : IEntityTypeConfiguration<User>
{
public void Configure(EntityTypeBuilder<User> entity)
public void Configure(EntityTypeBuilder<User> builder)
{
_ = entity.ToTable("User");
_ = builder.ToTable("User");

_ = entity.HasIndex(e => e.UserId, "IX_User_UserId").IsUnique();
_ = builder.HasIndex(e => e.UserId, "IX_User_UserId").IsUnique();

_ = entity.Property(e => e.EmailAddress)
_ = builder.Property(e => e.EmailAddress)
.HasMaxLength(50)
.IsUnicode(false);
_ = entity.Property(e => e.PublicAlias).HasMaxLength(100);
_ = entity.Property(e => e.TimeStamp).HasColumnType("datetime");
_ = entity.Property(e => e.UserId).HasMaxLength(100);
_ = builder.Property(e => e.PublicAlias).HasMaxLength(100);
_ = builder.Property(e => e.TimeStamp).HasColumnType("datetime");
_ = builder.Property(e => e.UserId).HasMaxLength(100);

OnConfigurePartial(entity);
OnConfigurePartial(builder);
}

partial void OnConfigurePartial(EntityTypeBuilder<User> entity);
Expand Down
Loading

0 comments on commit 980496e

Please sign in to comment.