From 0a5abc231e50a2e5f19f5c3561e51037f2cfcff2 Mon Sep 17 00:00:00 2001 From: dangershony Date: Wed, 10 Jan 2024 13:37:18 +0000 Subject: [PATCH 1/2] Add validation to create project --- src/Angor/Client/Pages/Create.razor | 34 +++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/src/Angor/Client/Pages/Create.razor b/src/Angor/Client/Pages/Create.razor index 179c0255..9bb46a17 100644 --- a/src/Angor/Client/Pages/Create.razor +++ b/src/Angor/Client/Pages/Create.razor @@ -127,9 +127,9 @@ @foreach (var stage in project.Stages) {
- +
- +
@@ -324,6 +324,36 @@ private async Task CreatProject() { + if (project.TargetAmount < (decimal)0.1) + { + notificationComponent.ShowErrorMessage("Project target amount must be higher then 0.1 BTC"); + return; + } + + if (project.StartDate < DateTime.UtcNow) + { + notificationComponent.ShowErrorMessage("Project must start in the future"); + return; + } + + if (project.ExpiryDate < project.StartDate) + { + notificationComponent.ShowErrorMessage("Project must expire after start date"); + return; + } + + if (project.Stages.Any() && project.ExpiryDate < project.Stages.Last().ReleaseDate) + { + notificationComponent.ShowErrorMessage("Project expire date must be after the last stage date"); + return; + } + + if (project.PenaltyDays < 10) + { + notificationComponent.ShowErrorMessage("Project penalty must be higher then 10 days"); + return; + } + if (project.Stages.Count() < 3) { notificationComponent.ShowErrorMessage("There must be at least 3 stages"); From 29a2958fc5982e7571680b887b8ea743471fe015 Mon Sep 17 00:00:00 2001 From: dangershony Date: Thu, 11 Jan 2024 14:10:27 +0000 Subject: [PATCH 2/2] fix typo --- src/Angor/Client/Pages/Create.razor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Angor/Client/Pages/Create.razor b/src/Angor/Client/Pages/Create.razor index 9bb46a17..095c2d73 100644 --- a/src/Angor/Client/Pages/Create.razor +++ b/src/Angor/Client/Pages/Create.razor @@ -127,7 +127,7 @@ @foreach (var stage in project.Stages) {
- +