mirror of
https://github.com/rjNemo/ticket_manager
synced 2026-06-06 00:36:39 +00:00
Light code cleaning
This commit is contained in:
parent
83dcab1c15
commit
112ccbefee
8 changed files with 5 additions and 71 deletions
|
|
@ -1,57 +0,0 @@
|
||||||
// using System.Threading.Tasks;
|
|
||||||
// using TicketManager.Models;
|
|
||||||
// using System.Linq;
|
|
||||||
// using Microsoft.EntityFrameworkCore;
|
|
||||||
// using System.Collections.Generic;
|
|
||||||
// using Microsoft.AspNetCore.Mvc;
|
|
||||||
|
|
||||||
// namespace TicketManager.Data
|
|
||||||
// {
|
|
||||||
// public class ProjectRepository : IProjectRepository
|
|
||||||
// {
|
|
||||||
// private readonly AppDbContext _context;
|
|
||||||
// private readonly IQueryable<Project> _query;
|
|
||||||
// public ProjectRepository(AppDbContext context)
|
|
||||||
// {
|
|
||||||
// _context = context;
|
|
||||||
// _query = _context.Projects
|
|
||||||
// .Include(p => p.Assignments)
|
|
||||||
// .ThenInclude(a => a.User)
|
|
||||||
// .Include(p => p.Tickets)
|
|
||||||
// .Include(p => p.Manager)
|
|
||||||
// .Include(p => p.Files);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// public Task AddAsync(Project project)
|
|
||||||
// {
|
|
||||||
// _context.Projects.Add(project);
|
|
||||||
// return _context.SaveChangesAsync();
|
|
||||||
// }
|
|
||||||
|
|
||||||
// public async Task<int> DeleteAsync(int id)
|
|
||||||
// {
|
|
||||||
// Project project = await GetByIdAsync(id);
|
|
||||||
// _context.Projects.Remove(project);
|
|
||||||
// return await _context.SaveChangesAsync();
|
|
||||||
// }
|
|
||||||
|
|
||||||
// public async Task<Project> GetByIdAsync(int id)
|
|
||||||
// {
|
|
||||||
// return await _query.FirstOrDefaultAsync(p => p.Id == id);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// public async Task<IEnumerable<Project>> ListAsync()
|
|
||||||
// {
|
|
||||||
// return await _query.ToListAsync();
|
|
||||||
// }
|
|
||||||
|
|
||||||
// public Task UpdateAsync(Project project)
|
|
||||||
// {
|
|
||||||
// _context.Entry(project).State = EntityState.Modified;
|
|
||||||
// return _context.SaveChangesAsync();
|
|
||||||
// }
|
|
||||||
// public bool Exists(int id)
|
|
||||||
// { return _context.Projects.Any(e => e.Id == id); }
|
|
||||||
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
@ -24,7 +24,6 @@ namespace TicketManager.Data
|
||||||
{
|
{
|
||||||
return await _context.SaveChangesAsync();
|
return await _context.SaveChangesAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
_context.DisposeAsync();
|
_context.DisposeAsync();
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,6 @@ namespace TicketManager.Models
|
||||||
|
|
||||||
// [Display(Name = "Avatar")]
|
// [Display(Name = "Avatar")]
|
||||||
// public byte[] Picture { get; set; }
|
// public byte[] Picture { get; set; }
|
||||||
// public Role Role { get; set; }
|
|
||||||
|
|
||||||
public List<Assignment> Assignments { get; set; } = new List<Assignment>();
|
public List<Assignment> Assignments { get; set; } = new List<Assignment>();
|
||||||
|
|
||||||
|
|
@ -53,7 +52,7 @@ namespace TicketManager.Models
|
||||||
|
|
||||||
public List<Ticket> GetTickets()
|
public List<Ticket> GetTickets()
|
||||||
{
|
{
|
||||||
List<Ticket> tickets = new List<Ticket>();
|
var tickets = new List<Ticket>();
|
||||||
GetProjects().ForEach(p => tickets.Concat(p.Tickets));
|
GetProjects().ForEach(p => tickets.Concat(p.Tickets));
|
||||||
return tickets;
|
return tickets;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,6 @@ namespace TicketManager.Models
|
||||||
{
|
{
|
||||||
public class File
|
public class File
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
|
|
||||||
public string FileName { get; set; }
|
public string FileName { get; set; }
|
||||||
|
|
|
||||||
|
|
@ -119,8 +119,7 @@ namespace TicketManager.Models
|
||||||
this.AddMembers(projectMembers);
|
this.AddMembers(projectMembers);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// public int GetMembersCount() => this.GetMembers().Count();
|
|
||||||
// public void GetTicketsCount() => this.Tickets.Count();
|
|
||||||
public void GetTicketsUpdates()
|
public void GetTicketsUpdates()
|
||||||
{ throw new NotImplementedException("Not Implemented"); }
|
{ throw new NotImplementedException("Not Implemented"); }
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ namespace TicketManager.Models
|
||||||
public Difficulty Difficulty { get; set; } = Difficulty.Undefined;
|
public Difficulty Difficulty { get; set; } = Difficulty.Undefined;
|
||||||
public Category Category { get; set; } = Category.Undefined;
|
public Category Category { get; set; } = Category.Undefined;
|
||||||
|
|
||||||
[Display(Name = "Created By")]
|
// [Display(Name = "Created By")]
|
||||||
// public AppUser Creator { get; set; }
|
// public AppUser Creator { get; set; }
|
||||||
public Guid CreatorId { get; set; }
|
public Guid CreatorId { get; set; }
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -43,3 +43,4 @@
|
||||||
- Async model methods ?
|
- Async model methods ?
|
||||||
- update assignments automatically from context
|
- update assignments automatically from context
|
||||||
- use PATCH instead of PUT
|
- use PATCH instead of PUT
|
||||||
|
- logging
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,7 @@
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
<PropertyGroup >
|
||||||
<LangVersion>8.0</LangVersion>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
|
||||||
<LangVersion>8.0</LangVersion>
|
<LangVersion>8.0</LangVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
|
|
@ -16,9 +13,7 @@
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.Cookies" Version="2.2.0" />
|
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="3.1.2" />
|
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="3.1.2" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="3.1.2" />
|
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.1.1" />
|
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.1.1" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.SpaServices" Version="3.1.1" />
|
<PackageReference Include="Microsoft.AspNetCore.SpaServices" Version="3.1.1" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.SpaServices.Extensions" Version="3.1.1" />
|
<PackageReference Include="Microsoft.AspNetCore.SpaServices.Extensions" Version="3.1.1" />
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue