aboutsummaryrefslogtreecommitdiff
path: root/src/DevHive.Web/Models
diff options
context:
space:
mode:
authortranstrike <transtrike@gmail.com>2021-01-19 21:46:06 +0200
committertranstrike <transtrike@gmail.com>2021-01-19 21:46:06 +0200
commit8560caa13b7f7d0e80ee712c77efc59a80e8935c (patch)
tree02643afdd46122dfd904fbb8632117a5494081a8 /src/DevHive.Web/Models
parent661c3194b750e42146e9e28a33da08419b2b2cea (diff)
downloadDevHive-8560caa13b7f7d0e80ee712c77efc59a80e8935c.tar
DevHive-8560caa13b7f7d0e80ee712c77efc59a80e8935c.tar.gz
DevHive-8560caa13b7f7d0e80ee712c77efc59a80e8935c.zip
Added attributes to the Web models for validations
Diffstat (limited to 'src/DevHive.Web/Models')
-rw-r--r--src/DevHive.Web/Models/Identity/Role/CreateRoleWebModel.cs7
-rw-r--r--src/DevHive.Web/Models/Identity/Role/RoleWebModel.cs7
-rw-r--r--src/DevHive.Web/Models/Identity/Role/UpdateRoleWebModel.cs4
-rw-r--r--src/DevHive.Web/Models/Identity/User/BaseUserWebModel.cs7
-rw-r--r--src/DevHive.Web/Models/Identity/User/FriendWebModel.cs11
-rw-r--r--src/DevHive.Web/Models/Identity/User/LoginWebModel.cs13
-rw-r--r--src/DevHive.Web/Models/Identity/User/RegisterWebModel.cs4
-rw-r--r--src/DevHive.Web/Models/Identity/User/UpdateUserWebModel.cs10
-rw-r--r--src/DevHive.Web/Models/Identity/User/UserWebModel.cs10
-rw-r--r--src/DevHive.Web/Models/Identity/Validation/GoodPasswordModelValidation.cs24
-rw-r--r--src/DevHive.Web/Models/Identity/Validation/OnlyAlphanumericsModelValidation.cs20
-rw-r--r--src/DevHive.Web/Models/Identity/Validation/OnlyLettersModelValidation.cs20
-rw-r--r--src/DevHive.Web/Models/Language/CreateLanguageWebModel.cs9
-rw-r--r--src/DevHive.Web/Models/Language/LanguageWebModel.cs6
-rw-r--r--src/DevHive.Web/Models/Language/ReadLanguageWebModel.cs7
-rw-r--r--src/DevHive.Web/Models/Language/UpdateLanguageWebModel.cs7
-rw-r--r--src/DevHive.Web/Models/Middleware/ExceptionMiddleware.cs50
-rw-r--r--src/DevHive.Web/Models/Post/Comment/CommentWebModel.cs13
-rw-r--r--src/DevHive.Web/Models/Post/Post/BasePostWebModel.cs9
-rw-r--r--src/DevHive.Web/Models/Post/Post/CreatePostWebModel.cs6
-rw-r--r--src/DevHive.Web/Models/Post/Post/PostWebModel.cs20
-rw-r--r--src/DevHive.Web/Models/Technology/CreateTechnologyWebModel.cs7
-rw-r--r--src/DevHive.Web/Models/Technology/TechnologyWebModel.cs6
-rw-r--r--src/DevHive.Web/Models/Technology/UpdateTechnologyWebModel.cs6
24 files changed, 154 insertions, 129 deletions
diff --git a/src/DevHive.Web/Models/Identity/Role/CreateRoleWebModel.cs b/src/DevHive.Web/Models/Identity/Role/CreateRoleWebModel.cs
index e872428..859cdd9 100644
--- a/src/DevHive.Web/Models/Identity/Role/CreateRoleWebModel.cs
+++ b/src/DevHive.Web/Models/Identity/Role/CreateRoleWebModel.cs
@@ -1,7 +1,14 @@
+using System.ComponentModel.DataAnnotations;
+using System.Diagnostics.CodeAnalysis;
+
namespace DevHive.Web.Models.Identity.Role
{
public class CreateRoleWebModel
{
+ [NotNull]
+ [Required]
+ [MinLength(3)]
+ [MaxLength(50)]
public string Name { get; set; }
}
}
diff --git a/src/DevHive.Web/Models/Identity/Role/RoleWebModel.cs b/src/DevHive.Web/Models/Identity/Role/RoleWebModel.cs
index 41ade23..99b0f50 100644
--- a/src/DevHive.Web/Models/Identity/Role/RoleWebModel.cs
+++ b/src/DevHive.Web/Models/Identity/Role/RoleWebModel.cs
@@ -1,7 +1,14 @@
+using System.ComponentModel.DataAnnotations;
+using System.Diagnostics.CodeAnalysis;
+
namespace DevHive.Web.Models.Identity.Role
{
public class RoleWebModel
{
+ [NotNull]
+ [Required]
+ [MinLength(3)]
+ [MaxLength(50)]
public string Name { get; set; }
}
}
diff --git a/src/DevHive.Web/Models/Identity/Role/UpdateRoleWebModel.cs b/src/DevHive.Web/Models/Identity/Role/UpdateRoleWebModel.cs
index aaf0270..254affc 100644
--- a/src/DevHive.Web/Models/Identity/Role/UpdateRoleWebModel.cs
+++ b/src/DevHive.Web/Models/Identity/Role/UpdateRoleWebModel.cs
@@ -1,9 +1,13 @@
using System;
+using System.ComponentModel.DataAnnotations;
+using System.Diagnostics.CodeAnalysis;
namespace DevHive.Web.Models.Identity.Role
{
public class UpdateRoleWebModel : RoleWebModel
{
+ [NotNull]
+ [Required]
public Guid Id { get; set; }
}
}
diff --git a/src/DevHive.Web/Models/Identity/User/BaseUserWebModel.cs b/src/DevHive.Web/Models/Identity/User/BaseUserWebModel.cs
index 2d99786..d7d8d29 100644
--- a/src/DevHive.Web/Models/Identity/User/BaseUserWebModel.cs
+++ b/src/DevHive.Web/Models/Identity/User/BaseUserWebModel.cs
@@ -1,26 +1,31 @@
using System.ComponentModel.DataAnnotations;
-using DevHive.Web.Models.Identity.Validation;
+using System.Diagnostics.CodeAnalysis;
+using DevHive.Web.Attributes;
namespace DevHive.Web.Models.Identity.User
{
public class BaseUserWebModel
{
+ [NotNull]
[Required]
[MinLength(3)]
[MaxLength(50)]
[OnlyAlphanumerics(ErrorMessage = "Username can only contain letters and digits!")]
public string UserName { get; set; }
+ [NotNull]
[Required]
[EmailAddress]
public string Email { get; set; }
+ [NotNull]
[Required]
[MinLength(3)]
[MaxLength(30)]
[OnlyLetters(ErrorMessage = "First name can only contain letters!")]
public string FirstName { get; set; }
+ [NotNull]
[Required]
[MinLength(3)]
[MaxLength(30)]
diff --git a/src/DevHive.Web/Models/Identity/User/FriendWebModel.cs b/src/DevHive.Web/Models/Identity/User/FriendWebModel.cs
index 681529a..d59bff5 100644
--- a/src/DevHive.Web/Models/Identity/User/FriendWebModel.cs
+++ b/src/DevHive.Web/Models/Identity/User/FriendWebModel.cs
@@ -1,7 +1,16 @@
+using System.ComponentModel.DataAnnotations;
+using System.Diagnostics.CodeAnalysis;
+using DevHive.Web.Attributes;
+
namespace DevHive.Web.Models.Identity.User
{
public class FriendWebModel
{
- public string Username { get; set; }
+ [NotNull]
+ [Required]
+ [MinLength(3)]
+ [MaxLength(50)]
+ [OnlyAlphanumerics(ErrorMessage = "Username can only contain letters and digits!")]
+ public string UserName { get; set; }
}
}
diff --git a/src/DevHive.Web/Models/Identity/User/LoginWebModel.cs b/src/DevHive.Web/Models/Identity/User/LoginWebModel.cs
index 87c7416..0395274 100644
--- a/src/DevHive.Web/Models/Identity/User/LoginWebModel.cs
+++ b/src/DevHive.Web/Models/Identity/User/LoginWebModel.cs
@@ -1,8 +1,21 @@
+using System.ComponentModel.DataAnnotations;
+using System.Diagnostics.CodeAnalysis;
+using DevHive.Web.Attributes;
+
namespace DevHive.Web.Models.Identity.User
{
public class LoginWebModel
{
+ [NotNull]
+ [Required]
+ [MinLength(3)]
+ [MaxLength(50)]
+ [OnlyAlphanumerics(ErrorMessage = "Username can only contain letters and digits!")]
public string UserName { get; set; }
+
+ [NotNull]
+ [Required]
+ [GoodPassword]
public string Password { get; set; }
}
}
diff --git a/src/DevHive.Web/Models/Identity/User/RegisterWebModel.cs b/src/DevHive.Web/Models/Identity/User/RegisterWebModel.cs
index 04fd6bd..0fc7ec6 100644
--- a/src/DevHive.Web/Models/Identity/User/RegisterWebModel.cs
+++ b/src/DevHive.Web/Models/Identity/User/RegisterWebModel.cs
@@ -1,10 +1,12 @@
using System.ComponentModel.DataAnnotations;
-using DevHive.Web.Models.Identity.Validation;
+using System.Diagnostics.CodeAnalysis;
+using DevHive.Web.Attributes;
namespace DevHive.Web.Models.Identity.User
{
public class RegisterWebModel : BaseUserWebModel
{
+ [NotNull]
[Required]
[GoodPassword]
public string Password { get; set; }
diff --git a/src/DevHive.Web/Models/Identity/User/UpdateUserWebModel.cs b/src/DevHive.Web/Models/Identity/User/UpdateUserWebModel.cs
index 782c558..724930c 100644
--- a/src/DevHive.Web/Models/Identity/User/UpdateUserWebModel.cs
+++ b/src/DevHive.Web/Models/Identity/User/UpdateUserWebModel.cs
@@ -1,6 +1,7 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
-using DevHive.Web.Models.Identity.Validation;
+using System.Diagnostics.CodeAnalysis;
+using DevHive.Web.Attributes;
using DevHive.Web.Models.Language;
using DevHive.Web.Models.Technology;
@@ -8,14 +9,21 @@ namespace DevHive.Web.Models.Identity.User
{
public class UpdateUserWebModel : BaseUserWebModel
{
+ [NotNull]
[Required]
[GoodPassword]
public string Password { get; set; }
+ [NotNull]
+ [Required]
public IList<FriendWebModel> Friends { get; set; }
+ [NotNull]
+ [Required]
public IList<UpdateLanguageWebModel> Languages { get; set; }
+ [NotNull]
+ [Required]
public IList<UpdateTechnologyWebModel> Technologies { get; set; }
}
}
diff --git a/src/DevHive.Web/Models/Identity/User/UserWebModel.cs b/src/DevHive.Web/Models/Identity/User/UserWebModel.cs
index 3b243e7..88f199d 100644
--- a/src/DevHive.Web/Models/Identity/User/UserWebModel.cs
+++ b/src/DevHive.Web/Models/Identity/User/UserWebModel.cs
@@ -1,4 +1,6 @@
using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.Diagnostics.CodeAnalysis;
using DevHive.Web.Models.Identity.Role;
using DevHive.Web.Models.Language;
using DevHive.Web.Models.Technology;
@@ -7,12 +9,20 @@ namespace DevHive.Web.Models.Identity.User
{
public class UserWebModel : BaseUserWebModel
{
+ [NotNull]
+ [Required]
public IList<RoleWebModel> Roles { get; set; } = new List<RoleWebModel>();
+ [NotNull]
+ [Required]
public IList<UserWebModel> Friends { get; set; } = new List<UserWebModel>();
+ [NotNull]
+ [Required]
public IList<LanguageWebModel> Languages { get; set; } = new List<LanguageWebModel>();
+ [NotNull]
+ [Required]
public IList<TechnologyWebModel> Technologies { get; set; } = new List<TechnologyWebModel>();
}
}
diff --git a/src/DevHive.Web/Models/Identity/Validation/GoodPasswordModelValidation.cs b/src/DevHive.Web/Models/Identity/Validation/GoodPasswordModelValidation.cs
deleted file mode 100644
index f920c35..0000000
--- a/src/DevHive.Web/Models/Identity/Validation/GoodPasswordModelValidation.cs
+++ /dev/null
@@ -1,24 +0,0 @@
-using System;
-using System.ComponentModel.DataAnnotations;
-
-namespace DevHive.Web.Models.Identity.Validation
-{
- public class GoodPassword : ValidationAttribute
- {
- public override bool IsValid(object value)
- {
- var stringValue = (string)value;
-
- for (int i = 0; i < stringValue.Length; i++)
- {
- if (Char.IsDigit(stringValue[i]))
- {
- base.ErrorMessage = "Password must be atleast 5 characters long!";
- return stringValue.Length >= 5;
- }
- }
- base.ErrorMessage = "Password must contain atleast 1 digit!";
- return false;
- }
- }
-}
diff --git a/src/DevHive.Web/Models/Identity/Validation/OnlyAlphanumericsModelValidation.cs b/src/DevHive.Web/Models/Identity/Validation/OnlyAlphanumericsModelValidation.cs
deleted file mode 100644
index 5c8c66c..0000000
--- a/src/DevHive.Web/Models/Identity/Validation/OnlyAlphanumericsModelValidation.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-using System;
-using System.ComponentModel.DataAnnotations;
-
-namespace DevHive.Web.Models.Identity.Validation
-{
- public class OnlyAlphanumerics : ValidationAttribute
- {
- public override bool IsValid(object value)
- {
- var stringValue = (string)value;
-
- foreach (char ch in stringValue)
- {
- if (!Char.IsLetterOrDigit(ch))
- return false;
- }
- return true;
- }
- }
-}
diff --git a/src/DevHive.Web/Models/Identity/Validation/OnlyLettersModelValidation.cs b/src/DevHive.Web/Models/Identity/Validation/OnlyLettersModelValidation.cs
deleted file mode 100644
index 29a995a..0000000
--- a/src/DevHive.Web/Models/Identity/Validation/OnlyLettersModelValidation.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-using System;
-using System.ComponentModel.DataAnnotations;
-
-namespace DevHive.Web.Models.Identity.Validation
-{
- public class OnlyLetters : ValidationAttribute
- {
- public override bool IsValid(object value)
- {
- var stringValue = (string)value;
-
- foreach (char ch in stringValue)
- {
- if (!Char.IsLetter(ch))
- return false;
- }
- return true;
- }
- }
-}
diff --git a/src/DevHive.Web/Models/Language/CreateLanguageWebModel.cs b/src/DevHive.Web/Models/Language/CreateLanguageWebModel.cs
index d261500..a739e7f 100644
--- a/src/DevHive.Web/Models/Language/CreateLanguageWebModel.cs
+++ b/src/DevHive.Web/Models/Language/CreateLanguageWebModel.cs
@@ -1,9 +1,14 @@
-using System;
+using System.ComponentModel.DataAnnotations;
+using System.Diagnostics.CodeAnalysis;
namespace DevHive.Web.Models.Language
{
public class CreateLanguageWebModel
{
+ [NotNull]
+ [Required]
+ [MinLength(3)]
+ [MaxLength(50)]
public string Name { get; set; }
}
-} \ No newline at end of file
+}
diff --git a/src/DevHive.Web/Models/Language/LanguageWebModel.cs b/src/DevHive.Web/Models/Language/LanguageWebModel.cs
index 455b559..7515e70 100644
--- a/src/DevHive.Web/Models/Language/LanguageWebModel.cs
+++ b/src/DevHive.Web/Models/Language/LanguageWebModel.cs
@@ -1,9 +1,13 @@
using System;
+using System.ComponentModel.DataAnnotations;
+using System.Diagnostics.CodeAnalysis;
namespace DevHive.Web.Models.Language
{
public class LanguageWebModel
{
+ [NotNull]
+ [Required]
public Guid Id { get; set; }
}
-} \ No newline at end of file
+}
diff --git a/src/DevHive.Web/Models/Language/ReadLanguageWebModel.cs b/src/DevHive.Web/Models/Language/ReadLanguageWebModel.cs
index f1e0ecc..ab4a089 100644
--- a/src/DevHive.Web/Models/Language/ReadLanguageWebModel.cs
+++ b/src/DevHive.Web/Models/Language/ReadLanguageWebModel.cs
@@ -1,7 +1,14 @@
+using System.ComponentModel.DataAnnotations;
+using System.Diagnostics.CodeAnalysis;
+
namespace DevHive.Web.Models.Language
{
public class ReadLanguageWebModel
{
+ [NotNull]
+ [Required]
+ [MinLength(3)]
+ [MaxLength(50)]
public string Name { get; set; }
}
}
diff --git a/src/DevHive.Web/Models/Language/UpdateLanguageWebModel.cs b/src/DevHive.Web/Models/Language/UpdateLanguageWebModel.cs
index 18d945f..128d534 100644
--- a/src/DevHive.Web/Models/Language/UpdateLanguageWebModel.cs
+++ b/src/DevHive.Web/Models/Language/UpdateLanguageWebModel.cs
@@ -1,9 +1,14 @@
-using System;
+using System.ComponentModel.DataAnnotations;
+using System.Diagnostics.CodeAnalysis;
namespace DevHive.Web.Models.Language
{
public class UpdateLanguageWebModel
{
+ [NotNull]
+ [Required]
+ [MinLength(3)]
+ [MaxLength(50)]
public string Name { get; set; }
}
}
diff --git a/src/DevHive.Web/Models/Middleware/ExceptionMiddleware.cs b/src/DevHive.Web/Models/Middleware/ExceptionMiddleware.cs
deleted file mode 100644
index c57452e..0000000
--- a/src/DevHive.Web/Models/Middleware/ExceptionMiddleware.cs
+++ /dev/null
@@ -1,50 +0,0 @@
-using System;
-using System.Net;
-using System.Threading.Tasks;
-using Microsoft.AspNetCore.Http;
-using Microsoft.Extensions.Logging;
-
-namespace DevHive.Web.Models.Middleware
-{
- public class ExceptionMiddleware
- {
- private readonly RequestDelegate _next;
- // private readonly ILogger _logger;
-
- public ExceptionMiddleware(RequestDelegate next)
- {
- this._next = next;
- // this._logger = logger;
- }
- // public ExceptionMiddleware(RequestDelegate next, ILogger logger)
- // {
- // this._logger = logger;
- // this._next = next;
- // }
-
- public async Task InvokeAsync(HttpContext httpContext)
- {
- try
- {
- await this._next(httpContext);
- }
- catch (Exception ex)
- {
- // this._logger.LogError($"Something went wrong: {ex}");
- await HandleExceptionAsync(httpContext, ex);
- }
- }
-
- private Task HandleExceptionAsync(HttpContext context, Exception exception)
- {
- context.Response.ContentType = "application/json";
- context.Response.StatusCode = (int)HttpStatusCode.BadRequest;
-
- return context.Response.WriteAsync(new
- {
- StatusCode = context.Response.StatusCode,
- Message = exception.Message
- }.ToString());
- }
- }
-}
diff --git a/src/DevHive.Web/Models/Post/Comment/CommentWebModel.cs b/src/DevHive.Web/Models/Post/Comment/CommentWebModel.cs
index d66e5c9..590851d 100644
--- a/src/DevHive.Web/Models/Post/Comment/CommentWebModel.cs
+++ b/src/DevHive.Web/Models/Post/Comment/CommentWebModel.cs
@@ -1,12 +1,25 @@
using System;
+using System.ComponentModel.DataAnnotations;
+using System.Diagnostics.CodeAnalysis;
namespace DevHive.Web.Models.Post.Comment
{
public class CommentWebModel
{
+ [NotNull]
+ [Required]
public Guid IssuerId { get; set; }
+
+ [NotNull]
+ [Required]
public Guid PostId { get; set; }
+
+ [NotNull]
+ [Required]
public string Message { get; set; }
+
+ [NotNull]
+ [Required]
public DateTime TimeCreated { get; set; }
}
}
diff --git a/src/DevHive.Web/Models/Post/Post/BasePostWebModel.cs b/src/DevHive.Web/Models/Post/Post/BasePostWebModel.cs
index caa9925..35ddd34 100644
--- a/src/DevHive.Web/Models/Post/Post/BasePostWebModel.cs
+++ b/src/DevHive.Web/Models/Post/Post/BasePostWebModel.cs
@@ -1,10 +1,17 @@
using System;
+using System.ComponentModel.DataAnnotations;
+using System.Diagnostics.CodeAnalysis;
namespace DevHive.Web.Models.Post.Post
{
public class BasePostWebModel
{
+ [NotNull]
+ [Required]
public Guid IssuerId { get; set; }
+
+ [NotNull]
+ [Required]
public string Message { get; set; }
}
-} \ No newline at end of file
+}
diff --git a/src/DevHive.Web/Models/Post/Post/CreatePostWebModel.cs b/src/DevHive.Web/Models/Post/Post/CreatePostWebModel.cs
index 7558b2c..389ff9e 100644
--- a/src/DevHive.Web/Models/Post/Post/CreatePostWebModel.cs
+++ b/src/DevHive.Web/Models/Post/Post/CreatePostWebModel.cs
@@ -2,7 +2,5 @@ using System;
namespace DevHive.Web.Models.Post.Post
{
- public class CreatePostWebModel : BasePostWebModel
- {
- }
-} \ No newline at end of file
+ public class CreatePostWebModel : BasePostWebModel { }
+}
diff --git a/src/DevHive.Web/Models/Post/Post/PostWebModel.cs b/src/DevHive.Web/Models/Post/Post/PostWebModel.cs
index fa18c3a..fe35cee 100644
--- a/src/DevHive.Web/Models/Post/Post/PostWebModel.cs
+++ b/src/DevHive.Web/Models/Post/Post/PostWebModel.cs
@@ -1,3 +1,6 @@
+using System.ComponentModel.DataAnnotations;
+using System.Diagnostics.CodeAnalysis;
+using DevHive.Web.Attributes;
using DevHive.Web.Models.Post.Comment;
namespace DevHive.Web.Models.Post.Post
@@ -6,16 +9,31 @@ namespace DevHive.Web.Models.Post.Post
{
//public string Picture { get; set; }
+ [NotNull]
+ [Required]
+ [MinLength(3)]
+ [MaxLength(50)]
public string IssuerFirstName { get; set; }
+ [NotNull]
+ [Required]
+ [MinLength(3)]
+ [MaxLength(50)]
public string IssuerLastName { get; set; }
+ [NotNull]
+ [Required]
+ [MinLength(3)]
+ [MaxLength(50)]
+ [OnlyAlphanumerics(ErrorMessage = "Username can only contain letters and digits!")]
public string IssuerUsername { get; set; }
+ [NotNull]
+ [Required]
public string Message { get; set; }
//public Files[] Files { get; set; }
public CommentWebModel[] Comments { get; set; }
}
-} \ No newline at end of file
+}
diff --git a/src/DevHive.Web/Models/Technology/CreateTechnologyWebModel.cs b/src/DevHive.Web/Models/Technology/CreateTechnologyWebModel.cs
index 13029ee..ec9ec15 100644
--- a/src/DevHive.Web/Models/Technology/CreateTechnologyWebModel.cs
+++ b/src/DevHive.Web/Models/Technology/CreateTechnologyWebModel.cs
@@ -1,7 +1,14 @@
+using System.ComponentModel.DataAnnotations;
+using System.Diagnostics.CodeAnalysis;
+
namespace DevHive.Web.Models.Technology
{
public class CreateTechnologyWebModel
{
+ [NotNull]
+ [Required]
+ [MinLength(3)]
+ [MaxLength(50)]
public string Name { get; set; }
}
}
diff --git a/src/DevHive.Web/Models/Technology/TechnologyWebModel.cs b/src/DevHive.Web/Models/Technology/TechnologyWebModel.cs
index 05f7af8..6e8273b 100644
--- a/src/DevHive.Web/Models/Technology/TechnologyWebModel.cs
+++ b/src/DevHive.Web/Models/Technology/TechnologyWebModel.cs
@@ -1,9 +1,13 @@
using System;
+using System.ComponentModel.DataAnnotations;
+using System.Diagnostics.CodeAnalysis;
namespace DevHive.Web.Models.Technology
{
public class TechnologyWebModel
{
+ [NotNull]
+ [Required]
public Guid Id { get; set; }
}
-} \ No newline at end of file
+}
diff --git a/src/DevHive.Web/Models/Technology/UpdateTechnologyWebModel.cs b/src/DevHive.Web/Models/Technology/UpdateTechnologyWebModel.cs
index 4651b9e..3e9fe2a 100644
--- a/src/DevHive.Web/Models/Technology/UpdateTechnologyWebModel.cs
+++ b/src/DevHive.Web/Models/Technology/UpdateTechnologyWebModel.cs
@@ -1,9 +1,15 @@
using System;
+using System.ComponentModel.DataAnnotations;
+using System.Diagnostics.CodeAnalysis;
namespace DevHive.Web.Models.Technology
{
public class UpdateTechnologyWebModel
{
+ [NotNull]
+ [Required]
+ [MinLength(3)]
+ [MaxLength(50)]
public string Name { get; set; }
}
}