Generator Changes at 9/27/2025 8:46:36 AM

This commit is contained in:
generator
2025-09-27 08:46:36 +03:30
parent fd82e3edcf
commit fd8614f72e
261 changed files with 6333 additions and 0 deletions

View File

@@ -0,0 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="MediatR" Version="11.0.0" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,13 @@
namespace CMSMicroservice.Domain.Common;
public abstract class BaseAuditableEntity : BaseEntity
{
public DateTime Created { get; set; }
public string? CreatedBy { get; set; }
public DateTime? LastModified { get; set; }
public string? LastModifiedBy { get; set; }
public bool IsDeleted { get; set; }
}

View File

@@ -0,0 +1,24 @@
namespace CMSMicroservice.Domain.Common;
public abstract class BaseEntity
{
public long Id { get; set; }
private readonly List<BaseEvent> _domainEvents = new();
public IReadOnlyCollection<BaseEvent> DomainEvents => _domainEvents.AsReadOnly();
public void AddDomainEvent(BaseEvent domainEvent)
{
_domainEvents.Add(domainEvent);
}
public void RemoveDomainEvent(BaseEvent domainEvent)
{
_domainEvents.Remove(domainEvent);
}
public void ClearDomainEvents()
{
_domainEvents.Clear();
}
}

View File

@@ -0,0 +1,4 @@
namespace CMSMicroservice.Domain.Common;
public abstract class BaseEvent : INotification
{
}

View File

@@ -0,0 +1,38 @@
namespace CMSMicroservice.Domain.Common;
public abstract class ValueObject
{
protected static bool EqualOperator(ValueObject left, ValueObject right)
{
if (left is null ^ right is null)
{
return false;
}
return left?.Equals(right!) != false;
}
protected static bool NotEqualOperator(ValueObject left, ValueObject right)
{
return !(EqualOperator(left, right));
}
protected abstract IEnumerable<object> GetEqualityComponents();
public override bool Equals(object? obj)
{
if (obj == null || obj.GetType() != GetType())
{
return false;
}
var other = (ValueObject)obj;
return GetEqualityComponents().SequenceEqual(other.GetEqualityComponents());
}
public override int GetHashCode()
{
return GetEqualityComponents()
.Select(x => x != null ? x.GetHashCode() : 0)
.Aggregate((x, y) => x ^ y);
}
}

View File

@@ -0,0 +1,15 @@
namespace CMSMicroservice.Domain.Entities;
//پکیج
public class Package : BaseAuditableEntity
{
//عنوان
public string Title { get; set; }
//توضیحات
public string Description { get; set; }
//آدرس تصویر
public string ImagePath { get; set; }
//قیمت
public long Price { get; set; }
//UserOrder Collection Navigation Reference
public virtual ICollection<UserOrder> UserOrders { get; set; }
}

View File

@@ -0,0 +1,11 @@
namespace CMSMicroservice.Domain.Entities;
//نقش
public class Role : BaseAuditableEntity
{
//نام لاتین
public string Name { get; set; }
//عنوان
public string Title { get; set; }
//UserRole Collection Navigation Reference
public virtual ICollection<UserRole> UserRoles { get; set; }
}

View File

@@ -0,0 +1,27 @@
namespace CMSMicroservice.Domain.Entities;
//کاربر
public class User : BaseAuditableEntity
{
//نام
public string? FirstName { get; set; }
//نام خانوادگی
public string? LastName { get; set; }
//شماره موبایل
public string Mobile { get; set; }
//کد ملی
public string? NationalCode { get; set; }
//آدرس آواتار
public string? AvatarPath { get; set; }
//شناسه والد
public long? ParentId { get; set; }
//User Navigation Property
public virtual User? Parent { get; set; }
//User Collection Navigation Reference
public virtual ICollection<User> Users { get; set; }
//UserAddress Collection Navigation Reference
public virtual ICollection<UserAddress> UserAddresss { get; set; }
//UserOrder Collection Navigation Reference
public virtual ICollection<UserOrder> UserOrders { get; set; }
//UserRole Collection Navigation Reference
public virtual ICollection<UserRole> UserRoles { get; set; }
}

View File

@@ -0,0 +1,19 @@
namespace CMSMicroservice.Domain.Entities;
//آدرس کاربر
public class UserAddress : BaseAuditableEntity
{
//شناسه کاربر
public long UserId { get; set; }
//User Navigation Property
public virtual User User { get; set; }
//عنوان
public string Title { get; set; }
//آدرس
public string Address { get; set; }
//کدپستی
public string PostalCode { get; set; }
//پیشفرض؟
public bool IsDefault { get; set; }
//شناسه شهر
public long CityId { get; set; }
}

View File

@@ -0,0 +1,21 @@
namespace CMSMicroservice.Domain.Entities;
//سفارش کاربر
public class UserOrder : BaseAuditableEntity
{
//قیمت
public long Price { get; set; }
//شناسه پکیج
public long PackageId { get; set; }
//Package Navigation Property
public virtual Package Package { get; set; }
//شناسه تراکنش
public long? TransactionId { get; set; }
//وضعیت پرداخت
public bool PaymentStatus { get; set; }
//تاریخ پرداخت
public DateTime? PaymentDate { get; set; }
//شناسه کاربر
public long UserId { get; set; }
//User Navigation Property
public virtual User User { get; set; }
}

View File

