retroactiune/Retroactiune.Core/Entities/Feedback.cs

40 lines
1,008 B
C#
Raw Normal View History

2021-07-04 12:24:57 +00:00
using System;
using System.Text.Json.Serialization;
using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
namespace Retroactiune.Core.Entities
2021-06-09 21:03:07 +00:00
{
2021-07-04 12:24:57 +00:00
/// <summary>
/// Feedback is the feedback given to the <see cref="FeedbackReceiver"/>.
/// </summary>
2021-06-09 21:03:07 +00:00
public class Feedback
{
2021-07-04 12:24:57 +00:00
private uint _rating;
[BsonId, JsonPropertyName("id")]
[BsonRepresentation(BsonType.ObjectId)]
public string Id { get; set; }
[JsonPropertyName("rating")]
public uint Rating
{
get => _rating;
set
{
if (value <= 5)
{
_rating = value;
}
else
{
throw new ArgumentException();
}
}
}
[JsonPropertyName("description")] public string Description { get; set; }
[JsonPropertyName("created_at")] public DateTime CreatedAt { get; set; }
2021-06-09 21:03:07 +00:00
}
}