Add Profile to ServiceProvider; ServiceProvider to Company in progress...

This commit is contained in:
jozsef.b@aycode.com 2024-05-26 09:12:37 +02:00
parent 4ce3ffea84
commit 6fefa1e9d9
37 changed files with 165 additions and 152 deletions

View File

@ -8,7 +8,7 @@ using AyCode.Entities.ServiceProviders;
namespace AyCode.Core.Tests.Internal.Entities;
public class Company : AcServiceProvider<User, UserToCompany>
public class Company : AcCompany<User, UserToCompany, Profile>
{
}

View File

@ -8,7 +8,7 @@ using AyCode.Entities.Users;
namespace AyCode.Core.Tests.Internal.Entities;
public class UserToCompany: AcUserToServiceProvider<User, Company>
public class UserToCompany: AcUserToCompany<User, Company>
{
}

View File

@ -13,15 +13,15 @@ using AyCode.Interfaces.Users;
namespace AyCode.Database.Tests.Users
{
public abstract class AcUserDalTestBase<TDal, TDbContext, TUser, TProfile, TUserToken, TServiceProvider, TUserToServiceProvider, TProfileAddress, TEmailMessage> : AcDatabaseTestModelBase<TDal, TDbContext>
where TDal : AcUserDalBase<TDbContext, TUser, TProfile, TUserToken, TServiceProvider, TUserToServiceProvider, TProfileAddress, TEmailMessage>
where TDbContext : AcDbContextBase, IAcUserDbContextBase<TUser, TProfile, TUserToken, TServiceProvider, TUserToServiceProvider, TProfileAddress, TEmailMessage>
where TUser : class, IAcUser<TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress>
public abstract class AcUserDalTestBase<TDal, TDbContext, TUser, TProfile, TUserToken, TCompany, TUserToServiceProvider, TProfileAddress, TEmailMessage> : AcDatabaseTestModelBase<TDal, TDbContext>
where TDal : AcUserDalBase<TDbContext, TUser, TProfile, TUserToken, TCompany, TUserToServiceProvider, TProfileAddress, TEmailMessage>
where TDbContext : AcDbContextBase, IAcUserDbContextBase<TUser, TProfile, TUserToken, TCompany, TUserToServiceProvider, TProfileAddress, TEmailMessage>
where TUser : class, IAcUser<TProfile, TCompany, TUserToServiceProvider, TProfileAddress>
where TProfile : class, IAcProfile<TProfileAddress>
where TProfileAddress : class, IAcAddress
where TUserToken : class, IAcUserTokenBase
where TServiceProvider : class, IAcServiceProviderBase
where TUserToServiceProvider : class, IAcUserToServiceProviderBase
where TCompany : class, IAcCompanyBase
where TUserToServiceProvider : class, IAcUserToCompanyBase
where TEmailMessage : class, IAcEmailMessageBase
{
[DataTestMethod]

View File

@ -21,13 +21,13 @@ using AyCode.Interfaces.ServiceProviders;
namespace AyCode.Database.DataLayers.Users
{
public abstract class AcUserDalBase<TDbContext, TUser, TProfile, TUserToken, TServiceProvider, TUserToServiceProvider, TProfileAddress, TEmailMessage> : AcDalBase<TDbContext>
where TDbContext : AcDbContextBase, IAcUserDbContextBase<TUser, TProfile, TUserToken, TServiceProvider, TUserToServiceProvider, TProfileAddress, TEmailMessage>
where TUser : class, IAcUser<TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress>
public abstract class AcUserDalBase<TDbContext, TUser, TProfile, TUserToken, TCompany, TUserToServiceProvider, TProfileAddress, TEmailMessage> : AcDalBase<TDbContext>
where TDbContext : AcDbContextBase, IAcUserDbContextBase<TUser, TProfile, TUserToken, TCompany, TUserToServiceProvider, TProfileAddress, TEmailMessage>
where TUser : class, IAcUser<TProfile, TCompany, TUserToServiceProvider, TProfileAddress>
where TProfile : class, IAcProfile<TProfileAddress>
where TUserToken : class, IAcUserTokenBase
where TServiceProvider : class, IAcServiceProviderBase
where TUserToServiceProvider : class, IAcUserToServiceProviderBase
where TCompany : class, IAcCompanyBase
where TUserToServiceProvider : class, IAcUserToCompanyBase
where TProfileAddress : class, IAcAddress
where TEmailMessage : class, IAcEmailMessageBase
{

View File

@ -9,12 +9,12 @@ using Microsoft.EntityFrameworkCore;
namespace AyCode.Database.DbContexts.Users
{
public abstract class AcUserDbContextBase<TUser, TProfile, TUserToken, TServiceProvider, TUserToServiceProvider, TProfileAddress, TEmailMessage> : AcDbContextBase, IAcUserDbContextBase<TUser, TProfile, TUserToken, TServiceProvider, TUserToServiceProvider, TProfileAddress, TEmailMessage>
where TUser : class, IAcUser<TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress>
public abstract class AcUserDbContextBase<TUser, TProfile, TUserToken, TCompany, TUserToServiceProvider, TProfileAddress, TEmailMessage> : AcDbContextBase, IAcUserDbContextBase<TUser, TProfile, TUserToken, TCompany, TUserToServiceProvider, TProfileAddress, TEmailMessage>
where TUser : class, IAcUser<TProfile, TCompany, TUserToServiceProvider, TProfileAddress>
where TProfile : class, IAcProfile<TProfileAddress>
where TUserToken : class, IAcUserTokenBase
where TServiceProvider : class, IAcServiceProvider<TUser, TUserToServiceProvider>//IAcServiceProviderBase
where TUserToServiceProvider : class, IAcUserToServiceProviderBase
where TCompany : class, IAcCompany<TUser, TUserToServiceProvider, TProfile>//IAcServiceProviderBase
where TUserToServiceProvider : class, IAcUserToCompanyBase
where TProfileAddress : class, IAcAddress
where TEmailMessage : class, IAcEmailMessageBase
{
@ -46,7 +46,7 @@ namespace AyCode.Database.DbContexts.Users
{
base.OnModelCreating(modelBuilder);
new AcUserEntityTypeDefaultConfiguration<TUser, TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress>().Configure(modelBuilder.Entity<TUser>());
new AcUserEntityTypeDefaultConfiguration<TUser, TProfile, TCompany, TUserToServiceProvider, TProfileAddress>().Configure(modelBuilder.Entity<TUser>());
new AcProfileEntityTypeDefaultConfiguration<TProfile, TProfileAddress>().Configure(modelBuilder.Entity<TProfile>());
//new EmailMessageEntityTypeDefaultConfigurations().Configure(modelBuilder.Entity<EmailMessage>());

View File

@ -10,16 +10,16 @@ using AyCode.Interfaces.Users;
namespace AyCode.Database.DbContexts.Users;
public interface IAcUserDbContextBase<TUser, TProfile, TUserToken, TServiceProvider, TUserToServiceProvider, TProfileAddress, TEmailMessage>
: IAcUserDbSet<TUser, TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress>, IAcUserTokenDbSet<TUserToken>,
public interface IAcUserDbContextBase<TUser, TProfile, TUserToken, TCompany, TUserToServiceProvider, TProfileAddress, TEmailMessage>
: IAcUserDbSet<TUser, TProfile, TCompany, TUserToServiceProvider, TProfileAddress>, IAcUserTokenDbSet<TUserToken>,
IAcAddressDbSetBase<TProfileAddress>, IAcProfileDbSetBase<TProfile>,
IAcEmailMessageDbSet<TEmailMessage>
where TUser : class, IAcUser<TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress>
where TUser : class, IAcUser<TProfile, TCompany, TUserToServiceProvider, TProfileAddress>
where TProfile : class, IAcProfile<TProfileAddress>
where TUserToken : class, IAcUserTokenBase
where TServiceProvider : class, IAcServiceProviderBase
where TUserToServiceProvider : class, IAcUserToServiceProviderBase
where TCompany : class, IAcCompanyBase
where TUserToServiceProvider : class, IAcUserToCompanyBase
where TProfileAddress : class, IAcAddress
where TEmailMessage : class, IAcEmailMessageBase
{

View File

@ -6,10 +6,10 @@ using AyCode.Interfaces.Users;
namespace AyCode.Database.DbSets.Users;
public interface IAcUserDbSet<TUser, TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress> : IAcUserDbSetBase<TUser>
where TUser : class, IAcUser<TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress>
public interface IAcUserDbSet<TUser, TProfile, TCompany, TUserToServiceProvider, TProfileAddress> : IAcUserDbSetBase<TUser>
where TUser : class, IAcUser<TProfile, TCompany, TUserToServiceProvider, TProfileAddress>
where TProfile : class, IAcProfile<TProfileAddress>
where TServiceProvider : class, IAcServiceProviderBase
where TUserToServiceProvider : class, IAcUserToServiceProviderBase
where TCompany : class, IAcCompanyBase
where TUserToServiceProvider : class, IAcUserToCompanyBase
where TProfileAddress : class, IAcAddress
{ }

View File

@ -19,10 +19,11 @@ public static class AcUserEntityTypeBuilderExtensions
modelBuilder.Navigation(e => e.Profile).AutoInclude(autoInclude).IsRequired();
}
public static void BuildEntityToServiceProviderRelation<TServiceProviderRelation, TServiceProvider, TUserToServiceProvider>(this EntityTypeBuilder<TServiceProviderRelation> modelBuilder, bool autoInclude = true)
where TServiceProviderRelation : class, IAcUserBase, IAcServiceProviderRelation<TServiceProvider, TUserToServiceProvider>
where TServiceProvider : class, IAcServiceProvider<TServiceProviderRelation, TUserToServiceProvider>
where TUserToServiceProvider : class, IAcUserToServiceProviderBase
public static void BuildEntityToServiceProviderRelation<TCompanyRelation, TCompany, TUserToServiceProvider, TProfile>(this EntityTypeBuilder<TCompanyRelation> modelBuilder, bool autoInclude = true)
where TCompanyRelation : class, IAcUserBase, IAcCompanyRelation<TCompany, TUserToServiceProvider>
where TCompany : class, IAcCompany<TCompanyRelation, TUserToServiceProvider, TProfile>
where TUserToServiceProvider : class, IAcUserToCompanyBase
where TProfile : class, IAcProfileDtoBase
{
modelBuilder
.HasMany(e => e.ServiceProviders)

View File

@ -7,17 +7,17 @@ using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace AyCode.Database.ModelBuilders.Users;
public class AcUserEntityTypeDefaultConfiguration<TUser, TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress> : IAcEntityTypeConfiguration<TUser>
where TUser : class, IAcUser<TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress>
public class AcUserEntityTypeDefaultConfiguration<TUser, TProfile, TCompany, TUserToServiceProvider, TProfileAddress> : IAcEntityTypeConfiguration<TUser>
where TUser : class, IAcUser<TProfile, TCompany, TUserToServiceProvider, TProfileAddress>
where TProfile : class, IAcProfile<TProfileAddress>
where TServiceProvider : class, IAcServiceProvider<TUser, TUserToServiceProvider>
where TUserToServiceProvider : class, IAcUserToServiceProviderBase
where TCompany : class, IAcCompany<TUser, TUserToServiceProvider, TProfile>
where TUserToServiceProvider : class, IAcUserToCompanyBase
where TProfileAddress : class, IAcAddress
{
public virtual void Configure(EntityTypeBuilder<TUser> modelBuilder)
{
modelBuilder.BuildEntityToProfileRelation<TUser, TProfile>();
//modelBuilder.BuildEntityToAddressRelation<TProfileAddress, TProfile, TProfileAddress>();
modelBuilder.BuildEntityToServiceProviderRelation<TUser, TServiceProvider, TUserToServiceProvider>();
modelBuilder.BuildEntityToServiceProviderRelation<TUser, TCompany, TUserToServiceProvider, TProfile>();
}
}

View File

@ -1,15 +1,17 @@

using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
using AyCode.Interfaces.Profiles.Dtos;
using AyCode.Interfaces.ServiceProviders;
using AyCode.Interfaces.Users;
namespace AyCode.Entities.ServiceProviders
{
[Table("ServiceProviders")]
public abstract class AcServiceProvider<TUser, TUserToServiceProvider> : IAcServiceProvider<TUser, TUserToServiceProvider>
public abstract class AcCompany<TUser, TUserToServiceProvider, TProfile> : IAcCompany<TUser, TUserToServiceProvider, TProfile>
where TUser : class, IAcUserBase
where TUserToServiceProvider : class, IAcUserToServiceProviderBase
where TUserToServiceProvider : class, IAcUserToCompanyBase
where TProfile : class, IAcProfileDtoBase
{
[Key, DatabaseGenerated(DatabaseGeneratedOption.None)]
public Guid Id { get; set; }
@ -17,6 +19,11 @@ namespace AyCode.Entities.ServiceProviders
[Required]
public Guid OwnerId { get; set; }
[NotMapped] //COMPANY_RENAME - J.
public Guid ProfileId { get; set; }
[NotMapped] //COMPANY_RENAME - J.
public TProfile Profile { get; set; }
[Required]
public string Name { get; set; }
@ -33,19 +40,19 @@ namespace AyCode.Entities.ServiceProviders
public DateTime Modified { get; set; }
protected AcServiceProvider()
protected AcCompany()
{
}
protected AcServiceProvider(string name, Guid ownerId) : this(Guid.NewGuid(), name, ownerId)
protected AcCompany(string name, Guid ownerId) : this(Guid.NewGuid(), name, ownerId)
{
}
protected AcServiceProvider(Guid id, string name, Guid ownerId) : this(id, name, ownerId, Guid.NewGuid())
protected AcCompany(Guid id, string name, Guid ownerId) : this(id, name, ownerId, Guid.NewGuid())
{
}
protected AcServiceProvider(Guid id, string name, Guid ownerId, Guid affiliateId, double? commissionPercent = null) : this()
protected AcCompany(Guid id, string name, Guid ownerId, Guid affiliateId, double? commissionPercent = null) : this()
{
Id = id;
Name = name;

View File

@ -11,10 +11,10 @@ using AyCode.Interfaces.ServiceProviders;
namespace AyCode.Entities.Users
{
[Table("Users")]
public abstract class AcUser<TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress>() : IAcUser<TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress>
public abstract class AcUser<TProfile, TCompany, TUserToServiceProvider, TProfileAddress>() : IAcUser<TProfile, TCompany, TUserToServiceProvider, TProfileAddress>
where TProfile : class, IAcProfile<TProfileAddress>
where TServiceProvider : class, IAcServiceProviderBase
where TUserToServiceProvider : class, IAcUserToServiceProviderBase
where TCompany : class, IAcCompanyBase
where TUserToServiceProvider : class, IAcUserToCompanyBase
where TProfileAddress : class, IAcAddress
{
[Key, DatabaseGenerated(DatabaseGeneratedOption.None)]
@ -39,7 +39,7 @@ namespace AyCode.Entities.Users
public virtual TProfile Profile { get; set; }
//[NotMapped]
public virtual List<TServiceProvider> ServiceProviders { get; set; }
public virtual List<TCompany> ServiceProviders { get; set; }
public virtual List<TUserToServiceProvider> UserToServiceProviders { get; set; }
public DateTime Created { get; set; }

View File

@ -6,9 +6,9 @@ using AyCode.Interfaces.Users;
namespace AyCode.Entities.Users;
[Table("UserToServiceProvider")]
public abstract class AcUserToServiceProvider<TUser, TServiceProvider> : IAcUserToAcServiceProvider<TUser, TServiceProvider>
public abstract class AcUserToCompany<TUser, TCompany> : IAcUserToCompany<TUser, TCompany>
where TUser : class, IAcUserBase
where TServiceProvider : class, IAcServiceProviderBase
where TCompany : class, IAcCompanyBase
{
[Key, DatabaseGenerated(DatabaseGeneratedOption.None)]
public Guid Id { get; set; }
@ -17,7 +17,8 @@ public abstract class AcUserToServiceProvider<TUser, TServiceProvider> : IAcUser
public Guid ServiceProviderId { get; set; }
public virtual TUser User { get; set; }
public virtual TServiceProvider ServiceProvider { get; set; }
[ForeignKey("ServiceProviderId")] //COMPANY_RENAME - J.
public virtual TCompany Company { get; set; }
public DateTime Created { get; set; }
public DateTime Modified { get; set; }

View File

@ -6,13 +6,13 @@ using AyCode.Interfaces.Users;
namespace AyCode.Interfaces.Server.Logins;
public interface IAcLoggedInModelBase<TUser, TUserToken, TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress> : IAcLoginDtoBase
public interface IAcLoggedInModelBase<TUser, TUserToken, TProfile, TCompany, TUserToServiceProvider, TProfileAddress> : IAcLoginDtoBase
where TUser : class, IAcUser<TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress>
where TUser : class, IAcUser<TProfile, TCompany, TUserToServiceProvider, TProfileAddress>
where TUserToken : class, IAcUserTokenBase
where TProfile : class, IAcProfile<TProfileAddress>
where TServiceProvider : class, IAcServiceProviderBase
where TUserToServiceProvider : class, IAcUserToServiceProviderBase
where TCompany : class, IAcCompanyBase
where TUserToServiceProvider : class, IAcUserToCompanyBase
where TProfileAddress : class, IAcAddress
{
bool IsLoggedIn { get; }

View File

@ -7,14 +7,14 @@ using AyCode.Interfaces.Users;
namespace AyCode.Interfaces.Server.Logins;
public interface IAcLoginServiceServer<TResultLoggedInModel, TUser, TUserToken, TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress> : IAcLoginServiceCommon<TUser, TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress>
where TResultLoggedInModel: class, IAcLoggedInModelBase<TUser, TUserToken, TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress>
public interface IAcLoginServiceServer<TResultLoggedInModel, TUser, TUserToken, TProfile, TCompany, TUserToServiceProvider, TProfileAddress> : IAcLoginServiceCommon<TUser, TProfile, TCompany, TUserToServiceProvider, TProfileAddress>
where TResultLoggedInModel: class, IAcLoggedInModelBase<TUser, TUserToken, TProfile, TCompany, TUserToServiceProvider, TProfileAddress>
where TUser : class, IAcUser<TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress>
where TUser : class, IAcUser<TProfile, TCompany, TUserToServiceProvider, TProfileAddress>
where TUserToken : class, IAcUserTokenBase
where TProfile : class, IAcProfile<TProfileAddress>
where TServiceProvider : class, IAcServiceProviderBase
where TUserToServiceProvider : class, IAcUserToServiceProviderBase
where TCompany : class, IAcCompanyBase
where TUserToServiceProvider : class, IAcUserToCompanyBase
where TProfileAddress : class, IAcAddress
{
public TResultLoggedInModel? LoggedInModel { get; }

View File

@ -5,10 +5,10 @@ using AyCode.Interfaces.Users;
namespace AyCode.Interfaces.Logins;
public interface IAcLoginServiceBase<TUser, TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress> where TUser : class, IAcUser<TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress>
public interface IAcLoginServiceBase<TUser, TProfile, TCompany, TUserToServiceProvider, TProfileAddress> where TUser : class, IAcUser<TProfile, TCompany, TUserToServiceProvider, TProfileAddress>
where TProfile : class, IAcProfile<TProfileAddress>
where TServiceProvider : class, IAcServiceProviderBase
where TUserToServiceProvider : class, IAcUserToServiceProviderBase
where TCompany : class, IAcCompanyBase
where TUserToServiceProvider : class, IAcUserToCompanyBase
where TProfileAddress : class, IAcAddress
{
public bool IsLoggedIn { get; }

View File

@ -5,11 +5,11 @@ using AyCode.Interfaces.Users;
namespace AyCode.Interfaces.Logins;
public interface IAcLoginServiceClient<TUser, TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress> : IAcLoginServiceCommon<TUser, TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress>
where TUser : class, IAcUser<TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress>
public interface IAcLoginServiceClient<TUser, TProfile, TCompany, TUserToServiceProvider, TProfileAddress> : IAcLoginServiceCommon<TUser, TProfile, TCompany, TUserToServiceProvider, TProfileAddress>
where TUser : class, IAcUser<TProfile, TCompany, TUserToServiceProvider, TProfileAddress>
where TProfile : class, IAcProfile<TProfileAddress>
where TServiceProvider : class, IAcServiceProviderBase
where TUserToServiceProvider : class, IAcUserToServiceProviderBase
where TCompany : class, IAcCompanyBase
where TUserToServiceProvider : class, IAcUserToCompanyBase
where TProfileAddress : class, IAcAddress
{
}

View File

@ -6,11 +6,11 @@ using AyCode.Interfaces.Users;
namespace AyCode.Interfaces.Logins;
public interface IAcLoginServiceCommon<TUser, TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress> : IAcLoginServiceBase<TUser, TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress>
where TUser : class, IAcUser<TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress>
public interface IAcLoginServiceCommon<TUser, TProfile, TCompany, TUserToServiceProvider, TProfileAddress> : IAcLoginServiceBase<TUser, TProfile, TCompany, TUserToServiceProvider, TProfileAddress>
where TUser : class, IAcUser<TProfile, TCompany, TUserToServiceProvider, TProfileAddress>
where TProfile : class, IAcProfile<TProfileAddress>
where TServiceProvider : class, IAcServiceProviderBase
where TUserToServiceProvider : class, IAcUserToServiceProviderBase
where TCompany : class, IAcCompanyBase
where TUserToServiceProvider : class, IAcUserToCompanyBase
where TProfileAddress : class, IAcAddress
{
public bool Logout();

View File

@ -0,0 +1,11 @@
using AyCode.Interfaces.Profiles.Dtos;
using AyCode.Interfaces.Profiles;
using AyCode.Interfaces.Users;
namespace AyCode.Interfaces.ServiceProviders;
public interface IAcCompany<TUser, TUserToServiceProvider, TProfile> : IAcCompanyBase, IAcUsersRelation<TUser, TUserToServiceProvider>, IAcProfileRelation<TProfile>
where TUser : IAcUserBase
where TUserToServiceProvider : IAcUserToCompanyBase
where TProfile : IAcProfileDtoBase
{}

View File

@ -1,10 +1,11 @@

using AyCode.Interfaces.Entities;
using AyCode.Interfaces.Profiles;
using AyCode.Interfaces.TimeStampInfo;
namespace AyCode.Interfaces.ServiceProviders;
public interface IAcServiceProviderBase : IEntityGuid, ITimeStampInfo, IOwnerId
public interface IAcCompanyBase : IEntityGuid, IAcProfileForeignKey, ITimeStampInfo, IOwnerId
{
string Name { get; set; }

View File

@ -1,6 +1,6 @@
namespace AyCode.Interfaces.ServiceProviders;
public interface IAcServiceProviderForeignKey
public interface IAcCompanyForeignKey
{
public Guid ServiceProviderId { get; set; }
}

View File

@ -0,0 +1,11 @@
using AyCode.Interfaces.Users;
namespace AyCode.Interfaces.ServiceProviders;
public interface IAcCompanyRelation<TCompany, TUserToServiceProvider>
where TCompany : IAcCompanyBase
where TUserToServiceProvider : IAcUserToCompanyBase
{
public List<TCompany> ServiceProviders { get; set; }
public List<TUserToServiceProvider> UserToServiceProviders { get; set; }
}

View File

@ -1,8 +0,0 @@
using AyCode.Interfaces.Users;
namespace AyCode.Interfaces.ServiceProviders;
public interface IAcServiceProvider<TUser, TUserToServiceProvider> : IAcServiceProviderBase, IAcUsersRelation<TUser, TUserToServiceProvider>
where TUser : IAcUserBase
where TUserToServiceProvider : IAcUserToServiceProviderBase
{}

View File

@ -1,11 +0,0 @@
using AyCode.Interfaces.Users;
namespace AyCode.Interfaces.ServiceProviders;
public interface IAcServiceProviderRelation<TServiceProvider, TUserToServiceProvider>
where TServiceProvider : IAcServiceProviderBase
where TUserToServiceProvider : IAcUserToServiceProviderBase
{
public List<TServiceProvider> ServiceProviders { get; set; }
public List<TUserToServiceProvider> UserToServiceProviders { get; set; }
}

View File

@ -4,10 +4,10 @@ using AyCode.Interfaces.Addresses;
namespace AyCode.Interfaces.Users.Dtos;
public interface IAcUserDtoBase<TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress> : IAcUserDtoMinBase<TProfile>, IAcServiceProviderRelation<TServiceProvider, TUserToServiceProvider>
public interface IAcUserDtoBase<TProfile, TCompany, TUserToServiceProvider, TProfileAddress> : IAcUserDtoMinBase<TProfile>, IAcCompanyRelation<TCompany, TUserToServiceProvider>
where TProfile : IAcProfile<TProfileAddress>
where TServiceProvider : IAcServiceProviderBase
where TUserToServiceProvider : IAcUserToServiceProviderBase
where TCompany : IAcCompanyBase
where TUserToServiceProvider : IAcUserToCompanyBase
where TProfileAddress : IAcAddress
{
}

View File

@ -4,10 +4,10 @@ using AyCode.Interfaces.ServiceProviders;
namespace AyCode.Interfaces.Users.Dtos;
public interface IAcUserDtoDetailBase<TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress> : IAcUserBase, IAcUserDtoBase<TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress>
public interface IAcUserDtoDetailBase<TProfile, TCompany, TUserToServiceProvider, TProfileAddress> : IAcUserBase, IAcUserDtoBase<TProfile, TCompany, TUserToServiceProvider, TProfileAddress>
where TProfile : IAcProfile<TProfileAddress>
where TServiceProvider : IAcServiceProviderBase
where TUserToServiceProvider : IAcUserToServiceProviderBase
where TCompany : IAcCompanyBase
where TUserToServiceProvider : IAcUserToCompanyBase
where TProfileAddress : IAcAddress
{
}

View File

@ -6,9 +6,9 @@ using AyCode.Interfaces.Users.Dtos;
namespace AyCode.Interfaces.Users;
public interface IAcUser<TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress> : IAcUserDtoDetailBase<TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress>, IAcProfileForeignKey
public interface IAcUser<TProfile, TCompany, TUserToServiceProvider, TProfileAddress> : IAcUserDtoDetailBase<TProfile, TCompany, TUserToServiceProvider, TProfileAddress>, IAcProfileForeignKey
where TProfile : IAcProfile<TProfileAddress>
where TServiceProvider : IAcServiceProviderBase
where TUserToServiceProvider : IAcUserToServiceProviderBase
where TCompany : IAcCompanyBase
where TUserToServiceProvider : IAcUserToCompanyBase
where TProfileAddress : IAcAddress
{ }

View File

@ -4,10 +4,10 @@ using AyCode.Interfaces.TimeStampInfo;
namespace AyCode.Interfaces.Users;
public interface IAcUserToAcServiceProvider<TUser, TServiceProvider> : IAcUserToServiceProviderBase
public interface IAcUserToCompany<TUser, TCompany> : IAcUserToCompanyBase
where TUser : class, IAcUserBase
where TServiceProvider : class, IAcServiceProviderBase
where TCompany : class, IAcCompanyBase
{
public TUser User { get; set; }
public TServiceProvider ServiceProvider { get; set; }
public TCompany Company { get; set; }
}

View File

@ -4,6 +4,6 @@ using AyCode.Interfaces.TimeStampInfo;
namespace AyCode.Interfaces.Users;
public interface IAcUserToServiceProviderBase : IEntityGuid, IAcUserForeignKey, IAcServiceProviderForeignKey, ITimeStampInfo
public interface IAcUserToCompanyBase : IEntityGuid, IAcUserForeignKey, IAcCompanyForeignKey, ITimeStampInfo
{
}

View File

@ -2,11 +2,11 @@
namespace AyCode.Interfaces.Users;
public interface IAcUserToServiceProviderRelation<TUser, TServiceProvider, TUserToServiceProvider>
where TUser : class, IAcUserBase, IAcServiceProviderRelation<TServiceProvider, TUserToServiceProvider>
where TServiceProvider : class, IAcServiceProviderBase
where TUserToServiceProvider : class, IAcUserToServiceProviderBase
public interface IAcUserToServiceProviderRelation<TUser, TCompany, TUserToServiceProvider>
where TUser : class, IAcUserBase, IAcCompanyRelation<TCompany, TUserToServiceProvider>
where TCompany : class, IAcCompanyBase
where TUserToServiceProvider : class, IAcUserToCompanyBase
{
public TUser User { get; set; }
public TServiceProvider ServiceProvider { get; set; }
public TCompany ServiceProvider { get; set; }
}

View File

@ -2,7 +2,7 @@
public interface IAcUsersRelation<TUser, TUserToServiceProvider>
where TUser : IAcUserBase
where TUserToServiceProvider : IAcUserToServiceProviderBase
where TUserToServiceProvider : IAcUserToCompanyBase
{
public List<TUser> Users { get; set; }
public List<TUserToServiceProvider> UserToServiceProviders { get; set; }

View File

@ -7,13 +7,13 @@ using AyCode.Interfaces.Server.Logins;
namespace AyCode.Models.Server.Logins;
public class AcLoggedInModelServer<TUser, TUserToken, TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress> : IAcLoggedInModelBase<TUser, TUserToken, TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress>
public class AcLoggedInModelServer<TUser, TUserToken, TProfile, TCompany, TUserToServiceProvider, TProfileAddress> : IAcLoggedInModelBase<TUser, TUserToken, TProfile, TCompany, TUserToServiceProvider, TProfileAddress>
where TUser : class, IAcUser<TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress>
where TUser : class, IAcUser<TProfile, TCompany, TUserToServiceProvider, TProfileAddress>
where TUserToken : class, IAcUserTokenBase
where TProfile : class, IAcProfile<TProfileAddress>
where TServiceProvider : class, IAcServiceProviderBase
where TUserToServiceProvider : class, IAcUserToServiceProviderBase
where TCompany : class, IAcCompanyBase
where TUserToServiceProvider : class, IAcUserToCompanyBase
where TProfileAddress : class, IAcAddress
{
public bool IsLoggedIn => LoggedInUser != null;

View File

@ -7,20 +7,20 @@ using AyCode.Interfaces.Users.Dtos;
namespace AyCode.Models.Users;
public abstract class AcUserModelDtoBase<TUserDto, TProfile, TProfileDto, TServiceProvider, TUserToServiceProvider, TProfileAddress> : AcUserModelDtoMinBase<TUserDto, TProfile, TProfileDto, TProfileAddress>, IAcServiceProviderRelation<TServiceProvider, TUserToServiceProvider>
where TUserDto : class, IAcUserDtoBase<TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress>
public abstract class AcUserModelDtoBase<TUserDto, TProfile, TProfileDto, TCompany, TUserToServiceProvider, TProfileAddress> : AcUserModelDtoMinBase<TUserDto, TProfile, TProfileDto, TProfileAddress>, IAcCompanyRelation<TCompany, TUserToServiceProvider>
where TUserDto : class, IAcUserDtoBase<TProfile, TCompany, TUserToServiceProvider, TProfileAddress>
where TProfile : class, IAcProfile<TProfileAddress>
where TProfileDto : class, IAcProfileDtoBase
where TServiceProvider : class, IAcServiceProviderBase
where TUserToServiceProvider : class, IAcUserToServiceProviderBase
where TCompany : class, IAcCompanyBase
where TUserToServiceProvider : class, IAcUserToCompanyBase
where TProfileAddress : class, IAcAddress
{
public List<TServiceProvider> ServiceProviders { get; set; }
public List<TCompany> ServiceProviders { get; set; }
public List<TUserToServiceProvider> UserToServiceProviders { get; set; }
protected AcUserModelDtoBase() {}
protected AcUserModelDtoBase(IAcUserDtoBase<TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress> user) : base(user)
protected AcUserModelDtoBase(IAcUserDtoBase<TProfile, TCompany, TUserToServiceProvider, TProfileAddress> user) : base(user)
{
Profile.AddressId = user.Profile.AddressId;
UserDto.AffiliateId = user.AffiliateId;
@ -28,15 +28,15 @@ public abstract class AcUserModelDtoBase<TUserDto, TProfile, TProfileDto, TServi
//így proxy error lesz... - J.
//ServiceProviders = new List<TServiceProvider>(user.ServiceProviders);
//ServiceProviders = new List<TCompany>(user.ServiceProviders);
//UserToServiceProviders = new List<TUserToServiceProvider>(user.UserToServiceProviders);
ServiceProviders = new List<TServiceProvider>(user.ServiceProviders.Count);
ServiceProviders = new List<TCompany>(user.ServiceProviders.Count);
UserToServiceProviders = new List<TUserToServiceProvider>(user.UserToServiceProviders.Count);
foreach (var serviceProvider in user.ServiceProviders)
{
var newProvider = Activator.CreateInstance<TServiceProvider>();
var newProvider = Activator.CreateInstance<TCompany>();
newProvider.Id = serviceProvider.Id;
newProvider.Name = serviceProvider.Name;

View File

@ -7,16 +7,16 @@ using AyCode.Interfaces.Users.Dtos;
namespace AyCode.Models.Users;
public abstract class AcUserModelDtoDetailBase<TUserDtoDetail, TProfile, TProfileDto, TServiceProvider, TUserToServiceProvider, TProfileAddress> : AcUserModelDtoBase<TUserDtoDetail, TProfile, TProfileDto, TServiceProvider, TUserToServiceProvider, TProfileAddress>
where TUserDtoDetail : class, IAcUserDtoDetailBase<TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress>
public abstract class AcUserModelDtoDetailBase<TUserDtoDetail, TProfile, TProfileDto, TCompany, TUserToServiceProvider, TProfileAddress> : AcUserModelDtoBase<TUserDtoDetail, TProfile, TProfileDto, TCompany, TUserToServiceProvider, TProfileAddress>
where TUserDtoDetail : class, IAcUserDtoDetailBase<TProfile, TCompany, TUserToServiceProvider, TProfileAddress>
where TProfile : class, IAcProfile<TProfileAddress>
where TProfileDto : class, IAcProfileDtoBase
where TServiceProvider : class, IAcServiceProviderBase
where TUserToServiceProvider : class, IAcUserToServiceProviderBase
where TCompany : class, IAcCompanyBase
where TUserToServiceProvider : class, IAcUserToCompanyBase
where TProfileAddress : class, IAcAddress
{
protected AcUserModelDtoDetailBase() {}
protected AcUserModelDtoDetailBase(IAcUserDtoDetailBase<TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress> user) : base(user)
protected AcUserModelDtoDetailBase(IAcUserDtoDetailBase<TProfile, TCompany, TUserToServiceProvider, TProfileAddress> user) : base(user)
{
UserDto.EmailAddress = user.EmailAddress;
UserDto.PhoneNumber = user.PhoneNumber;

View File

@ -15,17 +15,17 @@ using AyCode.Utils.Extensions;
namespace AyCode.Services.Server.Tests.LoginServices
{
public abstract class AcLoginServiceServerTestBase<TDal, TDbContext, TLoginServiceServer, TResultLoggedInModel, TUser, TProfile, TUserToken, TServiceProvider, TUserToServiceProvider, TProfileAddress, TEmailMessage> : AcDatabaseTestModelBase<TDal, TDbContext>
where TDal : AcUserDalBase<TDbContext, TUser, TProfile, TUserToken, TServiceProvider, TUserToServiceProvider, TProfileAddress, TEmailMessage>
where TDbContext : AcDbContextBase, IAcUserDbContextBase<TUser, TProfile, TUserToken, TServiceProvider, TUserToServiceProvider, TProfileAddress, TEmailMessage>
where TLoginServiceServer : class, IAcLoginServiceServer<TResultLoggedInModel, TUser, TUserToken, TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress>
where TResultLoggedInModel: class, IAcLoggedInModelBase<TUser, TUserToken, TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress>
where TUser : class, IAcUser<TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress>
public abstract class AcLoginServiceServerTestBase<TDal, TDbContext, TLoginServiceServer, TResultLoggedInModel, TUser, TProfile, TUserToken, TCompany, TUserToServiceProvider, TProfileAddress, TEmailMessage> : AcDatabaseTestModelBase<TDal, TDbContext>
where TDal : AcUserDalBase<TDbContext, TUser, TProfile, TUserToken, TCompany, TUserToServiceProvider, TProfileAddress, TEmailMessage>
where TDbContext : AcDbContextBase, IAcUserDbContextBase<TUser, TProfile, TUserToken, TCompany, TUserToServiceProvider, TProfileAddress, TEmailMessage>
where TLoginServiceServer : class, IAcLoginServiceServer<TResultLoggedInModel, TUser, TUserToken, TProfile, TCompany, TUserToServiceProvider, TProfileAddress>
where TResultLoggedInModel: class, IAcLoggedInModelBase<TUser, TUserToken, TProfile, TCompany, TUserToServiceProvider, TProfileAddress>
where TUser : class, IAcUser<TProfile, TCompany, TUserToServiceProvider, TProfileAddress>
where TProfile : class, IAcProfile<TProfileAddress>
where TProfileAddress : class, IAcAddress
where TUserToken : class, IAcUserTokenBase
where TServiceProvider : class, IAcServiceProviderBase
where TUserToServiceProvider : class, IAcUserToServiceProviderBase
where TCompany : class, IAcCompanyBase
where TUserToServiceProvider : class, IAcUserToCompanyBase
where TEmailMessage : class, IAcEmailMessageBase
{
[DataTestMethod]

View File

@ -29,17 +29,17 @@ using Microsoft.Extensions.Configuration;
namespace AyCode.Services.Server.Logins;
public class AcLoginServiceServer<TResultLoggedInModel, TDal, TDbContext, TUser, TUserToken, TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress, TEmailMessage>(TDal userDal, IConfiguration configuration)
: AcLoginServiceBase<TUser, TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress>, IAcLoginServiceServer<TResultLoggedInModel, TUser, TUserToken, TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress>
public class AcLoginServiceServer<TResultLoggedInModel, TDal, TDbContext, TUser, TUserToken, TProfile, TCompany, TUserToServiceProvider, TProfileAddress, TEmailMessage>(TDal userDal, IConfiguration configuration)
: AcLoginServiceBase<TUser, TProfile, TCompany, TUserToServiceProvider, TProfileAddress>, IAcLoginServiceServer<TResultLoggedInModel, TUser, TUserToken, TProfile, TCompany, TUserToServiceProvider, TProfileAddress>
where TResultLoggedInModel : class, IAcLoggedInModelBase<TUser, TUserToken, TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress>
where TDal : AcUserDalBase<TDbContext, TUser, TProfile, TUserToken, TServiceProvider, TUserToServiceProvider, TProfileAddress, TEmailMessage>
where TDbContext : AcDbContextBase, IAcUserDbContextBase<TUser, TProfile, TUserToken, TServiceProvider, TUserToServiceProvider, TProfileAddress, TEmailMessage>
where TUser : class, IAcUser<TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress>
where TResultLoggedInModel : class, IAcLoggedInModelBase<TUser, TUserToken, TProfile, TCompany, TUserToServiceProvider, TProfileAddress>
where TDal : AcUserDalBase<TDbContext, TUser, TProfile, TUserToken, TCompany, TUserToServiceProvider, TProfileAddress, TEmailMessage>
where TDbContext : AcDbContextBase, IAcUserDbContextBase<TUser, TProfile, TUserToken, TCompany, TUserToServiceProvider, TProfileAddress, TEmailMessage>
where TUser : class, IAcUser<TProfile, TCompany, TUserToServiceProvider, TProfileAddress>
where TUserToken : class, IAcUserTokenBase
where TProfile : class, IAcProfile<TProfileAddress>
where TServiceProvider : class, IAcServiceProviderBase
where TUserToServiceProvider : class, IAcUserToServiceProviderBase
where TCompany : class, IAcCompanyBase
where TUserToServiceProvider : class, IAcUserToCompanyBase
where TProfileAddress : class, IAcAddress
where TEmailMessage : class, IAcEmailMessageBase
{

View File

@ -6,11 +6,11 @@ using AyCode.Interfaces.Users;
namespace AyCode.Services.Logins;
public abstract class AcLoginServiceBase<TUser, TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress> : IAcLoginServiceBase<TUser, TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress>
where TUser : class, IAcUser<TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress>
public abstract class AcLoginServiceBase<TUser, TProfile, TCompany, TUserToServiceProvider, TProfileAddress> : IAcLoginServiceBase<TUser, TProfile, TCompany, TUserToServiceProvider, TProfileAddress>
where TUser : class, IAcUser<TProfile, TCompany, TUserToServiceProvider, TProfileAddress>
where TProfile : class, IAcProfile<TProfileAddress>
where TServiceProvider : class, IAcServiceProviderBase
where TUserToServiceProvider : class, IAcUserToServiceProviderBase
where TCompany : class, IAcCompanyBase
where TUserToServiceProvider : class, IAcUserToCompanyBase
where TProfileAddress : class, IAcAddress
{
public virtual bool IsLoggedIn => LoggedInUser != null;

View File

@ -8,13 +8,13 @@ using AyCode.Interfaces.Users;
namespace AyCode.Services.Logins;
public class AcLoginServiceClient<TUser, TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress>
: AcLoginServiceBase<TUser, TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress>, IAcLoginServiceClient<TUser, TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress>
public class AcLoginServiceClient<TUser, TProfile, TCompany, TUserToServiceProvider, TProfileAddress>
: AcLoginServiceBase<TUser, TProfile, TCompany, TUserToServiceProvider, TProfileAddress>, IAcLoginServiceClient<TUser, TProfile, TCompany, TUserToServiceProvider, TProfileAddress>
where TUser : class, IAcUser<TProfile, TServiceProvider, TUserToServiceProvider, TProfileAddress>
where TUser : class, IAcUser<TProfile, TCompany, TUserToServiceProvider, TProfileAddress>
where TProfile : class, IAcProfile<TProfileAddress>
where TServiceProvider : class, IAcServiceProviderBase
where TUserToServiceProvider : class, IAcUserToServiceProviderBase
where TCompany : class, IAcCompanyBase
where TUserToServiceProvider : class, IAcUserToCompanyBase
where TProfileAddress : class, IAcAddress
{
public virtual TUser? Login(string email, string password, out string accessToken)