Files
CMS/src/CMSMicroservice.Domain/Entities/OtpToken.cs
T
masoodafar-web b42d9e141d
Build and Deploy to Kubernetes / build-and-deploy (push) Failing after 3m9s
feat: Implement file management and authorization features
- 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.
2026-02-10 22:04:54 +03:30

29 lines
825 B
C#

namespace CMSMicroservice.Domain.Entities;
//توکن Otp
public class OtpToken : BaseAuditableEntity
{
//موبایل مقصد
public string Mobile { get; set; }
//مقصود
public string Purpose { get; set; }
//کد
public string Code { get; set; }
//کد هش شده
public string CodeHash { get; set; }
//زمان انقضا
public DateTime ExpiresAt { get; set; }
//شمارش تلاش‌ها
public int Attempts { get; set; }
//موفق بود؟
public bool IsUsed { get; set; }
/// <summary>
/// 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()
{
return !IsUsed && DateTime.Now > ExpiresAt == false;
}
}