+
@@ -38,7 +50,7 @@
diff --git a/TaskTracker/ClientApp/appsettings.json b/TaskTracker/ClientApp/appsettings.json
index 10f68b8..f8fc186 100644
--- a/TaskTracker/ClientApp/appsettings.json
+++ b/TaskTracker/ClientApp/appsettings.json
@@ -5,5 +5,6 @@
"Microsoft.AspNetCore": "Warning"
}
},
- "AllowedHosts": "*"
+ "AllowedHosts": "*",
+ "IPAddress": "http://localhost:5229"
}
diff --git a/TaskTracker/Contracts/BindingModels/PerformerBindingModel.cs b/TaskTracker/Contracts/BindingModels/PerformerBindingModel.cs
index 2b7c0d1..93cbaa3 100644
--- a/TaskTracker/Contracts/BindingModels/PerformerBindingModel.cs
+++ b/TaskTracker/Contracts/BindingModels/PerformerBindingModel.cs
@@ -11,6 +11,10 @@ namespace Contracts.BindingModels
{
public int Id{ get; set; }
public string NAME_PF { get; set; } = string.Empty;
+
+ public string login { get; set; } = string.Empty;
+ public string password { get; set; } = string.Empty;
+
public string SPECIALTY { get; set; } = string.Empty;
public int TeamId { get; set; }
}
diff --git a/TaskTracker/Contracts/BindingModels/TaskBindingModel.cs b/TaskTracker/Contracts/BindingModels/TaskBindingModel.cs
index abbb034..e3c1399 100644
--- a/TaskTracker/Contracts/BindingModels/TaskBindingModel.cs
+++ b/TaskTracker/Contracts/BindingModels/TaskBindingModel.cs
@@ -17,7 +17,7 @@ namespace Contracts.BindingModels
public int ProjectId { get; set; }
public int TagGroupId { get; set; }
public MyTaskStatus Status { get; set; } = MyTaskStatus.Неизвестен;
- public Dictionary
TaskPerformers
+ public Dictionary TaskPerformers
{
get;
set;
diff --git a/TaskTracker/Contracts/BindingModels/TaskPerformerBindingModel.cs b/TaskTracker/Contracts/BindingModels/TaskPerformerBindingModel.cs
new file mode 100644
index 0000000..36f6abc
--- /dev/null
+++ b/TaskTracker/Contracts/BindingModels/TaskPerformerBindingModel.cs
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Contracts.BindingModels
+{
+ public class TaskPerformerBindingModel
+ {
+ public int TaskId { get; set; }
+ public int PerformerId { get; set; }
+ }
+}
diff --git a/TaskTracker/Contracts/BusinessLogicContracts/ITaskLogic.cs b/TaskTracker/Contracts/BusinessLogicContracts/ITaskLogic.cs
index 7849462..c710928 100644
--- a/TaskTracker/Contracts/BusinessLogicContracts/ITaskLogic.cs
+++ b/TaskTracker/Contracts/BusinessLogicContracts/ITaskLogic.cs
@@ -15,6 +15,5 @@ namespace Contracts.BusinessLogicContracts
bool CreateTask(TaskBindingModel model);
bool TakeTaskInWork(TaskBindingModel model);
bool FinishTask(TaskBindingModel model);
- bool DeliveryTask(TaskBindingModel model);
}
}
diff --git a/TaskTracker/Contracts/SearchModels/CommentSearchModel.cs b/TaskTracker/Contracts/SearchModels/CommentSearchModel.cs
index 2710db5..437bcc4 100644
--- a/TaskTracker/Contracts/SearchModels/CommentSearchModel.cs
+++ b/TaskTracker/Contracts/SearchModels/CommentSearchModel.cs
@@ -9,6 +9,7 @@ namespace Contracts.SearchModels
public class CommentSearchModel
{
public int? Id { get; set; }
+ public string? TEXT { get; set; }
public int? TaskId { get; set; }
public int? PerformerId { get; set; }
}
diff --git a/TaskTracker/Contracts/SearchModels/PerformerSearchModel.cs b/TaskTracker/Contracts/SearchModels/PerformerSearchModel.cs
index a7369f9..e7db3af 100644
--- a/TaskTracker/Contracts/SearchModels/PerformerSearchModel.cs
+++ b/TaskTracker/Contracts/SearchModels/PerformerSearchModel.cs
@@ -10,6 +10,8 @@ namespace Contracts.SearchModels
{
public int? Id { get; set; }
public string? NAME_PF { get; set; }
+ public string? login { get; set; }
+ public string? password { get; set; }
public int? TeamId { get; set; }
}
}
diff --git a/TaskTracker/Contracts/SearchModels/TaskSearchModel.cs b/TaskTracker/Contracts/SearchModels/TaskSearchModel.cs
index 1d2da2c..0e6b9c8 100644
--- a/TaskTracker/Contracts/SearchModels/TaskSearchModel.cs
+++ b/TaskTracker/Contracts/SearchModels/TaskSearchModel.cs
@@ -12,5 +12,6 @@ namespace Contracts.SearchModels
public string? SHORT_DESC { get; set; }
public int? ProjectId { get; set; }
public int? TagGroupId { get; set; }
+ public List? PerformerIds { get; set; }
}
}
diff --git a/TaskTracker/Contracts/StoragesContracts/ITaskStorage.cs b/TaskTracker/Contracts/StoragesContracts/ITaskStorage.cs
index 0771bb0..3fc48fd 100644
--- a/TaskTracker/Contracts/StoragesContracts/ITaskStorage.cs
+++ b/TaskTracker/Contracts/StoragesContracts/ITaskStorage.cs
@@ -12,7 +12,6 @@ namespace Contracts.StoragesContracts
public interface ITaskStorage
{
List GetFullList();
- List GetFilteredList(TaskSearchModel model);
TaskViewModel? GetElement(TaskSearchModel model);
TaskViewModel? Insert(TaskBindingModel model);
TaskViewModel? Update(TaskBindingModel model);
diff --git a/TaskTracker/Contracts/ViewModels/PerformerViewModel.cs b/TaskTracker/Contracts/ViewModels/PerformerViewModel.cs
index 03857fe..a8b43fd 100644
--- a/TaskTracker/Contracts/ViewModels/PerformerViewModel.cs
+++ b/TaskTracker/Contracts/ViewModels/PerformerViewModel.cs
@@ -16,6 +16,12 @@ namespace Contracts.ViewModels
[DisplayName("Имя")]
public string NAME_PF { get; set; } = string.Empty;
+ [DisplayName("Логин")]
+ public string login { get; set; } = string.Empty;
+
+ [DisplayName("Пароль")]
+ public string password { get; set; } = string.Empty;
+
[DisplayName("Специальность")]
public string SPECIALTY { get; set; } = string.Empty;
diff --git a/TaskTracker/Contracts/ViewModels/TaskViewModel.cs b/TaskTracker/Contracts/ViewModels/TaskViewModel.cs
index 1e2986c..f321d3a 100644
--- a/TaskTracker/Contracts/ViewModels/TaskViewModel.cs
+++ b/TaskTracker/Contracts/ViewModels/TaskViewModel.cs
@@ -34,7 +34,7 @@ namespace Contracts.ViewModels
[DisplayName("Тег")]
public string TagName { get; set; } = string.Empty;
- public Dictionary TaskPerformers
+ public Dictionary TaskPerformers
{
get;
set;
diff --git a/TaskTracker/DataModels/Models/IPerformerModel.cs b/TaskTracker/DataModels/Models/IPerformerModel.cs
index 236a46b..1a8d0c1 100644
--- a/TaskTracker/DataModels/Models/IPerformerModel.cs
+++ b/TaskTracker/DataModels/Models/IPerformerModel.cs
@@ -9,6 +9,8 @@ namespace DataModels.Models
public interface IPerformerModel : IId
{
string NAME_PF { get; }
+ string login { get; }
+ string password { get; }
string SPECIALTY { get; }
int TeamId { get; }
}
diff --git a/TaskTracker/DataModels/Models/ITaskModel.cs b/TaskTracker/DataModels/Models/ITaskModel.cs
index 6115540..2fc31b9 100644
--- a/TaskTracker/DataModels/Models/ITaskModel.cs
+++ b/TaskTracker/DataModels/Models/ITaskModel.cs
@@ -14,6 +14,6 @@ namespace DataModels.Models
int ProjectId { get; }
int TagGroupId { get; }
MyTaskStatus Status { get; }
- Dictionary TaskPerformers { get; } //комментарии к задаче
+ Dictionary TaskPerformers { get; } //комментарии к задаче
}
}
diff --git a/TaskTracker/DataModels/MyTaskStatus.cs b/TaskTracker/DataModels/MyTaskStatus.cs
index cd27a37..9ceb226 100644
--- a/TaskTracker/DataModels/MyTaskStatus.cs
+++ b/TaskTracker/DataModels/MyTaskStatus.cs
@@ -16,6 +16,7 @@ namespace DataModels
Готово = 2,
- Проверено = 3
+ Просрочено = 3
+
}
}
diff --git a/TaskTracker/DatabaseImplement/Implements/PerformerStorage.cs b/TaskTracker/DatabaseImplement/Implements/PerformerStorage.cs
index d9939d4..1812c2b 100644
--- a/TaskTracker/DatabaseImplement/Implements/PerformerStorage.cs
+++ b/TaskTracker/DatabaseImplement/Implements/PerformerStorage.cs
@@ -17,11 +17,11 @@ namespace DatabaseImplement.Implements
public List GetFullList()
{
using var context = new TaskTrackerDatabase();
- return context.Performers
- .Include(x => x.Team)
- .Select(x => x.GetViewModel)
- .ToList();
- }
+ return context.Performers
+ .Include(x => x.Team)
+ .Select(x => x.GetViewModel)
+ .ToList();
+ }
public List GetFilteredList(PerformerSearchModel model)
{
@@ -45,20 +45,21 @@ namespace DatabaseImplement.Implements
return new();
}
- public PerformerViewModel? GetElement(PerformerSearchModel model)
- {
- if (!model.Id.HasValue)
- {
- return null;
- }
- using var context = new TaskTrackerDatabase();
- return context.Performers
- .Include(x => x.Team)
- .FirstOrDefault(x => x.Id == model.Id)
- ?.GetViewModel;
- }
+ public PerformerViewModel? GetElement(PerformerSearchModel model)
+ {
+ if (string.IsNullOrEmpty(model.login) && string.IsNullOrEmpty(model.password) && !model.Id.HasValue)
+ {
+ return null;
+ }
+ using var context = new TaskTrackerDatabase();
+ return context.Performers
+ .Include (x => x.Team)
+ .FirstOrDefault(x =>
+ (!string.IsNullOrEmpty(model.login) && x.login == model.login && !string.IsNullOrEmpty(model.password) && x.password == model.password)
+ || (model.Id.HasValue && x.Id == model.Id))?.GetViewModel;
+ }
- public PerformerViewModel? Insert(PerformerBindingModel model)
+ public PerformerViewModel? Insert(PerformerBindingModel model)
{
var newPerformer = Performer.Create(model);
if (newPerformer == null)
diff --git a/TaskTracker/DatabaseImplement/Implements/TaskStorage.cs b/TaskTracker/DatabaseImplement/Implements/TaskStorage.cs
index eb85f43..770d791 100644
--- a/TaskTracker/DatabaseImplement/Implements/TaskStorage.cs
+++ b/TaskTracker/DatabaseImplement/Implements/TaskStorage.cs
@@ -26,23 +26,6 @@ namespace DatabaseImplement.Implements
.Select(x => x.GetViewModel)
.ToList();
}
- public List GetFilteredList(TaskSearchModel model)
- {
- if (string.IsNullOrEmpty(model.SHORT_DESC))
- {
- return new();
- }
- using var context = new TaskTrackerDatabase();
- return context.Tasks
- .Include(x => x.Project)
- .Include(x => x.TagGroup)
- .Include(x => x.Performers)
- .ThenInclude(x => x.Performer)
- .Where(x => x.SHORT_DESC.Contains(model.SHORT_DESC))
- .ToList()
- .Select(x => x.GetViewModel)
- .ToList();
- }
public TaskViewModel? GetElement(TaskSearchModel model)
{
if (string.IsNullOrEmpty(model.SHORT_DESC) && !model.Id.HasValue)
@@ -55,22 +38,26 @@ namespace DatabaseImplement.Implements
.Include(x => x.TagGroup)
.Include(x => x.Performers)
.ThenInclude(x => x.Performer)
- .FirstOrDefault(x => (!string.IsNullOrEmpty(model.SHORT_DESC) && x.SHORT_DESC == model.SHORT_DESC) ||
- (model.Id.HasValue && x.Id == model.Id))
- ?.GetViewModel;
+ .FirstOrDefault(x => model.Id.HasValue && x.Id == model.Id)?.GetViewModel;
}
public TaskViewModel? Insert(TaskBindingModel model)
{
- using var context = new TaskTrackerDatabase();
- var newReinforced = Task.Create(context, model);
- if (newReinforced == null)
- {
- return null;
- }
- context.Tasks.Add(newReinforced);
- context.SaveChanges();
- return newReinforced.GetViewModel;
- }
+ var newTask = Task.Create(model);
+ if (newTask == null)
+ {
+ return null;
+ }
+ using var context = new TaskTrackerDatabase();
+ context.Tasks.Add(newTask);
+ context.SaveChanges();
+ return context.Tasks
+ .Include(x => x.Project)
+ .Include(x => x.TagGroup)
+ .Include(x => x.Performers)
+ .ThenInclude(x => x.Performer)
+ .FirstOrDefault(x => x.Id == newTask.Id)
+ ?.GetViewModel;
+ }
public TaskViewModel? Update(TaskBindingModel model)
{
using var context = new TaskTrackerDatabase();
@@ -93,20 +80,27 @@ namespace DatabaseImplement.Implements
transaction.Rollback();
throw;
}
- }
+ }
public TaskViewModel? Delete(TaskBindingModel model)
{
using var context = new TaskTrackerDatabase();
var element = context.Tasks
- .Include(x => x.Performers)
- .FirstOrDefault(rec => rec.Id == model.Id);
+ .Include(x => x.Performers)
+ .FirstOrDefault(rec => rec.Id == model.Id);
if (element != null)
{
- context.Tasks.Remove(element);
- context.SaveChanges();
- return element.GetViewModel;
- }
+ var deletedElement = context.Tasks
+ .Include(x => x.Project)
+ .Include(x => x.TagGroup)
+ .Include(x => x.Performers)
+ .ThenInclude(x => x.Performer)
+ .FirstOrDefault(x => x.Id == model.Id)
+ ?.GetViewModel;
+ context.Tasks.Remove(element);
+ context.SaveChanges();
+ return deletedElement;
+ }
return null;
- }
+ }
}
}
diff --git a/TaskTracker/DatabaseImplement/Migrations/20240504174026_addSomePerformerStuff.Designer.cs b/TaskTracker/DatabaseImplement/Migrations/20240504174026_addSomePerformerStuff.Designer.cs
new file mode 100644
index 0000000..050128d
--- /dev/null
+++ b/TaskTracker/DatabaseImplement/Migrations/20240504174026_addSomePerformerStuff.Designer.cs
@@ -0,0 +1,302 @@
+//
+using System;
+using DatabaseImplement;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
+
+#nullable disable
+
+namespace DatabaseImplement.Migrations
+{
+ [DbContext(typeof(TaskTrackerDatabase))]
+ [Migration("20240504174026_addSomePerformerStuff")]
+ partial class addSomePerformerStuff
+ {
+ ///
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("ProductVersion", "7.0.16")
+ .HasAnnotation("Relational:MaxIdentifierLength", 63);
+
+ NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
+
+ modelBuilder.Entity("DatabaseImplement.Models.Comment", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("PerformerId")
+ .HasColumnType("integer");
+
+ b.Property("TEXT")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("TaskId")
+ .HasColumnType("integer");
+
+ b.HasKey("Id");
+
+ b.HasIndex("PerformerId");
+
+ b.HasIndex("TaskId");
+
+ b.ToTable("Comments");
+ });
+
+ modelBuilder.Entity("DatabaseImplement.Models.Performer", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("NAME_PF")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("SPECIALTY")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("TeamId")
+ .HasColumnType("integer");
+
+ b.Property("login")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("password")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.HasKey("Id");
+
+ b.HasIndex("TeamId");
+
+ b.ToTable("Performers");
+ });
+
+ modelBuilder.Entity("DatabaseImplement.Models.Project", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("DESCRIPTION_PJ")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("NAME_PJ")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("TeamId")
+ .HasColumnType("integer");
+
+ b.HasKey("Id");
+
+ b.HasIndex("TeamId");
+
+ b.ToTable("Projects");
+ });
+
+ modelBuilder.Entity("DatabaseImplement.Models.TagGroup", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("COLOR")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("NAME_TG")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.HasKey("Id");
+
+ b.ToTable("TagGroups");
+ });
+
+ modelBuilder.Entity("DatabaseImplement.Models.Task", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("DEADLINE")
+ .HasColumnType("timestamp without time zone");
+
+ b.Property("DESCRIPTION")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("ProjectId")
+ .HasColumnType("integer");
+
+ b.Property("SHORT_DESC")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("Status")
+ .HasColumnType("integer");
+
+ b.Property("TagGroupId")
+ .HasColumnType("integer");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ProjectId");
+
+ b.HasIndex("TagGroupId");
+
+ b.ToTable("Tasks");
+ });
+
+ modelBuilder.Entity("DatabaseImplement.Models.TaskPerformers", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("PerformerId")
+ .HasColumnType("integer");
+
+ b.Property("TaskId")
+ .HasColumnType("integer");
+
+ b.HasKey("Id");
+
+ b.HasIndex("PerformerId");
+
+ b.HasIndex("TaskId");
+
+ b.ToTable("TaskPerformers");
+ });
+
+ modelBuilder.Entity("DatabaseImplement.Models.Team", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("NAME_TM")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("RATING")
+ .HasColumnType("double precision");
+
+ b.HasKey("Id");
+
+ b.ToTable("Teams");
+ });
+
+ modelBuilder.Entity("DatabaseImplement.Models.Comment", b =>
+ {
+ b.HasOne("DatabaseImplement.Models.Performer", "Performer")
+ .WithMany()
+ .HasForeignKey("PerformerId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("DatabaseImplement.Models.Task", "Task")
+ .WithMany()
+ .HasForeignKey("TaskId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Performer");
+
+ b.Navigation("Task");
+ });
+
+ modelBuilder.Entity("DatabaseImplement.Models.Performer", b =>
+ {
+ b.HasOne("DatabaseImplement.Models.Team", "Team")
+ .WithMany()
+ .HasForeignKey("TeamId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Team");
+ });
+
+ modelBuilder.Entity("DatabaseImplement.Models.Project", b =>
+ {
+ b.HasOne("DatabaseImplement.Models.Team", "Team")
+ .WithMany()
+ .HasForeignKey("TeamId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Team");
+ });
+
+ modelBuilder.Entity("DatabaseImplement.Models.Task", b =>
+ {
+ b.HasOne("DatabaseImplement.Models.Project", "Project")
+ .WithMany()
+ .HasForeignKey("ProjectId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("DatabaseImplement.Models.TagGroup", "TagGroup")
+ .WithMany()
+ .HasForeignKey("TagGroupId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Project");
+
+ b.Navigation("TagGroup");
+ });
+
+ modelBuilder.Entity("DatabaseImplement.Models.TaskPerformers", b =>
+ {
+ b.HasOne("DatabaseImplement.Models.Performer", "Performer")
+ .WithMany()
+ .HasForeignKey("PerformerId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("DatabaseImplement.Models.Task", "Task")
+ .WithMany("Performers")
+ .HasForeignKey("TaskId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Performer");
+
+ b.Navigation("Task");
+ });
+
+ modelBuilder.Entity("DatabaseImplement.Models.Task", b =>
+ {
+ b.Navigation("Performers");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/TaskTracker/DatabaseImplement/Migrations/20240504174026_addSomePerformerStuff.cs b/TaskTracker/DatabaseImplement/Migrations/20240504174026_addSomePerformerStuff.cs
new file mode 100644
index 0000000..127d914
--- /dev/null
+++ b/TaskTracker/DatabaseImplement/Migrations/20240504174026_addSomePerformerStuff.cs
@@ -0,0 +1,40 @@
+using Microsoft.EntityFrameworkCore.Migrations;
+
+#nullable disable
+
+namespace DatabaseImplement.Migrations
+{
+ ///
+ public partial class addSomePerformerStuff : Migration
+ {
+ ///
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.AddColumn(
+ name: "login",
+ table: "Performers",
+ type: "text",
+ nullable: false,
+ defaultValue: "");
+
+ migrationBuilder.AddColumn(
+ name: "password",
+ table: "Performers",
+ type: "text",
+ nullable: false,
+ defaultValue: "");
+ }
+
+ ///
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropColumn(
+ name: "login",
+ table: "Performers");
+
+ migrationBuilder.DropColumn(
+ name: "password",
+ table: "Performers");
+ }
+ }
+}
diff --git a/TaskTracker/DatabaseImplement/Migrations/TaskTrackerDatabaseModelSnapshot.cs b/TaskTracker/DatabaseImplement/Migrations/TaskTrackerDatabaseModelSnapshot.cs
index 75eb15c..c5348e7 100644
--- a/TaskTracker/DatabaseImplement/Migrations/TaskTrackerDatabaseModelSnapshot.cs
+++ b/TaskTracker/DatabaseImplement/Migrations/TaskTrackerDatabaseModelSnapshot.cs
@@ -68,6 +68,14 @@ namespace DatabaseImplement.Migrations
b.Property("TeamId")
.HasColumnType("integer");
+ b.Property("login")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("password")
+ .IsRequired()
+ .HasColumnType("text");
+
b.HasKey("Id");
b.HasIndex("TeamId");
diff --git a/TaskTracker/DatabaseImplement/Models/Comment.cs b/TaskTracker/DatabaseImplement/Models/Comment.cs
index e5b48e1..a21e1bd 100644
--- a/TaskTracker/DatabaseImplement/Models/Comment.cs
+++ b/TaskTracker/DatabaseImplement/Models/Comment.cs
@@ -48,8 +48,6 @@ namespace DatabaseImplement.Models
return;
}
TEXT = model.TEXT;
- PerformerId = model.PerformerId;
- TaskId = model.TaskId;
}
public CommentViewModel GetViewModel => new()
diff --git a/TaskTracker/DatabaseImplement/Models/Performer.cs b/TaskTracker/DatabaseImplement/Models/Performer.cs
index 906c551..c4535f1 100644
--- a/TaskTracker/DatabaseImplement/Models/Performer.cs
+++ b/TaskTracker/DatabaseImplement/Models/Performer.cs
@@ -17,6 +17,12 @@ namespace DatabaseImplement.Models
[Required]
public string NAME_PF { get; private set; } = string.Empty;
+ [Required]
+ public string login { get; private set; } = string.Empty;
+
+ [Required]
+ public string password { get; private set; } = string.Empty;
+
[Required]
public string SPECIALTY { get; private set; } = string.Empty;
@@ -36,6 +42,8 @@ namespace DatabaseImplement.Models
NAME_PF = model.NAME_PF,
SPECIALTY = model.SPECIALTY,
TeamId = model.TeamId,
+ login = model.login,
+ password = model.password
};
}
@@ -47,16 +55,19 @@ namespace DatabaseImplement.Models
}
NAME_PF = model.NAME_PF;
SPECIALTY = model.SPECIALTY;
- TeamId = model.TeamId;
+ login = model.login;
+ password = model.password;
}
- public PerformerViewModel GetViewModel => new()
- {
- Id = Id,
- NAME_PF = NAME_PF,
- SPECIALTY = SPECIALTY,
- TeamId = TeamId,
- TeamName = Team.NAME_TM
- };
- }
+ public PerformerViewModel GetViewModel => new()
+ {
+ Id = Id,
+ NAME_PF = NAME_PF,
+ SPECIALTY = SPECIALTY,
+ TeamId = TeamId,
+ TeamName = Team.NAME_TM,
+ login = login,
+ password = password
+ };
+ }
}
diff --git a/TaskTracker/DatabaseImplement/Models/Project.cs b/TaskTracker/DatabaseImplement/Models/Project.cs
index 950e887..ec42b17 100644
--- a/TaskTracker/DatabaseImplement/Models/Project.cs
+++ b/TaskTracker/DatabaseImplement/Models/Project.cs
@@ -47,7 +47,6 @@ namespace DatabaseImplement.Models
}
NAME_PJ = model.NAME_PJ;
DESCRIPTION_PJ = model.DESCRIPTION_PJ;
- TeamId = model.TeamId;
}
public ProjectViewModel GetViewModel => new()
diff --git a/TaskTracker/DatabaseImplement/Models/Task.cs b/TaskTracker/DatabaseImplement/Models/Task.cs
index 1bcbfba..29b32fb 100644
--- a/TaskTracker/DatabaseImplement/Models/Task.cs
+++ b/TaskTracker/DatabaseImplement/Models/Task.cs
@@ -21,8 +21,6 @@ namespace DatabaseImplement.Models
[Required]
public string DESCRIPTION { get; set;} = string.Empty;
-
- [Required]
public MyTaskStatus Status { get; set; }
[Required]
@@ -37,16 +35,16 @@ namespace DatabaseImplement.Models
public virtual TagGroup TagGroup { get; set; }
- private Dictionary? _taskPerformers = null;
+ private Dictionary? _taskPerformers = null;
[NotMapped]
- public Dictionary TaskPerformers
+ public Dictionary TaskPerformers
{
get
{
if (_taskPerformers == null)
{
_taskPerformers = Performers
- .ToDictionary(recPC => recPC.PerformerId, recPC => recPC.Performer as IPerformerModel);
+ .ToDictionary(recPC => recPC.PerformerId, recPC => recPC.Performer.NAME_PF);
}
return _taskPerformers;
}
@@ -55,35 +53,39 @@ namespace DatabaseImplement.Models
public virtual List Performers { get; set; } = new();
- public static Task? Create(TaskTrackerDatabase context, TaskBindingModel? model)
- {
- if (model == null)
- {
- return null;
- }
- return new Task()
- {
- Id = model.Id,
- SHORT_DESC = model.SHORT_DESC,
- DESCRIPTION = model.DESCRIPTION,
- Status = model.Status,
- DEADLINE = model.DEADLINE,
- ProjectId = model.ProjectId,
- TagGroupId = model.TagGroupId,
- Performers = model.TaskPerformers.Select(x => new TaskPerformers
- {
- Performer = context.Performers.First(y => y.Id == x.Key)
- }).ToList()
- };
- }
+ public static Task? Create(TaskBindingModel? model)
+ {
+ if (model == null)
+ {
+ return null;
+ }
+ using var context = new TaskTrackerDatabase();
+ var task = new Task()
+ {
+ Id = model.Id,
+ SHORT_DESC = model.SHORT_DESC,
+ DESCRIPTION = model.DESCRIPTION,
+ DEADLINE = model.DEADLINE,
+ ProjectId = model.ProjectId,
+ TagGroupId = model.TagGroupId,
+ Performers = model.TaskPerformers.Select(x => new TaskPerformers
+ {
+ Performer = context.Performers.First(y => y.Id == x.Key)
+ }).ToList()
+ };
- public void Update(TaskBindingModel? model)
+ return task;
+ }
+
+ public void Update(TaskBindingModel? model)
{
if (model == null)
{
return;
}
- Status = model.Status;
+ SHORT_DESC = model.SHORT_DESC;
+ DESCRIPTION = model.DESCRIPTION;
+ DEADLINE = model.DEADLINE;
}
public TaskViewModel GetViewModel => new()
@@ -91,7 +93,6 @@ namespace DatabaseImplement.Models
Id = Id,
SHORT_DESC = SHORT_DESC,
DESCRIPTION = DESCRIPTION,
- Status = Status,
DEADLINE = DEADLINE,
ProjectId = ProjectId,
ProjectName = Project.NAME_PJ,
diff --git a/TaskTracker/RestApi/Controllers/ClientController.cs b/TaskTracker/RestApi/Controllers/ClientController.cs
new file mode 100644
index 0000000..58e93f9
--- /dev/null
+++ b/TaskTracker/RestApi/Controllers/ClientController.cs
@@ -0,0 +1,64 @@
+using Microsoft.AspNetCore.Mvc;
+using Contracts.BindingModels;
+using Contracts.BusinessLogicContracts;
+using Contracts.SearchModels;
+using Contracts.ViewModels;
+
+namespace TaskTrackerRestApi.Controllers
+{
+ [Route("api/[controller]/[action]")]
+ [ApiController]
+ public class ClientController : Controller
+ {
+
+ private readonly IPerformerLogic _logic;
+
+ public ClientController(IPerformerLogic logic)
+ {
+ _logic = logic;
+ }
+
+ [HttpGet]
+ public PerformerViewModel? Login(string login, string password)
+ {
+ try
+ {
+ return _logic.ReadElement(new PerformerSearchModel
+ {
+ login = login,
+ password = password
+ });
+ }
+ catch
+ {
+ throw;
+ }
+ }
+
+ [HttpPost]
+ public void Register(PerformerBindingModel model)
+ {
+ try
+ {
+ _logic.Create(model);
+ }
+ catch
+ {
+ throw;
+ }
+ }
+
+ [HttpPost]
+ public void UpdateData(PerformerBindingModel model)
+ {
+ try
+ {
+ _logic.Update(model);
+ }
+ catch
+ {
+ throw;
+ }
+ }
+ }
+}
diff --git a/TaskTracker/RestApi/Controllers/MainController.cs b/TaskTracker/RestApi/Controllers/MainController.cs
new file mode 100644
index 0000000..2e6a8ce
--- /dev/null
+++ b/TaskTracker/RestApi/Controllers/MainController.cs
@@ -0,0 +1,176 @@
+using Contracts.BindingModels;
+using Contracts.BusinessLogicContracts;
+using Contracts.SearchModels;
+using Contracts.ViewModels;
+using Microsoft.AspNetCore.Mvc;
+using DatabaseImplement.Models;
+using DatabaseImplement;
+
+namespace TaskTrackerRestApi.Controllers
+{
+ [Route("api/[controller]/[action]")]
+ [ApiController]
+ public class MainController : Controller
+ {
+
+ private readonly ITaskLogic _task;
+
+ private readonly IProjectLogic _project;
+
+ private readonly ICommentLogic _comment;
+
+ private readonly ITeamLogic _team;
+
+ private readonly ITagGroupLogic _tagGroup;
+
+ public MainController(ITaskLogic task, IProjectLogic project, ICommentLogic comment, ITeamLogic team, ITagGroupLogic tagGroupLogic)
+ {
+ _task = task;
+ _project = project;
+ _comment = comment;
+ _team = team;
+ _tagGroup = tagGroupLogic;
+ }
+
+ [HttpGet]
+ public List? GetTagsList()
+ {
+ try
+ {
+ return _tagGroup.ReadList(null);
+ }
+ catch
+ {
+ throw;
+ }
+ }
+
+ [HttpGet]
+ public List? GetProjectList()
+ {
+ try
+ {
+ return _project.ReadList(null);
+ }
+ catch
+ {
+ throw;
+ }
+ }
+
+ [HttpPost]
+ public void CreateProject(ProjectBindingModel model)
+ {
+ try
+ {
+ _project.Create(model);
+ }
+ catch
+ {
+ throw;
+ }
+ }
+
+ [HttpGet]
+ public List? GetCommentsList()
+ {
+ try
+ {
+ return _comment.ReadList(null);
+ }
+ catch
+ {
+ throw;
+ }
+ }
+
+ [HttpGet]
+ public List? GetComments(int PerformerId)
+ {
+ try
+ {
+ return _comment.ReadList(new CommentSearchModel { PerformerId = PerformerId });
+ }
+ catch
+ {
+ throw;
+ }
+ }
+ [HttpPost]
+ public void CreateComment(CommentBindingModel model)
+ {
+ try
+ {
+ _comment.Create(model);
+ }
+ catch
+ {
+ throw;
+ }
+ }
+
+ [HttpGet]
+ public List? GetTeamList()
+ {
+ try
+ {
+ return _team.ReadList(null);
+ }
+ catch
+ {
+ throw;
+ }
+ }
+
+ [HttpGet]
+ public List? GetTeams(int teamId)
+ {
+ try
+ {
+ return _team.ReadList(new TeamSearchModel { Id = teamId });
+ }
+ catch
+ {
+ throw;
+ }
+ }
+ [HttpPost]
+ public void CreateTeam(TeamBindingModel model)
+ {
+ try
+ {
+ _team.Create(model);
+ }
+ catch
+ {
+ throw;
+ }
+ }
+
+ [HttpGet]
+ public List? GetTaskList()
+ {
+ try
+ {
+ return _task.ReadList(null);
+ }
+ catch
+ {
+ throw;
+ }
+ }
+
+ [HttpPost]
+ public void CreateTask(TaskBindingModel model)
+ {
+ try
+ {
+ _task.CreateTask(model);
+ }
+ catch
+ {
+ throw;
+ }
+ }
+ }
+}
diff --git a/TaskTracker/RestApi/Controllers/WeatherForecastController.cs b/TaskTracker/RestApi/Controllers/WeatherForecastController.cs
deleted file mode 100644
index 6d4452a..0000000
--- a/TaskTracker/RestApi/Controllers/WeatherForecastController.cs
+++ /dev/null
@@ -1,33 +0,0 @@
-using Microsoft.AspNetCore.Mvc;
-
-namespace RestApi.Controllers
-{
- [ApiController]
- [Route("[controller]")]
- public class WeatherForecastController : ControllerBase
- {
- private static readonly string[] Summaries = new[]
- {
- "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
- };
-
- private readonly ILogger _logger;
-
- public WeatherForecastController(ILogger logger)
- {
- _logger = logger;
- }
-
- [HttpGet(Name = "GetWeatherForecast")]
- public IEnumerable Get()
- {
- return Enumerable.Range(1, 5).Select(index => new WeatherForecast
- {
- Date = DateTime.Now.AddDays(index),
- TemperatureC = Random.Shared.Next(-20, 55),
- Summary = Summaries[Random.Shared.Next(Summaries.Length)]
- })
- .ToArray();
- }
- }
-}
diff --git a/TaskTracker/RestApi/Program.cs b/TaskTracker/RestApi/Program.cs
index d7a851e..d073c8e 100644
--- a/TaskTracker/RestApi/Program.cs
+++ b/TaskTracker/RestApi/Program.cs
@@ -1,11 +1,40 @@
+
+using BusinessLogic.BusinessLogic;
+using Contracts.BusinessLogicContracts;
+using Contracts.StoragesContracts;
+using DatabaseImplement.Implements;
+using Microsoft.AspNetCore.Identity;
+using Microsoft.OpenApi.Models;
+
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
+builder.Services.AddTransient();
+builder.Services.AddTransient();
+builder.Services.AddTransient();
+builder.Services.AddTransient();
+builder.Services.AddTransient();
+builder.Services.AddTransient();
+
+builder.Services.AddTransient();
+builder.Services.AddTransient();
+builder.Services.AddTransient();
+builder.Services.AddTransient();
+builder.Services.AddTransient();
+builder.Services.AddTransient();
builder.Services.AddControllers();
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
-builder.Services.AddSwaggerGen();
+builder.Services.AddSwaggerGen(c =>
+{
+ c.SwaggerDoc("v1", new OpenApiInfo
+ {
+ Title = "TaskTrackerRestApi",
+ Version
+ = "v1"
+ });
+});
var app = builder.Build();
@@ -13,7 +42,8 @@ var app = builder.Build();
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
- app.UseSwaggerUI();
+ app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json",
+ "TaskTrackerRestApi v1"));
}
app.UseHttpsRedirection();
diff --git a/TaskTracker/RestApi/RestApi.csproj b/TaskTracker/RestApi/RestApi.csproj
index 2c33b1c..dce1f90 100644
--- a/TaskTracker/RestApi/RestApi.csproj
+++ b/TaskTracker/RestApi/RestApi.csproj
@@ -1,4 +1,4 @@
-
+
net6.0
@@ -10,4 +10,11 @@
-
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/TaskTracker/RestApi/WeatherForecast.cs b/TaskTracker/RestApi/WeatherForecast.cs
deleted file mode 100644
index 32151da..0000000
--- a/TaskTracker/RestApi/WeatherForecast.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-namespace RestApi
-{
- public class WeatherForecast
- {
- public DateTime Date { get; set; }
-
- public int TemperatureC { get; set; }
-
- public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
-
- public string? Summary { get; set; }
- }
-}