littleshop/LittleShop/DTOs/ReviewDto.cs
SysAdmin e1b377a042 Initial commit of LittleShop project (excluding large archives)
- BTCPay Server integration
- TeleBot Telegram bot
- Review system
- Admin area
- Docker deployment configuration

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-17 15:07:38 +01:00

86 lines
2.7 KiB
C#

using System.ComponentModel.DataAnnotations;
namespace LittleShop.DTOs;
public class ReviewDto
{
public Guid Id { get; set; }
public Guid ProductId { get; set; }
public string ProductName { get; set; } = string.Empty;
public Guid CustomerId { get; set; }
public string CustomerDisplayName { get; set; } = string.Empty;
public Guid OrderId { get; set; }
public int Rating { get; set; }
public string? Title { get; set; }
public string? Comment { get; set; }
public bool IsVerifiedPurchase { get; set; }
public bool IsApproved { get; set; }
public bool IsActive { get; set; }
public DateTime CreatedAt { get; set; }
public DateTime UpdatedAt { get; set; }
public DateTime? ApprovedAt { get; set; }
public string? ApprovedByUsername { get; set; }
}
public class CreateReviewDto
{
[Required]
public Guid ProductId { get; set; }
[Required]
public Guid CustomerId { get; set; }
[Required]
public Guid OrderId { get; set; }
[Required]
[Range(1, 5, ErrorMessage = "Rating must be between 1 and 5 stars")]
public int Rating { get; set; }
[StringLength(100, ErrorMessage = "Title cannot exceed 100 characters")]
public string? Title { get; set; }
[StringLength(2000, ErrorMessage = "Comment cannot exceed 2000 characters")]
public string? Comment { get; set; }
}
public class UpdateReviewDto
{
[Range(1, 5, ErrorMessage = "Rating must be between 1 and 5 stars")]
public int? Rating { get; set; }
[StringLength(100, ErrorMessage = "Title cannot exceed 100 characters")]
public string? Title { get; set; }
[StringLength(2000, ErrorMessage = "Comment cannot exceed 2000 characters")]
public string? Comment { get; set; }
public bool? IsApproved { get; set; }
public bool? IsActive { get; set; }
}
public class ReviewSummaryDto
{
public Guid ProductId { get; set; }
public string ProductName { get; set; } = string.Empty;
public int TotalReviews { get; set; }
public int ApprovedReviews { get; set; }
public double AverageRating { get; set; }
public int FiveStars { get; set; }
public int FourStars { get; set; }
public int ThreeStars { get; set; }
public int TwoStars { get; set; }
public int OneStar { get; set; }
public DateTime? LatestReviewDate { get; set; }
}
public class CustomerReviewEligibilityDto
{
public Guid CustomerId { get; set; }
public Guid ProductId { get; set; }
public bool CanReview { get; set; }
public string? Reason { get; set; }
public List<Guid> EligibleOrderIds { get; set; } = new();
public bool HasExistingReview { get; set; }
public Guid? ExistingReviewId { get; set; }
}