Просмотр исходного кода

Add Dtos, Repositories and basic mappings

Dalibor Votruba 3 лет назад
Родитель
Сommit
e852c4aa2c

+ 11 - 0
Common/qdr.app.qlbrc.common/Dtos/QlbrcDtoTrackedWithId.cs

@@ -0,0 +1,11 @@
+using Quadarax.Application.QLiberace.Common.Entities.Base;
+
+namespace Quadarax.Application.QLiberace.Common.Dtos
+{
+    public class QlbrcDtoTrackedWithId : QlbrcDtoWithId, ITracked
+    {
+        public DateTime Created { get; }
+        public DateTime? Modified { get; }
+        public string Modifier { get; }
+    }
+}

+ 11 - 0
Common/qdr.app.qlbrc.common/Dtos/QlbrcDtoTrackedWithoutId.cs

@@ -0,0 +1,11 @@
+using Quadarax.Application.QLiberace.Common.Entities.Base;
+
+namespace Quadarax.Application.QLiberace.Common.Dtos
+{
+    public class QlbrcDtoTrackedWithoutId : QlbrcDtoWithoutId, ITracked
+    {
+        public DateTime Created { get; }
+        public DateTime? Modified { get; }
+        public string Modifier { get; }
+    }
+}

+ 10 - 0
Common/qdr.app.qlbrc.common/Dtos/QlbrcDtoWithId.cs

@@ -0,0 +1,10 @@
+using Quadarax.Application.QLiberace.Common.Entities.Base;
+using Quadarax.Foundation.Core.Data.Interface.Entity;
+
+namespace Quadarax.Application.QLiberace.Common.Dtos
+{
+    public class QlbrcDtoWithId : IDto, IIdentifier
+    {
+        public long Id { get; }
+    }
+}

+ 8 - 0
Common/qdr.app.qlbrc.common/Dtos/QlbrcDtoWithoutId.cs

@@ -0,0 +1,8 @@
+using Quadarax.Foundation.Core.Data.Interface.Entity;
+
+namespace Quadarax.Application.QLiberace.Common.Dtos
+{
+    public class QlbrcDtoWithoutId : IDto
+    {
+    }
+}

+ 0 - 4
Common/qdr.app.qlbrc.common/qdr.app.qlbrc.common.csproj

@@ -12,8 +12,4 @@
     <ProjectReference Include="..\qdr.fnd.core.data\qdr.fnd.core.data.csproj" />
   </ItemGroup>
 
-  <ItemGroup>
-    <Folder Include="Dtos\" />
-  </ItemGroup>
-
 </Project>

+ 24 - 0
Modules/qdr.app.qlbrc.base/Constants.cs

@@ -0,0 +1,24 @@
+namespace Quadarax.Application.QLiberace.Base
+{
+    public class Constants
+    {
+        public class Defaults
+        {
+            public const string DatabaseName = "QLiberace";
+        }
+        public class Modules
+        {
+            public class Base
+            {
+                public const string Name = "Base";
+                public const string Code = "base";
+                public const string Schema = "base";
+
+                public const string TblUser = "User";
+                public const string TblSetting = "Setting";
+                public const string TblTenant = "Tenant";
+
+            }
+        }
+    }
+}

+ 12 - 0
Modules/qdr.app.qlbrc.base/Dtos/TenantDto.cs

@@ -0,0 +1,12 @@
+using Quadarax.Application.QLiberace.Base.Entities.Interfaces;
+
+namespace Quadarax.Application.QLiberace.Base.Dtos
+{
+    public class TenantDto : IStructTenant
+    {
+        public string Code { get; set; }
+        public string Name { get; set; }
+        public DateTime? LastAccess { get; set; }
+        public bool IsLocked { get; set; }
+    }
+}

+ 11 - 0
Modules/qdr.app.qlbrc.base/Dtos/UserDto.cs

@@ -0,0 +1,11 @@
+using Quadarax.Application.QLiberace.Base.Entities.Interfaces;
+using Quadarax.Application.QLiberace.Common.Dtos;
+
+namespace Quadarax.Application.QLiberace.Base.Dtos
+{
+    public class UserDto : QlbrcDtoTrackedWithId, IStructUser
+    {
+        public string LoginName { get; set; }
+        public bool IsLocked { get; set; }
+    }
+}

+ 13 - 0
Modules/qdr.app.qlbrc.base/Entities/Interfaces/IStructSetting.cs

@@ -0,0 +1,13 @@
+namespace Quadarax.Application.QLiberace.Base.Entities.Interfaces;
+
+public interface IStructSetting
+{
+    long ParentId { get; set; }
+    int SequenceNo { get; set; }
+    string ModuleCode { get; set; }
+    string Code { get; set; }
+    string Description { get; set; }
+    string ValueTypeQN { get; set; }
+    string Value { get; set; }
+    string IsEnabled { get; set; }
+}

+ 9 - 0
Modules/qdr.app.qlbrc.base/Entities/Interfaces/IStructTenant.cs

@@ -0,0 +1,9 @@
+namespace Quadarax.Application.QLiberace.Base.Entities.Interfaces;
+
+public interface IStructTenant
+{
+    string Code { get; set; }
+    string Name { get; set; }
+    DateTime? LastAccess { get; set; }
+    bool IsLocked { get; set; }
+}

