diff --git a/.gitignore b/.gitignore index f7577c8..435d3bb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,14 +1,14 @@ -bin/ -obj/ .vs/ .vscode/ -Migrations/ -app.db* .DS_Store -app.db +bin/ +obj/ +app.db* Data/Interfaces Data/UnitOfWork.cs Data/*Repository.cs +Migrations/ +Properties/ # client client/src/pages/TestPage.tsx diff --git a/Data/ProjectRepository.cs b/Data/ProjectRepository.cs deleted file mode 100644 index 202f9d9..0000000 --- a/Data/ProjectRepository.cs +++ /dev/null @@ -1,49 +0,0 @@ -using System.Threading.Tasks; -using TicketManager.Models; -using System.Linq; -using Microsoft.EntityFrameworkCore; -using System.Collections.Generic; - -namespace TicketManager.Data -{ - public class ProjectRepository : GenericRepository, IProjectRepository - { - private readonly IQueryable _query; - public ProjectRepository(AppDbContext context) : base(context) - { - _query = _dbSet - .Include(p => p.Assignments).ThenInclude(a => a.User) - .Include(p => p.Tickets) - .Include(p => p.Manager) - .Include(p => p.Files) - // .AsNoTracking() - ; - } - - public override async Task Get(int id) - { - return await _query.FirstOrDefaultAsync(p => p.Id == id); - } - - public override async Task> List() - { - return await _query.ToListAsync(); - } - - public bool Exists(int id) - { - return _dbSet.Any(e => e.Id == id); - } - - public async Task> GetMembers(int id) - { - Project project = await Get(id); - return project.GetMembers(); - } - public async Task SetMembers(int id, List usersToAdd) - { - Project project = await Get(id); - project.SetMembers(usersToAdd); - } - } -} \ No newline at end of file diff --git a/DataTransfertObjects/AppUserDTO.cs b/DataTransfertObjects/AppUserDTO.cs deleted file mode 100644 index 250fbcc..0000000 --- a/DataTransfertObjects/AppUserDTO.cs +++ /dev/null @@ -1,53 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using TicketManager.Models; - -namespace TicketManager.DTO -{ - public class AppUserDTO - { - public AppUserDTO(AppUser user) - { - Id = user.Id; - FirstName = user.FirstName; - LastName = user.LastName; - Presentation = user.Presentation; - Email = user.Email; - Phone = user.Phone; - Created_at = user.Created_at; - Picture = user.Picture; - Activities = user.Activities; - Projects = user.GetProjects(); - Tickets = user.GetTickets(); - } - - public Guid Id { get; set; } - - public string FirstName { get; set; } - - public string LastName { get; set; } - - public string FullName => $"{FirstName} {LastName}"; - - public string Presentation { get; set; } - - [DataType(DataType.EmailAddress)] - public string Email { get; set; } - - [DataType(DataType.PhoneNumber)] - public string Phone { get; set; } - - [DataType(DataType.Date)] - public DateTime Created_at { get; private set; } = DateTime.Now; - - public string Picture { get; set; } - - public List Activities { get; set; } = new List(); - - public List Projects { get; set; } = new List(); - - public List Tickets { get; set; } = new List(); - - } -} \ No newline at end of file diff --git a/DataTransfertObjects/ProjectDTO.cs b/DataTransfertObjects/ProjectDTO.cs deleted file mode 100644 index ccfa8a3..0000000 --- a/DataTransfertObjects/ProjectDTO.cs +++ /dev/null @@ -1,47 +0,0 @@ -using System; -using System.Collections.Generic; -using TicketManager.Models; - -namespace TicketManager.DTO -{ - public class ProjectDTO - { - public ProjectDTO(Project project) - { - Id = project.Id; - Title = project.Title; - Description = project.Description; - CreatedAt = project.CreatedAt; - Progression = project.Progression; - Status = project.Status.ToString(); - Manager = project.Manager; - Users = project.GetMembers(); - Tickets = project.Tickets; - Activities = project.Activities; - Files = project.Files; - } - - public int Id { get; set; } - - public string Title { get; set; } - - public string Description { get; set; } - - public DateTime CreatedAt { get; private set; } = DateTime.Now; - - public DateTime PlannedEnding { get; set; } - - public decimal Progression { get; set; } - - public string Status { get; set; } - - public AppUser Manager { get; set; } - public List Users { get; set; } = new List(); - - public List Tickets { get; set; } = new List(); - - public List Activities { get; set; } = new List(); - - public List Files { get; set; } = new List(); - } -} \ No newline at end of file diff --git a/DataTransfertObjects/TicketDTO.cs b/DataTransfertObjects/TicketDTO.cs deleted file mode 100644 index 4ff3bae..0000000 --- a/DataTransfertObjects/TicketDTO.cs +++ /dev/null @@ -1,51 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using TicketManager.Models; - -namespace TicketManager.DTO -{ - public class TicketDTO - { - public TicketDTO(Ticket ticket) - { - Id = ticket.Id; - Title = ticket.Title; - Description = ticket.Description; - CreatedAt = ticket.CreatedAt; - PlannedEnding = ticket.PlannedEnding; - Status = ticket.Status.ToString(); - Impact = ticket.Impact.ToString(); - Difficulty = ticket.Difficulty.ToString(); - Category = ticket.Category.ToString(); - CreatorId = ticket.CreatorId; - Project = ticket.Project; - Notes = ticket.Notes; - Activities = ticket.Activities; - Files = ticket.Files; - Users = ticket.GetAssignees(); - } - public int Id { get; set; } - - public string Title { get; set; } - - public string Description { get; set; } - - [DataType(DataType.Date)] - public DateTime CreatedAt { get; private set; } - - [DataType(DataType.Date)] - public DateTime PlannedEnding { get; set; } - - public string Status { get; set; } - public string Impact { get; set; } - public string Difficulty { get; set; } - public string Category { get; set; } - public Guid CreatorId { get; set; } - public Project Project { get; set; } - public List Notes { get; set; } = new List(); - public List Activities { get; set; } = new List(); - public List Files { get; set; } = new List(); - public List Users { get; set; } = new List(); - } -} \ No newline at end of file diff --git a/Properties/launchSettings.json b/Properties/launchSettings.json index 42e74be..7fb0bbb 100644 --- a/Properties/launchSettings.json +++ b/Properties/launchSettings.json @@ -20,7 +20,7 @@ "TicketManager": { "commandName": "Project", "launchBrowser": true, - "launchUrl": "weatherforecast", + "launchUrl": "/", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" }, diff --git a/Startup.cs b/Startup.cs index 6edc27f..9cd7ec7 100644 --- a/Startup.cs +++ b/Startup.cs @@ -41,9 +41,9 @@ namespace TicketManager options.EnableSensitiveDataLogging(true); //Remove in production. } ); - services.AddScoped(); - services.AddScoped(); - services.AddScoped(); + // services.AddScoped(); + // services.AddScoped(); + // services.AddScoped(); services.AddAuthentication(options => { diff --git a/TicketManager.csproj b/TicketManager.csproj index 9a81c04..d68b951 100644 --- a/TicketManager.csproj +++ b/TicketManager.csproj @@ -3,7 +3,7 @@ netcoreapp3.1 - + 8.0 @@ -30,6 +30,10 @@ + + runtime; build; native; contentfiles; analyzers; buildtransitive + all +