feat: Implement file management and authorization features
Build and Deploy to Kubernetes / build-and-deploy (push) Failing after 3m9s

- Add RequiresPermissionAttribute for gRPC method access control.
- Create IFileManagementService interface for file upload and management.
- Implement AddProductImageCommand and handler for adding product images.
- Implement CreateNewProductsCommand and handler for creating new products with image uploads.
- Implement DeleteProductsCommand and handler for deleting products and their associations.
- Implement RemoveProductImageCommand and handler for removing product images from galleries.
- Implement UpdateProductsCommand and handler for updating product details and images.
- Create GetProductGalleryQuery and handler for retrieving product galleries.
- Implement PermissionService for role-based access control using JWT claims.
- Implement FileManagementService for handling file uploads and image optimization.
- Define gRPC service and messages for file management in fms.proto.
- Add FluentValidation for request validation in various commands.
- Create PermissionInterceptor for enforcing permissions on gRPC methods.
This commit is contained in:
masoodafar-web
2026-02-10 22:04:54 +03:30
parent f64b6be7da
commit b42d9e141d
65 changed files with 3082 additions and 2384 deletions
@@ -18,14 +18,11 @@ public class OtpToken : BaseAuditableEntity
public bool IsUsed { get; set; }
/// <summary>
/// Validates if the provided code is correct and token is not expired
/// Checks if token is still valid (not used and not expired).
/// Code verification should be done in the handler using IHashService.
/// </summary>
public bool IsValid(string providedCode)
public bool IsValid()
{
if (IsUsed || DateTime.UtcNow > ExpiresAt)
return false;
// Use BCrypt to verify the provided code against the stored hash
return BCrypt.Net.BCrypt.Verify(providedCode, CodeHash);
return !IsUsed && DateTime.Now > ExpiresAt == false;
}
}
@@ -1,11 +0,0 @@
namespace CMSMicroservice.Domain.Entities;
//گالری تصاویر محصول
public class ProductGalleries : BaseAuditableEntity
{
public long ProductImageId { get; set; }
//ProductImage Navigation Property
public virtual ProductImage ProductImage { get; set; }
public long ProductId { get; set; }
//Product Navigation Property
public virtual Products Product { get; set; }
}
@@ -1,10 +0,0 @@
namespace CMSMicroservice.Domain.Entities;
//توکن Otp
public class ProductImages : BaseAuditableEntity
{
public string Title { get; set; }
public string ImagePath { get; set; }
public string ImageThumbnailPath { get; set; }
//ProductGalleries Collection Navigation Reference
public virtual ICollection<ProductGalleries> ProductGalleries { get; set; }
}
@@ -1,42 +0,0 @@
namespace CMSMicroservice.Domain.Entities;
//توکن Otp
public class Products : BaseAuditableEntity
{
public string Title { get; set; }
public string Description { get; set; }
public string ShortInfomation { get; set; }
public string FullInformation { get; set; }
public long Price { get; set; }
public int Discount { get; set; }
public int Rate { get; set; }
public string ImagePath { get; set; }
public string ThumbnailPath { get; set; }
public int SaleCount { get; set; }
public int ViewCount { get; set; }
public int RemainingCount { get; set; }
// ============= Club Shop Fields =============
/// <summary>
/// آیا این محصول فقط در فروشگاه باشگاه موجود است
/// </summary>
public bool IsClubExclusive { get; set; }
/// <summary>
/// درصد تخفیف باشگاه (0 تا 100)
/// </summary>
public int ClubDiscountPercent { get; set; }
// ============= Navigation Properties =============
//UserCarts Collection Navigation Reference
public virtual ICollection<UserCart> UserCarts { get; set; }
//ProductGalleries Collection Navigation Reference
public virtual ICollection<ProductGallery> ProductGalleries { get; set; }
//FactorDetails Collection Navigation Reference
public virtual ICollection<FactorDetails> FactorDetails { get; set; }
//ProductCategory Collection Navigation Reference
public virtual ICollection<ProductCategory> ProductCategories { get; set; }
//ProductTag Collection Navigation Reference
public virtual ICollection<ProductTag> ProductTags { get; set; }
}