+ 7 - 0
Modules/qdr.app.qlbrc.base/Entities/Interfaces/IStructUser.cs

@@ -0,0 +1,7 @@
+namespace Quadarax.Application.QLiberace.Base.Entities.Interfaces;
+
+public interface IStructUser
+{
+    string LoginName { get; set; }
+    bool IsLocked { get; set; }
+}

+ 6 - 2
Modules/qdr.app.qlbrc.base/Entities/Setting.cs

@@ -1,7 +1,11 @@
-using Quadarax.Application.QLiberace.Common.Entities.Base;
+using Quadarax.Application.QLiberace.Base.Entities.Interfaces;
+using Quadarax.Application.QLiberace.Common.Entities.Base;
+using System.ComponentModel.DataAnnotations.Schema;
 
 namespace Quadarax.Application.QLiberace.Base.Entities;
-public class Setting : QlbrcEntityTrackedWithoutId
+
+[Table(Constants.Modules.Base.TblSetting,Schema = Constants.Modules.Base.Schema)]
+public class Setting : QlbrcEntityTrackedWithoutId, IStructSetting
 {
     public long ParentId { get; set; }
     public int SequenceNo { get; set; }

+ 5 - 2
Modules/qdr.app.qlbrc.base/Entities/Tenant.cs

@@ -1,8 +1,11 @@
-using Quadarax.Application.QLiberace.Common.Entities.Base;
+using Quadarax.Application.QLiberace.Base.Entities.Interfaces;
+using Quadarax.Application.QLiberace.Common.Entities.Base;
+using System.ComponentModel.DataAnnotations.Schema;
 
 namespace Quadarax.Application.QLiberace.Base.Entities
 {
-    public class Tenant : QlbrcEntityTrackedWithId
+    [Table(Constants.Modules.Base.TblTenant,Schema = Constants.Modules.Base.Schema)]
+    public class Tenant : QlbrcEntityTrackedWithId, IStructTenant
     {
         public string Code { get; set; }
         public string Name { get; set; }

+ 5 - 2
Modules/qdr.app.qlbrc.base/Entities/User.cs

@@ -1,8 +1,11 @@
-using Quadarax.Application.QLiberace.Common.Entities.Base;
+using Quadarax.Application.QLiberace.Base.Entities.Interfaces;
+using Quadarax.Application.QLiberace.Common.Entities.Base;
+using System.ComponentModel.DataAnnotations.Schema;
 
 namespace Quadarax.Application.QLiberace.Base.Entities
 {
-    public class User : QlbrcEntityTrackedWithId
+    [Table(Constants.Modules.Base.TblUser,Schema = Constants.Modules.Base.Schema)]
+    public class User : QlbrcEntityTrackedWithId, IStructUser
     {
         public string LoginName { get; set; }
         public bool IsLocked { get; set; }

+ 14 - 0
Modules/qdr.app.qlbrc.base/Repositories/RepoSetting.cs

@@ -0,0 +1,14 @@
+using Quadarax.Application.QLiberace.Base.Entities;
+using Quadarax.Foundation.Core.Data.Repository;
+using Quadarax.Foundation.Core.Data.Domain;
+using Quadarax.Foundation.Core.Data.Interface.Domain;
+
+namespace Quadarax.Application.QLiberace.Base.Repositories
+{
+    public class RepoSetting : EntityRepository<long, Setting>
+    {
+        public RepoSetting(IUnitOfWork<DataDomain> unitOfWork) : base(unitOfWork)
+        {
+        }
+    }
+}

+ 14 - 0
Modules/qdr.app.qlbrc.base/Repositories/RepoTenant.cs

@@ -0,0 +1,14 @@
+using Quadarax.Application.QLiberace.Base.Entities;
+using Quadarax.Foundation.Core.Data.Repository;
+using Quadarax.Foundation.Core.Data.Domain;
+using Quadarax.Foundation.Core.Data.Interface.Domain;
+
+namespace Quadarax.Application.QLiberace.Base.Repositories
+{
+    public class RepoTenant: EntityRepository<long, Tenant>
+    {
+        public RepoTenant(IUnitOfWork<DataDomain> unitOfWork) : base(unitOfWork)
+        {
+        }
+    }
+}

+ 14 - 0
Modules/qdr.app.qlbrc.base/Repositories/RepoUser.cs

@@ -0,0 +1,14 @@
+using Quadarax.Application.QLiberace.Base.Entities;
+using Quadarax.Foundation.Core.Data.Domain;
+using Quadarax.Foundation.Core.Data.Interface.Domain;
+using Quadarax.Foundation.Core.Data.Repository;
+
+namespace Quadarax.Application.QLiberace.Base.Repositories
+{
+    public class RepoUser : EntityRepository<long, User>
+    {
+        public RepoUser(IUnitOfWork<DataDomain> unitOfWork) : base(unitOfWork)
+        {
+        }
+    }
+}

+ 1 - 0
Modules/qdr.app.qlbrc.base/qdr.app.qlbrc.base.csproj

@@ -14,6 +14,7 @@
 
   <ItemGroup>
     <Folder Include="Entities\Base\" />
+    <Folder Include="Services\" />
   </ItemGroup>
 
 </Project>