From 06218af516670f4b1e9c615e6f648bf3777457c6 Mon Sep 17 00:00:00 2001 From: James Tombleson Date: Thu, 6 Jul 2023 22:24:50 -0700 Subject: [PATCH] Api domain items have been added but subject to change --- .../Domain/Requests/RegisterUserRequest.cs | 12 ++++++++++++ .../Domain/Requests/UserLoginRequest.cs | 10 ++++++++++ .../Domain/Response/AuthFailedResponse.cs | 6 ++++++ .../Domain/Response/AuthSuccessfulResponse.cs | 8 ++++++++ .../Domain/Results/AuthenticationResult.cs | 11 +++++++++++ 5 files changed, 47 insertions(+) create mode 100644 Newsbot.Collector.Api/Domain/Requests/RegisterUserRequest.cs create mode 100644 Newsbot.Collector.Api/Domain/Requests/UserLoginRequest.cs create mode 100644 Newsbot.Collector.Api/Domain/Response/AuthFailedResponse.cs create mode 100644 Newsbot.Collector.Api/Domain/Response/AuthSuccessfulResponse.cs create mode 100644 Newsbot.Collector.Api/Domain/Results/AuthenticationResult.cs diff --git a/Newsbot.Collector.Api/Domain/Requests/RegisterUserRequest.cs b/Newsbot.Collector.Api/Domain/Requests/RegisterUserRequest.cs new file mode 100644 index 0000000..461615c --- /dev/null +++ b/Newsbot.Collector.Api/Domain/Requests/RegisterUserRequest.cs @@ -0,0 +1,12 @@ +using System.ComponentModel.DataAnnotations; + +namespace Newsbot.Collector.Api.Domain.Requests; + +public class RegisterUserRequest +{ + //public string? Name { get; set; } + [EmailAddress] + public string? Email { get; set; } + public string? Password { get; set; } + +} \ No newline at end of file diff --git a/Newsbot.Collector.Api/Domain/Requests/UserLoginRequest.cs b/Newsbot.Collector.Api/Domain/Requests/UserLoginRequest.cs new file mode 100644 index 0000000..8b34017 --- /dev/null +++ b/Newsbot.Collector.Api/Domain/Requests/UserLoginRequest.cs @@ -0,0 +1,10 @@ +using System.ComponentModel.DataAnnotations; + +namespace Newsbot.Collector.Api.Domain.Requests; + +public class UserLoginRequest +{ + [EmailAddress] + public string? Email { get; set; } + public string? Password { get; set; } +} \ No newline at end of file diff --git a/Newsbot.Collector.Api/Domain/Response/AuthFailedResponse.cs b/Newsbot.Collector.Api/Domain/Response/AuthFailedResponse.cs new file mode 100644 index 0000000..891c195 --- /dev/null +++ b/Newsbot.Collector.Api/Domain/Response/AuthFailedResponse.cs @@ -0,0 +1,6 @@ +namespace Newsbot.Collector.Api.Domain.Response; + +public class AuthFailedResponse +{ + public IEnumerable? Errors { get; set; } +} \ No newline at end of file diff --git a/Newsbot.Collector.Api/Domain/Response/AuthSuccessfulResponse.cs b/Newsbot.Collector.Api/Domain/Response/AuthSuccessfulResponse.cs new file mode 100644 index 0000000..48e5009 --- /dev/null +++ b/Newsbot.Collector.Api/Domain/Response/AuthSuccessfulResponse.cs @@ -0,0 +1,8 @@ +namespace Newsbot.Collector.Api.Domain.Response; + +public class AuthSuccessfulResponse +{ + // might want to validate the user before we return the token + + public string? Token { get; set; } +} \ No newline at end of file diff --git a/Newsbot.Collector.Api/Domain/Results/AuthenticationResult.cs b/Newsbot.Collector.Api/Domain/Results/AuthenticationResult.cs new file mode 100644 index 0000000..dfbb63b --- /dev/null +++ b/Newsbot.Collector.Api/Domain/Results/AuthenticationResult.cs @@ -0,0 +1,11 @@ +using System.Collections; + +namespace Newsbot.Collector.Api.Domain.Results; + +public class AuthenticationResult +{ + public string? Token { get; set; } + + public bool IsSuccessful { get; set; } + public IEnumerable? ErrorMessage { get; set; } +} \ No newline at end of file