Merge pull request 'Замена отдельных сущностей исполнитель и поручитель на сущность "Пользователь" с использованием ролей' (#3) from user_roles into stage5_models_and_storages_contracts

Reviewed-on: #3
This commit is contained in:
ekallin 2024-04-27 23:05:15 +04:00
commit cef15dd52c
16 changed files with 81 additions and 77 deletions

View File

@ -6,7 +6,7 @@ namespace PolyclinicContracts.BindingModels
{ {
public string Name { get; set; } = string.Empty; public string Name { get; set; } = string.Empty;
public string Comment { get; set; } = string.Empty; public string Comment { get; set; } = string.Empty;
public int ExecutorId { get; set; } public int UserId { get; set; }
public int Id { get; set; } public int Id { get; set; }
} }
} }

View File

@ -1,12 +1,14 @@
using PolyclinicDataModels.Models; using PolyclinicDataModels.Enums;
using PolyclinicDataModels.Models;
namespace PolyclinicContracts.BindingModels namespace PolyclinicContracts.BindingModels
{ {
public class ExecutorBindingModel : IExecutorModel public class UserBindingModel : IUserModel
{ {
public string FIO { get; set; } = string.Empty; public string FIO { get; set; } = string.Empty;
public string Email { get; set; } = string.Empty; public string Email { get; set; } = string.Empty;
public string Password { get; set; } = string.Empty; public string Password { get; set; } = string.Empty;
public UserRole Role { get; set; } = UserRole.Неизвестный;
public int Id { get; set; } public int Id { get; set; }
} }
} }

View File

@ -1,15 +0,0 @@
using PolyclinicContracts.BindingModels;
using PolyclinicContracts.SearchModels;
using PolyclinicContracts.ViewModels;
namespace PolyclinicContracts.BusinessLogicsContracts
{
public interface IExecutorLogic
{
List<ExecutorViewModel>? ReadList(ExecutorSearchModel? model);
ExecutorViewModel? ReadElement(ExecutorSearchModel model);
bool Create(ExecutorBindingModel model);
bool Update(ExecutorBindingModel model);
bool Delete(ExecutorBindingModel model);
}
}

View File

@ -0,0 +1,15 @@
using PolyclinicContracts.BindingModels;
using PolyclinicContracts.SearchModels;
using PolyclinicContracts.ViewModels;
namespace PolyclinicContracts.BusinessLogicsContracts
{
public interface IUserLogic
{
List<UserViewModel>? ReadList(UserSearchModel? model);
UserViewModel? ReadElement(UserSearchModel model);
bool Create(UserBindingModel model);
bool Update(UserBindingModel model);
bool Delete(UserBindingModel model);
}
}

View File

@ -3,6 +3,6 @@
public class DiagnosisSearchModel public class DiagnosisSearchModel
{ {
public int? Id { get; set; } public int? Id { get; set; }
public int? ExecutorId { get; set; } public int? UserId { get; set; }
} }
} }

View File

@ -1,6 +1,6 @@
namespace PolyclinicContracts.SearchModels namespace PolyclinicContracts.SearchModels
{ {
public class ExecutorSearchModel public class UserSearchModel
{ {
public int? Id { get; set; } public int? Id { get; set; }
public string? Email { get; set; } public string? Email { get; set; }

View File

@ -1,16 +0,0 @@
using PolyclinicContracts.BindingModels;
using PolyclinicContracts.SearchModels;
using PolyclinicContracts.ViewModels;
namespace PolyclinicContracts.StoragesContracts
{
public interface IExecutorStorage
{
List<ExecutorViewModel> GetFullList();
List<ExecutorViewModel> GetFilteredList(ExecutorSearchModel model);
ExecutorViewModel? GetElement(ExecutorSearchModel model);
ExecutorViewModel? Insert(ExecutorBindingModel model);
ExecutorViewModel? Update(ExecutorBindingModel model);
ExecutorViewModel? Delete(ExecutorBindingModel model);
}
}

View File

@ -0,0 +1,16 @@
using PolyclinicContracts.BindingModels;
using PolyclinicContracts.SearchModels;
using PolyclinicContracts.ViewModels;
namespace PolyclinicContracts.StoragesContracts
{
public interface IUserStorage
{
List<UserViewModel> GetFullList();
List<UserViewModel> GetFilteredList(UserSearchModel model);
UserViewModel? GetElement(UserSearchModel model);
UserViewModel? Insert(UserBindingModel model);
UserViewModel? Update(UserBindingModel model);
UserViewModel? Delete(UserBindingModel model);
}
}

View File

@ -9,7 +9,7 @@ namespace PolyclinicContracts.ViewModels
public string Name { get; set; } = string.Empty; public string Name { get; set; } = string.Empty;
[DisplayName("Комментарий")] [DisplayName("Комментарий")]
public string Comment { get; set; } = string.Empty; public string Comment { get; set; } = string.Empty;
public int ExecutorId { get; set; } public int UserId { get; set; }
public int Id { get; set; } public int Id { get; set; }
} }
} }

View File

@ -1,15 +0,0 @@
using PolyclinicDataModels.Models;
using System.ComponentModel;
namespace PolyclinicContracts.ViewModels
{
public class ExecutorViewModel : IExecutorModel
{
[DisplayName("ФИО исполнителя")]
public string FIO { get; set; } = string.Empty;
[DisplayName("Email исполнителя")]
public string Email { get; set; } = string.Empty;
public string Password { get; set; } = string.Empty;
public int Id { get; set; }
}
}

View File

@ -0,0 +1,19 @@
using PolyclinicDataModels.Enums;
using PolyclinicDataModels.Models;
using System.ComponentModel;
namespace PolyclinicContracts.ViewModels
{
public class UserViewModel : IUserModel
{
[DisplayName("ФИО")]
public string FIO { get; set; } = string.Empty;
[DisplayName("Email")]
public string Email { get; set; } = string.Empty;
[DisplayName("Пароль")]
public string Password { get; set; } = string.Empty;
[DisplayName("Роль")]
public UserRole Role { get; set; } = UserRole.Неизвестный;
public int Id { get; set; }
}
}

View File

@ -0,0 +1,10 @@
namespace PolyclinicDataModels.Enums
{
public enum UserRole
{
Неизвестный = -1,
Администратор = 0,
Исполнитель = 1,
Поручитель = 2
}
}

View File

@ -4,6 +4,6 @@
{ {
string Name { get; } string Name { get; }
string Comment { get; } string Comment { get; }
int ExecutorId { get; } int UserId { get; }
} }
} }

View File

@ -1,9 +0,0 @@
namespace PolyclinicDataModels.Models
{
public interface IExecutorModel : IId
{
string FIO { get; }
string Email { get; }
string Password { get; }
}
}

View File

@ -1,15 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PolyclinicDataModels.Models
{
public interface ISuretorModel : IId
{
string FIO { get; }
string Password { get; }
string Email { get; }
}
}

View File

@ -0,0 +1,12 @@
using PolyclinicDataModels.Enums;
namespace PolyclinicDataModels.Models
{
public interface IUserModel : IId
{
string FIO { get; }
string Email { get; }
string Password { get; }
UserRole Role { get; }
}
}