aboutsummaryrefslogtreecommitdiff
path: root/BackEnd/Timeline/Models
diff options
context:
space:
mode:
Diffstat (limited to 'BackEnd/Timeline/Models')
-rw-r--r--BackEnd/Timeline/Models/Http/ErrorResponse.cs19
-rw-r--r--BackEnd/Timeline/Models/Validation/PositiveIntegerAttribute.cs12
2 files changed, 31 insertions, 0 deletions
diff --git a/BackEnd/Timeline/Models/Http/ErrorResponse.cs b/BackEnd/Timeline/Models/Http/ErrorResponse.cs
new file mode 100644
index 00000000..119e3977
--- /dev/null
+++ b/BackEnd/Timeline/Models/Http/ErrorResponse.cs
@@ -0,0 +1,19 @@
+namespace Timeline.Models.Http
+{
+ public class ErrorResponse
+ {
+ public const string InvalidRequest = "INVALID_REQUEST";
+ public const string EntityExist = "ENTITY_EXIST";
+ public const string InvalidOperation = "INVALID_OPERATION";
+
+ public ErrorResponse(string error, string message)
+ {
+ Error = error;
+ Message = message;
+ }
+
+ public string Error { get; set; }
+
+ public string Message { get; set; }
+ }
+}
diff --git a/BackEnd/Timeline/Models/Validation/PositiveIntegerAttribute.cs b/BackEnd/Timeline/Models/Validation/PositiveIntegerAttribute.cs
new file mode 100644
index 00000000..78e2f0b4
--- /dev/null
+++ b/BackEnd/Timeline/Models/Validation/PositiveIntegerAttribute.cs
@@ -0,0 +1,12 @@
+using System.ComponentModel.DataAnnotations;
+
+namespace Timeline.Models.Validation
+{
+ public class PositiveIntegerAttribute : RangeAttribute
+ {
+ public PositiveIntegerAttribute() : base(1, int.MaxValue)
+ {
+ }
+ }
+}
+