@@ -0,0 +1,13 @@
namespace CMSMicroservice.Domain.Entities;
//نقش کاربر
public class UserRole : BaseAuditableEntity
{
//شناسه نقش
public long RoleId { get; set; }
//Role Navigation Property
public virtual Role Role { get; set; }
//شناسه کاربر
public long UserId { get; set; }
//User Navigation Property
public virtual User User { get; set; }
}

View File

@@ -0,0 +1,10 @@
namespace CMSMicroservice.Domain.Events;
public class CreateNewPackageEvent : BaseEvent
{
public CreateNewPackageEvent(Package item)
{
Item = item;
}
public Package Item { get; }
}

View File

@@ -0,0 +1,10 @@
namespace CMSMicroservice.Domain.Events;
public class DeletePackageEvent : BaseEvent
{
public DeletePackageEvent(Package item)
{
Item = item;
}
public Package Item { get; }
}

View File

@@ -0,0 +1,10 @@
namespace CMSMicroservice.Domain.Events;
public class UpdatePackageEvent : BaseEvent
{
public UpdatePackageEvent(Package item)
{
Item = item;
}
public Package Item { get; }
}

View File

@@ -0,0 +1,10 @@
namespace CMSMicroservice.Domain.Events;
public class CreateNewRoleEvent : BaseEvent
{
public CreateNewRoleEvent(Role item)
{
Item = item;
}
public Role Item { get; }
}

View File

@@ -0,0 +1,10 @@
namespace CMSMicroservice.Domain.Events;
public class DeleteRoleEvent : BaseEvent
{
public DeleteRoleEvent(Role item)
{
Item = item;
}
public Role Item { get; }
}

View File

@@ -0,0 +1,10 @@
namespace CMSMicroservice.Domain.Events;
public class UpdateRoleEvent : BaseEvent
{
public UpdateRoleEvent(Role item)
{
Item = item;
}
public Role Item { get; }
}

View File

@@ -0,0 +1,10 @@
namespace CMSMicroservice.Domain.Events;
public class CreateNewUserAddressEvent : BaseEvent
{
public CreateNewUserAddressEvent(UserAddress item)
{
Item = item;
}
public UserAddress Item { get; }
}

View File

@@ -0,0 +1,10 @@
namespace CMSMicroservice.Domain.Events;
public class DeleteUserAddressEvent : BaseEvent
{
public DeleteUserAddressEvent(UserAddress item)
{
Item = item;
}
public UserAddress Item { get; }
}

View File

@@ -0,0 +1,10 @@
namespace CMSMicroservice.Domain.Events;
public class UpdateUserAddressEvent : BaseEvent
{
public UpdateUserAddressEvent(UserAddress item)
{
Item = item;
}
public UserAddress Item { get; }
}

View File

@@ -0,0 +1,10 @@
namespace CMSMicroservice.Domain.Events;
public class CreateNewUserEvent : BaseEvent
{
public CreateNewUserEvent(User item)
{
Item = item;
}
public User Item { get; }
}

View File

@@ -0,0 +1,10 @@
namespace CMSMicroservice.Domain.Events;
public class DeleteUserEvent : BaseEvent
{
public DeleteUserEvent(User item)
{
Item = item;
}
public User Item { get; }
}

View File

@@ -0,0 +1,10 @@
namespace CMSMicroservice.Domain.Events;
public class UpdateUserEvent : BaseEvent
{
public UpdateUserEvent(User item)
{
Item = item;
}
public User Item { get; }
}

View File

@@ -0,0 +1,10 @@
namespace CMSMicroservice.Domain.Events;
public class CreateNewUserOrderEvent : BaseEvent
{
public CreateNewUserOrderEvent(UserOrder item)
{
Item = item;
}
public UserOrder Item { get; }
}

View File

@@ -0,0 +1,10 @@
namespace CMSMicroservice.Domain.Events;
public class DeleteUserOrderEvent : BaseEvent
{
public DeleteUserOrderEvent(UserOrder item)
{
Item = item;
}
public UserOrder Item { get; }
}

View File

@@ -0,0 +1,10 @@
namespace CMSMicroservice.Domain.Events;
public class UpdateUserOrderEvent : BaseEvent
{
public UpdateUserOrderEvent(UserOrder item)
{
Item = item;
}
public UserOrder Item { get; }
}

View File

@@ -0,0 +1,10 @@
namespace CMSMicroservice.Domain.Events;
public class CreateNewUserRoleEvent : BaseEvent
{
public CreateNewUserRoleEvent(UserRole item)
{
Item = item;
}
public UserRole Item { get; }
}

View File

@@ -0,0 +1,10 @@
namespace CMSMicroservice.Domain.Events;
public class DeleteUserRoleEvent : BaseEvent
{
public DeleteUserRoleEvent(UserRole item)
{
Item = item;
}
public UserRole Item { get; }
}

View File

@@ -0,0 +1,10 @@
namespace CMSMicroservice.Domain.Events;
public class UpdateUserRoleEvent : BaseEvent
{
public UpdateUserRoleEvent(UserRole item)
{
Item = item;
}
public UserRole Item { get; }
}

View File

@@ -0,0 +1,10 @@
global using CMSMicroservice.Domain.Common;
global using CMSMicroservice.Domain.Entities;
global using CMSMicroservice.Domain.Events;
global using System.Threading;
global using System.Threading.Tasks;
global using System;
global using System.Collections.Generic;
global using System.Linq;
global using MediatR;