diff --git a/Squirrel/Squirrel/BusinessLogicsContracts/IGuestBusinessLogicContract.cs b/Squirrel/Squirrel/BusinessLogicsContracts/IGuestBusinessLogicContract.cs new file mode 100644 index 0000000..687822e --- /dev/null +++ b/Squirrel/Squirrel/BusinessLogicsContracts/IGuestBusinessLogicContract.cs @@ -0,0 +1,17 @@ +using Squirrel.DataModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Squirrel.BusinessLogicsContracts; + +public interface IGuestBusinessLogicContract +{ + List GetAllGuests(); + GuestDataModel GetGuestByData(string data); + void InsertGuest(GuestDataModel guestDataModel); + void UpdateBuyer(GuestDataModel guestDataModel); + void DeleteGuest(string id); +} diff --git a/Squirrel/Squirrel/BusinessLogicsContracts/IPostBusinessLogicContract.cs b/Squirrel/Squirrel/BusinessLogicsContracts/IPostBusinessLogicContract.cs new file mode 100644 index 0000000..1947bf9 --- /dev/null +++ b/Squirrel/Squirrel/BusinessLogicsContracts/IPostBusinessLogicContract.cs @@ -0,0 +1,20 @@ +using Squirrel.DataModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Squirrel.BusinessLogicsContracts; + +public interface IPostBusinessLogicContract +{ + List GetAllPosts(bool onlyActive); + List GetAllDataOfPost(string postId); + PostDataModel GetPostByData(string data); + void InsertPost(PostDataModel postDataModel); + void UpdatePost(PostDataModel postDataModel); + void DeletePost(string id); + void RestorePost(string id); +} + diff --git a/Squirrel/Squirrel/BusinessLogicsContracts/IProductBusinessLogicContract.cs b/Squirrel/Squirrel/BusinessLogicsContracts/IProductBusinessLogicContract.cs new file mode 100644 index 0000000..dd590ea --- /dev/null +++ b/Squirrel/Squirrel/BusinessLogicsContracts/IProductBusinessLogicContract.cs @@ -0,0 +1,19 @@ +using Squirrel.DataModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Squirrel.BusinessLogicsContracts; + +public interface IProductBusinessLogicContract +{ + List GetAllProducts(bool onlyActive = true); + List GetProductHistoryByProduct(string productId); + ProductDataModel GetProductByData(string data); + void InsertProduct(ProductDataModel productDataModel); + void UpdateProduct(ProductDataModel productDataModel); + void DeleteProduct(string id); +} + diff --git a/Squirrel/Squirrel/BusinessLogicsContracts/ISalaryBusinessLogicContract.cs b/Squirrel/Squirrel/BusinessLogicsContracts/ISalaryBusinessLogicContract.cs new file mode 100644 index 0000000..b5e931a --- /dev/null +++ b/Squirrel/Squirrel/BusinessLogicsContracts/ISalaryBusinessLogicContract.cs @@ -0,0 +1,15 @@ +using Squirrel.DataModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Squirrel.BusinessLogicsContracts; + +public interface ISalaryBusinessLogicContract +{ + List GetAllSalariesByPeriod(DateTime fromDate, DateTime toDate); + List GetAllSalariesByPeriodByWorker(DateTime fromDate, DateTime toDate, string workerId); + void CalculateSalaryByMounth(DateTime date); +} \ No newline at end of file diff --git a/Squirrel/Squirrel/BusinessLogicsContracts/ISaleBusinessLogicContract.cs b/Squirrel/Squirrel/BusinessLogicsContracts/ISaleBusinessLogicContract.cs new file mode 100644 index 0000000..3427735 --- /dev/null +++ b/Squirrel/Squirrel/BusinessLogicsContracts/ISaleBusinessLogicContract.cs @@ -0,0 +1,19 @@ +using Squirrel.DataModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Squirrel.BusinessLogicsContracts; + +public interface ISaleBusinessLogicContract +{ + List GetAllSalesByPeriod(DateTime fromDate, DateTime toDate); + List GetAllSalesByWorkerByPeriod(string workerId, DateTime fromDate, DateTime toDate); + List GetAllSalesByGuestByPeriod(string guestId, DateTime fromDate, DateTime toDate); + List GetAllSalesByProductByPeriod(string productId, DateTime fromDate, DateTime toDate); + SaleDataModel GetSaleByData(string data); + void InsertSale(SaleDataModel saleDataModel); + void CancelSale(string id); +} \ No newline at end of file diff --git a/Squirrel/Squirrel/BusinessLogicsContracts/IWorkerBusinessLogicContract.cs b/Squirrel/Squirrel/BusinessLogicsContracts/IWorkerBusinessLogicContract.cs new file mode 100644 index 0000000..d3d4847 --- /dev/null +++ b/Squirrel/Squirrel/BusinessLogicsContracts/IWorkerBusinessLogicContract.cs @@ -0,0 +1,20 @@ +using Squirrel.DataModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Squirrel.BusinessLogicsContracts; + +public interface IWorkerBusinessLogicContract +{ + List GetAllWorkers(bool onlyActive = true); + List GetAllWorkersByPost(string postId, bool onlyActive = true); + List GetAllWorkersByBirthDate(DateTime fromDate, DateTime toDate, bool onlyActive = true); + List GetAllWorkersByEmploymentDate(DateTime fromDate, DateTime toDate, bool onlyActive = true); + WorkerDataModel GetWorkerByData(string data); + void InsertWorker(WorkerDataModel workerDataModel); + void UpdateWorker(WorkerDataModel workerDataModel); + void DeleteWorker(string id); +} \ No newline at end of file diff --git a/Squirrel/Squirrel/StoragesContracts/IGuestStorageContract.cs b/Squirrel/Squirrel/StoragesContracts/IGuestStorageContract.cs new file mode 100644 index 0000000..e2f5215 --- /dev/null +++ b/Squirrel/Squirrel/StoragesContracts/IGuestStorageContract.cs @@ -0,0 +1,19 @@ +using Squirrel.DataModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Squirrel.StoragesContracts; + +public interface IGuestStorageContract +{ + List GetList(); + GuestDataModel? GetElementById(string id); + GuestDataModel? GetElementByPhoneNumber(string phoneNumber); + GuestDataModel? GetElementByFIO(string fio); + void AddElement(GuestDataModel guestDataModel); + void UpdElement(GuestDataModel guestDataModel); + void DelElement(string id); +} diff --git a/Squirrel/Squirrel/StoragesContracts/IPostStorageContract.cs b/Squirrel/Squirrel/StoragesContracts/IPostStorageContract.cs new file mode 100644 index 0000000..b8fc01a --- /dev/null +++ b/Squirrel/Squirrel/StoragesContracts/IPostStorageContract.cs @@ -0,0 +1,22 @@ +using Squirrel.DataModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Squirrel.StoragesContracts; + +public interface IPostStorageContract +{ + List GetList(bool onlyActual = true); + List GetPostWithHistory(string postId); + PostDataModel? GetElementById(string id); + PostDataModel? GetElementByName(string name); + void AddElement(PostDataModel postDataModel); + void UpdElement(PostDataModel postDataModel); + void DelElement(string id); + void ResElement(string id); +} + + diff --git a/Squirrel/Squirrel/StoragesContracts/IProductStorageContract.cs b/Squirrel/Squirrel/StoragesContracts/IProductStorageContract.cs new file mode 100644 index 0000000..b7c0237 --- /dev/null +++ b/Squirrel/Squirrel/StoragesContracts/IProductStorageContract.cs @@ -0,0 +1,20 @@ +using Squirrel.DataModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Squirrel.StoragesContracts; + +public interface IProductStorageContract +{ + List GetList(bool onlyActive = true); + List GetHistoryByProductId(string productId); + ProductDataModel? GetElementById(string id); + ProductDataModel? GetElementByName(string name); + void AddElement(ProductDataModel productDataModel); + void UpdElement(ProductDataModel productDataModel); + void DelElement(string id); +} + diff --git a/Squirrel/Squirrel/StoragesContracts/ISalaryStorageContract.cs b/Squirrel/Squirrel/StoragesContracts/ISalaryStorageContract.cs new file mode 100644 index 0000000..d6b9416 --- /dev/null +++ b/Squirrel/Squirrel/StoragesContracts/ISalaryStorageContract.cs @@ -0,0 +1,14 @@ +using Squirrel.DataModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Squirrel.StoragesContracts; + +public interface ISalaryStorageContract +{ + List GetList(DateTime startDate, DateTime endDate, string? workerId = null); + void AddElement(SalaryDataModel salaryDataModel); +} diff --git a/Squirrel/Squirrel/StoragesContracts/ISaleStorageContract.cs b/Squirrel/Squirrel/StoragesContracts/ISaleStorageContract.cs new file mode 100644 index 0000000..dab0ef9 --- /dev/null +++ b/Squirrel/Squirrel/StoragesContracts/ISaleStorageContract.cs @@ -0,0 +1,16 @@ +using Squirrel.DataModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Squirrel.StoragesContracts; + +public interface ISaleStorageContract +{ + List GetList(DateTime? startDate = null, DateTime? endDate = null, string? workerId = null, string? guestId = null, string? productId = null); + SaleDataModel? GetElementById(string id); + void AddElement(SaleDataModel saleDataModel); + void DelElement(string id); +} diff --git a/Squirrel/Squirrel/StoragesContracts/IWorkerStorageContract.cs b/Squirrel/Squirrel/StoragesContracts/IWorkerStorageContract.cs new file mode 100644 index 0000000..e331582 --- /dev/null +++ b/Squirrel/Squirrel/StoragesContracts/IWorkerStorageContract.cs @@ -0,0 +1,19 @@ +using Squirrel.DataModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Squirrel.StoragesContracts; + +public interface IWorkerStorageContract +{ + List GetList(bool onlyActive = true, string? postId = null, DateTime? fromBirthDate = null, DateTime? toBirthDate = null, DateTime? fromEmploymentDate = null, DateTime? toEmploymentDate = null); + WorkerDataModel? GetElementById(string id); + WorkerDataModel? GetElementByFIO(string fio); + void AddElement(WorkerDataModel workerDataModel); + void UpdElement(WorkerDataModel workerDataModel); + void DelElement(string id); +} + diff --git a/Squirrel/SquirrelTests/DataModelsTests/PostDataModelTests.cs b/Squirrel/SquirrelTests/DataModelsTests/PostDataModelTests.cs index bfc3754..6311f77 100644 --- a/Squirrel/SquirrelTests/DataModelsTests/PostDataModelTests.cs +++ b/Squirrel/SquirrelTests/DataModelsTests/PostDataModelTests.cs @@ -44,15 +44,6 @@ internal class PostDataModelTests Assert.That(() => post.Validate(), Throws.TypeOf()); } - [Test] - public void PostNameIsEmptyTest() - { - var manufacturer = CreateDataModel(Guid.NewGuid().ToString(), Guid.NewGuid().ToString(), null, PostType.Waiter, 10, true, DateTime.UtcNow); - Assert.That(() => manufacturer.Validate(), Throws.TypeOf()); - manufacturer = CreateDataModel(Guid.NewGuid().ToString(), Guid.NewGuid().ToString(), string.Empty, PostType.Waiter, 10, true, DateTime.UtcNow); - Assert.That(() => manufacturer.Validate(), Throws.TypeOf()); - } - [Test] public void PostTypeIsNoneTest() {