auto.bus_api/SharedModels/DataTransferObjects/ReviewDto.cs
cuqmbr e9af067dfa feat: add imperative resource-based authorization
I decided not to make authorization requirements and handlers for each and every resource because the validation logic is pretty similar
2023-05-22 15:27:11 +03:00

52 lines
1.2 KiB
C#

using System.ComponentModel.DataAnnotations;
namespace SharedModels.DataTransferObjects;
public class ReviewDto : CreateReviewDto
{
public int Id { get; set; }
[DataType(DataType.DateTime)]
public DateTime PostDateTime { get; set; }
public StrippedUserDto User { get; set; } = null!;
public InReviewVehicleEnrollmentDto VehicleEnrollment { get; set; } = null!;
}
public class CreateReviewDto
{
[Required]
public string UserId { get; set; } = null!;
[Required]
public int VehicleEnrollmentId { get; set; }
[Range(0,100)]
public int Rating { get; set; }
[MaxLength(255)]
public string Comment { get; set; } = null!;
}
public class UpdateReviewDto : CreateReviewDto
{
[Required]
public int Id { get; set; }
[DataType(DataType.DateTime)]
public DateTime PostDateTime { get; set; }
}
public class InVehicleEnrollmentReviewDto
{
public int Id { get; set; }
[DataType(DataType.DateTime)]
public DateTime PostDateTimeUtc { get; set; }
public string UserId { get; set; } = null!;
public int VehicleEnrollmentId { get; set; }
public int Rating { get; set; }
public string Comment { get; set; } = null!;
}