Merge branch 'master' of https://github.com/rjNemo/ticket_manager into backend

Latest version
This commit is contained in:
Ruidy Nemausat 2020-02-17 21:02:43 +01:00
commit 269fc631b5
76 changed files with 2613 additions and 593 deletions

BIN
.DS_Store vendored

Binary file not shown.

4
.gitignore vendored
View file

@ -3,6 +3,8 @@ obj/
.vs/
.vscode/
Migrations/
app.db*
.DS_Store
app.db
client/node_modules
Scripts/
Scripts/

BIN
Controllers/.DS_Store vendored

Binary file not shown.

View file

@ -0,0 +1,124 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using TicketManager.Data;
using TicketManager.Models;
namespace TicketManager.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class AssignmentsController : ControllerBase
{
private readonly AppDbContext _context;
public AssignmentsController(AppDbContext context)
{
_context = context;
}
// GET: api/Assignments
[HttpGet]
public async Task<ActionResult<IEnumerable<Assignment>>> GetAssignments()
{
return await _context.Assignments.ToListAsync();
}
// GET: api/Assignments/5
[HttpGet("{id}")]
public async Task<ActionResult<Assignment>> GetAssignment(int id)
{
var assignment = await _context.Assignments.FindAsync(id);
if (assignment == null)
{
return NotFound();
}
return assignment;
}
// PUT: api/Assignments/5
// To protect from overposting attacks, please enable the specific properties you want to bind to, for
// more details see https://aka.ms/RazorPagesCRUD.
[HttpPut("{id}")]
public async Task<IActionResult> PutAssignment(int id, Assignment assignment)
{
if (id != assignment.ProjectId)
{
return BadRequest();
}
_context.Entry(assignment).State = EntityState.Modified;
try
{
await _context.SaveChangesAsync();
}
catch (DbUpdateConcurrencyException)
{
if (!AssignmentExists(id))
{
return NotFound();
}
else
{
throw;
}
}
return NoContent();
}
// POST: api/Assignments
// To protect from overposting attacks, please enable the specific properties you want to bind to, for
// more details see https://aka.ms/RazorPagesCRUD.
[HttpPost]
public async Task<ActionResult<Assignment>> PostAssignment(Assignment assignment)
{
_context.Assignments.Add(assignment);
try
{
await _context.SaveChangesAsync();
}
catch (DbUpdateException)
{
if (AssignmentExists(assignment.ProjectId))
{
return Conflict();
}
else
{
throw;
}
}
return CreatedAtAction("GetAssignment", new { id = assignment.ProjectId }, assignment);
}
// DELETE: api/Assignments/5
[HttpDelete("{id}")]
public async Task<ActionResult<Assignment>> DeleteAssignment(int id)
{
var assignment = await _context.Assignments.FindAsync(id);
if (assignment == null)
{
return NotFound();
}
_context.Assignments.Remove(assignment);
await _context.SaveChangesAsync();
return assignment;
}
private bool AssignmentExists(int id)
{
return _context.Assignments.Any(e => e.ProjectId == id);
}
}
}

View file

@ -17,11 +17,11 @@ namespace TicketManager.Controllers
[ApiController]
public class ProjectsController : ControllerBase
{
private readonly AppDbContext _context;
private readonly IProjectRepository _projectRepo;
public ProjectsController(AppDbContext context)
public ProjectsController(IProjectRepository projectRepo)
{
_context = context;
_projectRepo = projectRepo;
}
/// <summary>
@ -36,9 +36,9 @@ namespace TicketManager.Controllers
/// <response code="200">Returns all existing projects</response>
[HttpGet]
[ProducesResponseType(StatusCodes.Status200OK)]
public async Task<ActionResult<IEnumerable<Project>>> GetProjects()
public async Task<IEnumerable<Project>> GetProjects()
{
return await GetAllProjectsAsync();
return await _projectRepo.List();
}
/// <summary>
@ -57,186 +57,260 @@ namespace TicketManager.Controllers
[ProducesResponseType(StatusCodes.Status404NotFound)]
public async Task<ActionResult<Project>> GetProject(int id)
{
Project project = await GetProjectByIdAsync(id);
if (project == null)
{
return NotFound();
}
Project project = await _projectRepo.Get(id);
if (project == null) { return NotFound(); }
return project;
}
/// <summary>
/// Updates a specific project.
/// </summary>
/// <remarks>
/// Sample request:
///
/// PUT: api/Projects/3
/// {
/// "id": "357727fd-5262-4522-b8a3-38271d43de84",
/// "firstName": "Thomas",
/// "lastName": "Price",
/// "presentation": "New Team?!",
/// "email": "tp@mail.com",
/// "phone": "0198237645"
/// }
///
/// </remarks>
/// <response code="200">Returns the modified project</response>
/// <response code="204">Request was succesful but no content is changed</response>
/// <response code="404">If the required project is null</response>
[HttpPut("{id}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status204NoContent)]
[ProducesResponseType(StatusCodes.Status404NotFound)]
public async Task<IActionResult> PutProject(int id, Project project)
{
if (id != project.Id)
{
return BadRequest();
}
// /// <summary>
// /// Updates a specific project.
// /// </summary>
// /// <remarks>
// /// Sample request:
// ///
// /// PUT: api/Projects/3
// /// {
// /// "id": "357727fd-5262-4522-b8a3-38271d43de84",
// /// "firstName": "Thomas",
// /// "lastName": "Price",
// /// "presentation": "New Team?!",
// /// "email": "tp@mail.com",
// /// "phone": "0198237645"
// /// }
// ///
// /// </remarks>
// /// <response code="200">Returns the modified project</response>
// /// <response code="204">Request was succesful but no content is changed</response>
// /// <response code="404">If the required project is null</response>
// [HttpPut("{id}")]
// [ProducesResponseType(StatusCodes.Status200OK)]
// [ProducesResponseType(StatusCodes.Status204NoContent)]
// [ProducesResponseType(StatusCodes.Status404NotFound)]
// public async Task<IActionResult> PutProject(int id, Project project)
// {
// if (id != project.Id) { return BadRequest(); }
_context.Entry(project).State = EntityState.Modified;
// try
// {
// await _projectRepo.Update(project);
// }
// catch (DbUpdateConcurrencyException)
// {
// if (!_projectRepo.Exists(id))
// {
// return NotFound();
// }
// else
// {
// throw;
// }
// }
try
{
await _context.SaveChangesAsync();
}
catch (DbUpdateConcurrencyException)
{
if (!ProjectExists(id))
{
return NotFound();
}
else
{
throw;
}
}
// return NoContent();
// }
return NoContent();
}
// /// <summary>
// /// Creates a project.
// /// </summary>
// /// <remarks>
// /// Sample request:
// ///
// /// POST: api/Projects/
// /// {
// /// "firstName": "Thomas",
// /// "lastName": "Price",
// /// "presentation": "New Team?!",
// /// "email": "tp@mail.com",
// /// "phone": "0198237645"
// /// }
// ///
// /// </remarks>
// /// <response code="201">Returns the created project</response>
// [HttpPost]
// [ProducesResponseType(StatusCodes.Status201Created)]
// [ProducesResponseType(StatusCodes.Status404NotFound)]
// public async Task<ActionResult<Project>> PostProject(Project project)
// {
// if (!ModelState.IsValid) { return BadRequest(); }
// await _projectRepo.AddAsync(project);
// POST: api/Projects
// To protect from overposting attacks, please enable the specific properties you want to bind to, for
// more details see https://aka.ms/RazorPagesCRUD.
[HttpPost]
public async Task<ActionResult<Project>> PostProject(Project project)
{
_context.Projects.Add(project);
await _context.SaveChangesAsync();
// return CreatedAtAction("GetProject", new { id = project.Id }, project);
// }
return CreatedAtAction("GetProject", new { id = project.Id }, project);
}
// DELETE: api/Projects/5
[HttpDelete("{id}")]
public async Task<ActionResult<Project>> DeleteProject(int id)
{
var project = await _context.Projects.FindAsync(id);
if (project == null)
{
return NotFound();
}
_context.Projects.Remove(project);
await _context.SaveChangesAsync();
return project;
}
// /// <summary>
// /// Deletes a project.
// /// </summary>
// /// <remarks>
// /// Sample request:
// ///
// /// DELETE: api/Projects/5
// ///
// /// </remarks>
// /// <response code="200">Returns the deleted project</response>
// [ProducesResponseType(StatusCodes.Status200OK)]
// [ProducesResponseType(StatusCodes.Status404NotFound)]
// [HttpDelete("{id}")]
// public async Task<ActionResult<Project>> DeleteProject(int id)
// {
// var project = await _projectRepo.GetByIdAsync(id);
// if (project == null)
// {
// return NotFound();
// }
// await _projectRepo.DeleteAsync(id);
// return project;
// }
[HttpGet("{id}/members")]
public async Task<ActionResult<List<AppUser>>> GetProjectMembers(int id)
{
Project project = await GetProjectByIdAsync(id);
return project.GetMembers();
}
// /// <summary>
// /// Gets a project members.
// /// </summary>
// /// <remarks>
// /// Sample request:
// ///
// /// GET: api/Projects/5/Members
// ///
// /// </remarks>
// /// <response code="200">Returns the project members</response>
// [ProducesResponseType(StatusCodes.Status200OK)]
// [ProducesResponseType(StatusCodes.Status404NotFound)]
// [HttpGet("{id}/members")]
// public async Task<ActionResult<List<AppUser>>> GetProjectMembers(int id)
// {
// Project project = await _projectRepo.GetByIdAsync(id);
// if (project == null)
// { return NotFound(); }
// return project.GetMembers();
// }
[HttpPut("{id}/members")]
public async Task<ActionResult<Project>> SetProjectMembers(int id, List<AppUser> projectMembers)
{
Project project = await GetProjectByIdAsync(id);
project.SetMembers(projectMembers);
try
{
await _context.SaveChangesAsync();
}
catch (DbUpdateException /* ex */)
{
//Log the error (uncomment ex variable name and write a log.)
ModelState.AddModelError("", "Unable to save changes. " +
"Try again, and if the problem persists, " +
"see your system administrator.");
}
return NoContent();
}
// /// <summary>
// /// Updates a project members.
// /// </summary>
// /// <remarks>
// /// Sample request:
// ///
// /// PUT: api/Projects/5/Members
// /// {
// /// "id": "357727fd-5262-4522-b8a3-38271d43de84",
// /// "firstName": "Thomas",
// /// "lastName": "Price",
// /// "presentation": "New Team?!",
// /// "email": "tp@mail.com",
// /// "phone": "0198237645"
// /// }
// /// </remarks>
// /// <response code="204">No content</response>
// [ProducesResponseType(StatusCodes.Status204NoContent)]
// [ProducesResponseType(StatusCodes.Status404NotFound)]
// [HttpPut("{id}/members")]
// public async Task<ActionResult<Project>> SetProjectMembers(int id, List<AppUser> projectMembers)
// {
// Project project = await _projectRepo.GetByIdAsync(id);
// if (project == null)
// {
// return NotFound();
// }
// project.SetMembers(projectMembers);
// try
// {
// await _projectRepo.UpdateAsync(project);
// }
// catch (DbUpdateException /* ex */)
// {
// //Log the error (uncomment ex variable name and write a log.)
// ModelState.AddModelError("", "Unable to save changes. " +
// "Try again, and if the problem persists, " +
// "see your system administrator.");
// }
// return NoContent();
// }
[HttpPut("{id}/addMembers")]
public async Task<ActionResult<Project>> AddMembersToProject(int id, List<AppUser> usersToAdd)
{
if (usersToAdd == null)
{
return BadRequest();
}
Project project = await GetProjectByIdAsync(id);
project.AddMembers(usersToAdd);
try
{
await _context.SaveChangesAsync();
}
catch (DbUpdateException /* ex */)
{
//Log the error (uncomment ex variable name and write a log.)
ModelState.AddModelError("", "Unable to save changes. " +
"Try again, and if the problem persists, " +
"see your system administrator.");
}
return NoContent();
}
// // /// <summary>
// // /// Assign a user to a project.
// // /// </summary>
// // /// <remarks>
// // /// Sample request:
// // ///
// // /// POST: api/Projects/addmembers
// // /// [{
// // /// "id": "357727fd-5262-4522-b8a3-38271d43de84",
// // /// "firstName": "Thomas",
// // /// "lastName": "Price",
// // /// "presentation": "New Team?!",
// // /// "email": "tp@mail.com",
// // /// "phone": "0198237645"
// // /// }]
// // ///
// // /// </remarks>
// // /// <response code="204">Returns the created project</response>
// // [ProducesResponseType(StatusCodes.Status204NoContent)]
// // [ProducesResponseType(StatusCodes.Status404NotFound)]
// // [HttpPut("{id}/addMembers")]
// // public async Task<ActionResult<Project>> AddMembersToProject(int id, List<AppUser> usersToAdd)
// // {
// // if (usersToAdd == null)
// // {
// // return BadRequest();
// // }
// // Project project = await GetProjectByIdAsync(id);
// // project.AddMembers(usersToAdd);
// // try
// // {
// // await _context.SaveChangesAsync();
// // }
// // catch (DbUpdateException /* ex */)
// // {
// // //Log the error (uncomment ex variable name and write a log.)
// // ModelState.AddModelError("", "Unable to save changes. " +
// // "Try again, and if the problem persists, " +
// // "see your system administrator.");
// // }
// // return NoContent();
// // }
// // /// <summary>
// // /// Remove a user to a project.
// // /// </summary>
// // /// <remarks>
// // /// Sample request:
// // ///
// // /// PUT: api/Projects/removemembers
// // /// [{
// // /// "id": "357727fd-5262-4522-b8a3-38271d43de84",
// // /// "firstName": "Thomas",
// // /// "lastName": "Price",
// // /// "presentation": "New Team?!",
// // /// "email": "tp@mail.com",
// // /// "phone": "0198237645"
// // /// }]
// // ///
// // /// </remarks>
// // /// <response code="204">Returns the created project</response>
// // [ProducesResponseType(StatusCodes.Status204NoContent)]
// // [ProducesResponseType(StatusCodes.Status404NotFound)]
// // [HttpPut("{id}/removeMembers")]
// // public async Task<ActionResult<Project>> RemoveMembersFromProject(int id, List<AppUser> usersToRemove)
// // {
// // Project project = await GetProjectByIdAsync(id);
// // project.RemoveMembers(usersToRemove);
// // try
// // {
// // await _context.SaveChangesAsync();
// // }
// // catch (DbUpdateException /* ex */)
// // {
// // //Log the error (uncomment ex variable name and write a log.)
// // ModelState.AddModelError("", "Unable to save changes. " +
// // "Try again, and if the problem persists, " +
// // "see your system administrator.");
// // }
// // return NoContent();
// // }
[HttpPut("{id}/removeMembers")]
public async Task<ActionResult<Project>> RemoveMembersFromProject(int id, List<AppUser> usersToRemove)
{
Project project = await GetProjectByIdAsync(id);
project.RemoveMembers(usersToRemove);
try
{
await _context.SaveChangesAsync();
}
catch (DbUpdateException /* ex */)
{
//Log the error (uncomment ex variable name and write a log.)
ModelState.AddModelError("", "Unable to save changes. " +
"Try again, and if the problem persists, " +
"see your system administrator.");
}
return NoContent();
}
private bool ProjectExists(int id)
{
return _context.Projects.Any(e => e.Id == id);
}
private async Task<ActionResult<IEnumerable<Project>>> GetAllProjectsAsync()
{
return await makeProjectsQueryAsync()
.ToListAsync();
}
private async Task<Project> GetProjectByIdAsync(int id)
{
return await makeProjectsQueryAsync()
.FirstOrDefaultAsync(p => p.Id == id);
}
private IQueryable<Project> makeProjectsQueryAsync()
{
return _context.Projects
.Include(p => p.Assignments)
.ThenInclude(a => a.User)
.Include(p => p.Tickets)
.Include(p => p.Manager)
.Include(p => p.Files);
}
}
}

View file

@ -0,0 +1,317 @@
// using System;
// using System.Collections.Generic;
// using System.Linq;
// using System.Net.Mime;
// using System.Threading.Tasks;
// using Microsoft.AspNetCore.Http;
// using Microsoft.AspNetCore.Mvc;
// using Microsoft.EntityFrameworkCore;
// using TicketManager.Data;
// using TicketManager.Models;
// namespace TicketManager.Controllers
// {
// [Produces("application/json")]
// [Route("api/v1/[controller]")]
// [ApiController]
// public class ProjectsController : ControllerBase
// {
// private readonly IProjectRepository _projectRepo;
// public ProjectsController(IProjectRepository projectRepo)
// {
// _projectRepo = projectRepo;
// }
// /// <summary>
// /// Returns all existing projects.
// /// </summary>
// /// <remarks>
// /// Sample request:
// ///
// /// GET: api/Projects
// ///
// /// </remarks>
// /// <response code="200">Returns all existing projects</response>
// [HttpGet]
// [ProducesResponseType(StatusCodes.Status200OK)]
// public async Task<IEnumerable<Project>> GetProjects()
// {
// return await _projectRepo.ListAsync();
// // GetAllProjectsAsync();
// }
// /// <summary>
// /// Returns a specific project.
// /// </summary>
// /// <remarks>
// /// Sample request:
// ///
// /// GET: api/Projects/2
// ///
// /// </remarks>
// /// <response code="200">Returns a specific project</response>
// /// <response code="404">If the required project is null</response>
// [HttpGet("{id}")]
// [ProducesResponseType(StatusCodes.Status200OK)]
// [ProducesResponseType(StatusCodes.Status404NotFound)]
// public async Task<ActionResult<Project>> GetProject(int id)
// {
// Project project = await _projectRepo.GetByIdAsync(id);
// if (project == null) { return NotFound(); }
// return project;
// }
// /// <summary>
// /// Updates a specific project.
// /// </summary>
// /// <remarks>
// /// Sample request:
// ///
// /// PUT: api/Projects/3
// /// {
// /// "id": "357727fd-5262-4522-b8a3-38271d43de84",
// /// "firstName": "Thomas",
// /// "lastName": "Price",
// /// "presentation": "New Team?!",
// /// "email": "tp@mail.com",
// /// "phone": "0198237645"
// /// }
// ///
// /// </remarks>
// /// <response code="200">Returns the modified project</response>
// /// <response code="204">Request was succesful but no content is changed</response>
// /// <response code="404">If the required project is null</response>
// [HttpPut("{id}")]
// [ProducesResponseType(StatusCodes.Status200OK)]
// [ProducesResponseType(StatusCodes.Status204NoContent)]
// [ProducesResponseType(StatusCodes.Status404NotFound)]
// public async Task<IActionResult> PutProject(int id, Project project)
// {
// if (id != project.Id) { return BadRequest(); }
// try
// {
// await _projectRepo.UpdateAsync(project);
// }
// catch (DbUpdateConcurrencyException)
// {
// if (!_projectRepo.Exists(id))
// {
// return NotFound();
// }
// else
// {
// throw;
// }
// }
// return NoContent();
// }
// /// <summary>
// /// Creates a project.
// /// </summary>
// /// <remarks>
// /// Sample request:
// ///
// /// POST: api/Projects/
// /// {
// /// "firstName": "Thomas",
// /// "lastName": "Price",
// /// "presentation": "New Team?!",
// /// "email": "tp@mail.com",
// /// "phone": "0198237645"
// /// }
// ///
// /// </remarks>
// /// <response code="201">Returns the created project</response>
// [HttpPost]
// [ProducesResponseType(StatusCodes.Status201Created)]
// [ProducesResponseType(StatusCodes.Status404NotFound)]
// public async Task<ActionResult<Project>> PostProject(Project project)
// {
// if (!ModelState.IsValid) { return BadRequest(); }
// await _projectRepo.AddAsync(project);
// return CreatedAtAction("GetProject", new { id = project.Id }, project);
// }
// /// <summary>
// /// Deletes a project.
// /// </summary>
// /// <remarks>
// /// Sample request:
// ///
// /// DELETE: api/Projects/5
// ///
// /// </remarks>
// /// <response code="200">Returns the deleted project</response>
// [ProducesResponseType(StatusCodes.Status200OK)]
// [ProducesResponseType(StatusCodes.Status404NotFound)]
// [HttpDelete("{id}")]
// public async Task<ActionResult<Project>> DeleteProject(int id)
// {
// var project = await _projectRepo.GetByIdAsync(id);
// if (project == null)
// {
// return NotFound();
// }
// await _projectRepo.DeleteAsync(id);
// return project;
// }
// /// <summary>
// /// Gets a project members.
// /// </summary>
// /// <remarks>
// /// Sample request:
// ///
// /// GET: api/Projects/5/Members
// ///
// /// </remarks>
// /// <response code="200">Returns the project members</response>
// [ProducesResponseType(StatusCodes.Status200OK)]
// [ProducesResponseType(StatusCodes.Status404NotFound)]
// [HttpGet("{id}/members")]
// public async Task<ActionResult<List<AppUser>>> GetProjectMembers(int id)
// {
// Project project = await _projectRepo.GetByIdAsync(id);
// if (project == null)
// { return NotFound(); }
// return project.GetMembers();
// }
// /// <summary>
// /// Updates a project members.
// /// </summary>
// /// <remarks>
// /// Sample request:
// ///
// /// PUT: api/Projects/5/Members
// /// {
// /// "id": "357727fd-5262-4522-b8a3-38271d43de84",
// /// "firstName": "Thomas",
// /// "lastName": "Price",
// /// "presentation": "New Team?!",
// /// "email": "tp@mail.com",
// /// "phone": "0198237645"
// /// }
// /// </remarks>
// /// <response code="204">No content</response>
// [ProducesResponseType(StatusCodes.Status204NoContent)]
// [ProducesResponseType(StatusCodes.Status404NotFound)]
// [HttpPut("{id}/members")]
// public async Task<ActionResult<Project>> SetProjectMembers(int id, List<AppUser> projectMembers)
// {
// Project project = await _projectRepo.GetByIdAsync(id);
// if (project == null)
// {
// return NotFound();
// }
// project.SetMembers(projectMembers);
// try
// {
// await _projectRepo.UpdateAsync(project);
// }
// catch (DbUpdateException /* ex */)
// {
// //Log the error (uncomment ex variable name and write a log.)
// ModelState.AddModelError("", "Unable to save changes. " +
// "Try again, and if the problem persists, " +
// "see your system administrator.");
// }
// return NoContent();
// }
// // /// <summary>
// // /// Assign a user to a project.
// // /// </summary>
// // /// <remarks>
// // /// Sample request:
// // ///
// // /// POST: api/Projects/addmembers
// // /// [{
// // /// "id": "357727fd-5262-4522-b8a3-38271d43de84",
// // /// "firstName": "Thomas",
// // /// "lastName": "Price",
// // /// "presentation": "New Team?!",
// // /// "email": "tp@mail.com",
// // /// "phone": "0198237645"
// // /// }]
// // ///
// // /// </remarks>
// // /// <response code="204">Returns the created project</response>
// // [ProducesResponseType(StatusCodes.Status204NoContent)]
// // [ProducesResponseType(StatusCodes.Status404NotFound)]
// // [HttpPut("{id}/addMembers")]
// // public async Task<ActionResult<Project>> AddMembersToProject(int id, List<AppUser> usersToAdd)
// // {
// // if (usersToAdd == null)
// // {
// // return BadRequest();
// // }
// // Project project = await GetProjectByIdAsync(id);
// // project.AddMembers(usersToAdd);
// // try
// // {
// // await _context.SaveChangesAsync();
// // }
// // catch (DbUpdateException /* ex */)
// // {
// // //Log the error (uncomment ex variable name and write a log.)
// // ModelState.AddModelError("", "Unable to save changes. " +
// // "Try again, and if the problem persists, " +
// // "see your system administrator.");
// // }
// // return NoContent();
// // }
// // /// <summary>
// // /// Remove a user to a project.
// // /// </summary>
// // /// <remarks>
// // /// Sample request:
// // ///
// // /// PUT: api/Projects/removemembers
// // /// [{
// // /// "id": "357727fd-5262-4522-b8a3-38271d43de84",
// // /// "firstName": "Thomas",
// // /// "lastName": "Price",
// // /// "presentation": "New Team?!",
// // /// "email": "tp@mail.com",
// // /// "phone": "0198237645"
// // /// }]
// // ///
// // /// </remarks>
// // /// <response code="204">Returns the created project</response>
// // [ProducesResponseType(StatusCodes.Status204NoContent)]
// // [ProducesResponseType(StatusCodes.Status404NotFound)]
// // [HttpPut("{id}/removeMembers")]
// // public async Task<ActionResult<Project>> RemoveMembersFromProject(int id, List<AppUser> usersToRemove)
// // {
// // Project project = await GetProjectByIdAsync(id);
// // project.RemoveMembers(usersToRemove);
// // try
// // {
// // await _context.SaveChangesAsync();
// // }
// // catch (DbUpdateException /* ex */)
// // {
// // //Log the error (uncomment ex variable name and write a log.)
// // ModelState.AddModelError("", "Unable to save changes. " +
// // "Try again, and if the problem persists, " +
// // "see your system administrator.");
// // }
// // return NoContent();
// // }
// }
// }

View file

@ -131,7 +131,7 @@ namespace TicketManager.Controllers
// .Include(p => p.Edits)
// .Include(p => p.Notes)
// .Include(p => p.Files)
.Include(p => p.Creator)
// .Include(p => p.Creator)
;
}

52
Data/GenericRepository.cs Normal file
View file

@ -0,0 +1,52 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
namespace TicketManager.Data
{
public class GenericRepository<T> : IGenericRepository<T> where T : class
{
protected readonly AppDbContext _context;
protected readonly DbSet<T> _dbSet;
public GenericRepository(AppDbContext context)
{
_context = context;
_dbSet = _context.Set<T>();
}
public void Add(T entity)
{
_dbSet.Add(entity);
}
public void Delete(T entity)
{
if (_context.Entry(entity).State == EntityState.Detached)
{ _dbSet.Attach(entity); }
_dbSet.Remove(entity);
}
public async Task<IEnumerable<T>> Find(int id, Expression<Func<T, bool>> expr)
{
return await _dbSet.Where(expr).AsNoTracking().ToListAsync();
}
public virtual async Task<T> Get(int id)
{
return await _dbSet.FindAsync(id);
}
public virtual async Task<IEnumerable<T>> List()
{
return await _dbSet.AsNoTracking().ToListAsync();
}
public void Update(T entity)
{
_dbSet.Attach(entity);
_context.Entry(entity).State = EntityState.Modified;
}
}
}

View file

@ -0,0 +1,20 @@
using System;
using System.Linq.Expressions;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace TicketManager.Data
{
public interface IGenericRepository<T> where T : class
{
Task<IEnumerable<T>> List();
Task<T> Get(int id);
Task<IEnumerable<T>> Find(int id, Expression<Func<T, bool>> expr);
void Add(T entity);
void Update(T entity);
void Delete(T entity);
}
}

View file

@ -0,0 +1,13 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using TicketManager.Models;
namespace TicketManager.Data
{
public interface IProjectRepository : IGenericRepository<Project>
{
bool Exists(int id);
Task<IEnumerable<AppUser>> GetMembers(int id);
Task SetMembers(int id, List<AppUser> usersToAdd);
}
}

View file

@ -0,0 +1,11 @@
using System;
using System.Threading.Tasks;
namespace TicketManager.Data
{
public interface IUnitOfWork : IDisposable
{
IProjectRepository Projects { get; }
Task<int> Complete();
}
}

View file

@ -0,0 +1,57 @@
// 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); }
// }
// }

46
Data/ProjectRepository.cs Normal file
View file

@ -0,0 +1,46 @@
using System.Threading.Tasks;
using TicketManager.Models;
using System.Linq;
using Microsoft.EntityFrameworkCore;
using System.Collections.Generic;
namespace TicketManager.Data
{
public class ProjectRepository : GenericRepository<Project>, IProjectRepository
{
private readonly IQueryable<Project> _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<Project> Get(int id)
{
return await _query.FirstOrDefaultAsync(p => p.Id == id);
}
public override async Task<IEnumerable<Project>> List()
{
return await _query.ToListAsync();
}
public bool Exists(int id)
{ return _dbSet.Any(e => e.Id == id); }
public async Task<IEnumerable<AppUser>> GetMembers(int id)
{
Project project = await Get(id);
return project.GetMembers();
}
public async Task SetMembers(int id, List<AppUser> usersToAdd)
{
Project project = await Get(id);
project.SetMembers(usersToAdd);
}
}
}

27
Data/UnitOfWork.cs Normal file
View file

@ -0,0 +1,27 @@
using System;
using System.Threading.Tasks;
namespace TicketManager.Data
{
public class UnitOfWork : IUnitOfWork
{
private readonly AppDbContext _context;
public UnitOfWork(AppDbContext context)
{
_context = context;
Projects = new ProjectRepository(_context);
}
public IProjectRepository Projects { get; private set; }
public async Task<int> Complete()
{
return await _context.SaveChangesAsync();
}
public void Dispose()
{
_context.DisposeAsync();
}
}
}

View file

@ -51,15 +51,6 @@ namespace TicketManager.Models
return Assignments.Select(a => a.Project).ToList();
}
// public Project GetProject(int id)
// {
// return Assignments.Single(a => a.Project.Id == id).Project;
// }
// public List<AppUser> GetProjectMembers(int id)
// {
// return GetProject(id).GetMembers();
// }
public List<Ticket> GetTickets()
{
List<Ticket> tickets = new List<Ticket>();

View file

@ -4,7 +4,6 @@ namespace TicketManager.Models
{
public class Assignment
{
// public int Id { get; set; }
public AppUser User { get; set; }
public Guid UserId { get; set; }
public Project Project { get; set; }

View file

@ -26,22 +26,36 @@ namespace TicketManager.Models
[DisplayFormat(DataFormatString = "{0:yyyy-MM-dd}", ApplyFormatInEditMode = true)]
public DateTime PlannedEnding { get; set; }
private decimal _progression;
// private decimal _progression;
[Display(Name = "Progress")]
public decimal Progression
{
get
{
return _progression;
}
private set
{
_progression = Tickets.Count() == 0 ? 0 :
return Tickets.Count() == 0 ? 0 :
(decimal)this.Tickets.
Where(t => t.Status == Status.Done).Count()
/ this.Tickets.Count() * 100;
}
// private set
// {
// _progression =
// }
}
// public decimal Progression
// {
// get
// {
// return _progression;
// }
// private set
// {
// _progression = Tickets.Count() == 0 ? 0 :
// (decimal)this.Tickets.
// Where(t => t.Status == Status.Done).Count()
// / this.Tickets.Count() * 100;
// }
// }
[Display(Name = "Project Status")]
public Status Status { get; set; } = Status.ToDo;
@ -62,11 +76,12 @@ namespace TicketManager.Models
{
return this.Assignments.Select(a => a.User).ToList();
}
public void AddMembers(List<AppUser> usersToAdd)
{
foreach (var user in usersToAdd)
{
Assignment newAssign = new Assignment()
Assignment newAssign = new Assignment
{
Project = this,
ProjectId = this.Id,
@ -74,9 +89,10 @@ namespace TicketManager.Models
UserId = user.Id
};
this.Assignments.Add(newAssign);
// AddLogEntry(this, " joined the project.");
user.Assignments.Add(newAssign);
}
}
public void RemoveMembers(List<AppUser> membersToRemove)
{
this.Assignments.RemoveAll(a => membersToRemove.Contains(a.User));
@ -102,27 +118,15 @@ namespace TicketManager.Models
{
this.AddMembers(projectMembers);
}
}
public int GetMembersCount() => this.GetMembers().Count();
public void GetTicketsCount() => this.Tickets.Count();
// public int GetMembersCount() => this.GetMembers().Count();
// public void GetTicketsCount() => this.Tickets.Count();
public void GetTicketsUpdates()
{ throw new NotImplementedException("Not Implemented"); }
public void Close()
{
this.Status = Status.Done;
}
// private void AddLogEntry(string description)//, User user)
// {
// History Edit = new History()
// {
// Description = description,
// ActivityType = ActivityType.Undefined,
// // User = user,
// UpdateDate = DateTime.Now
// };
// this.Edits.Add(Edit);
// }
}
}

View file

@ -30,12 +30,12 @@ namespace TicketManager.Models
public Category Category { get; set; } = Category.Undefined;
[Display(Name = "Created By")]
public AppUser Creator { get; set; }
// public AppUser Creator { get; set; }
public Guid CreatorId { get; set; }
[Display(Name = "Project")]
public Project Project { get; set; }
public int ProjectId { get; set; }
// public int ProjectId { get; set; }
public List<Note> Notes = new List<Note>();
public List<History> Edits = new List<History>();

View file

@ -37,8 +37,11 @@
- Annotate API request in controllers
- Annotate Properties in Models
- Write backend tests
- Have a Look at typeahead component
- Ensure Tickets Edits belong to Project Edits
- Ensure Tickets Files belong to Project Files
- Write a query class to refactor code and optimize perf on get queries (AsNoTracking)
- Async model methods ?
- setMembers & removeMembers from project api not working
- Write a query class to refactor code and optimize perf on get queries (AsNoTracking)
- repository + strategy to decouple controllers from DbContext. Easier testing
- update assignments automatically from context

5
Scripts/cleanDevDb.sh Executable file
View file

@ -0,0 +1,5 @@
rm -r Migrations
rm app.db
dotnet ef migrations add Migration1
dotnet ef database update
dotnet run

6
Scripts/scaffoldControllers.sh Executable file
View file

@ -0,0 +1,6 @@
rm Controllers/AppUsersController.cs
rm Controllers/TicketsController.cs
rm Controllers/ProjectsController.cs
dotnet aspnet-codegenerator controller -name AppUsersController -async -api -m AppUser -dc AppDbContext -outDir Controllers
dotnet aspnet-codegenerator controller -name TicketsController -async -api -m Ticket -dc AppDbContext -outDir Controllers
dotnet aspnet-codegenerator controller -name ProjectsController -async -api -m Project -dc AppDbContext -outDir Controllers

View file

@ -37,6 +37,7 @@ namespace TicketManager
{
services.AddDbContext<AppDbContext>(options =>
options.UseSqlite(Configuration.GetConnectionString("Sqlite")));
services.AddScoped<IProjectRepository, ProjectRepository>();
services.AddControllers()
.AddNewtonsoftJson(options =>
{
@ -72,11 +73,14 @@ namespace TicketManager
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IServiceProvider serviceProvider)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
var repository = serviceProvider.GetRequiredService<IProjectRepository>();
// InitializeDatabaseAsync(repository).Wait()
}
else
{

View file

@ -0,0 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="../../TicketManager.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
<PackageReference Include="Moq" Version="4.13.1" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" />
<PackageReference Include="coverlet.collector" Version="1.0.1" />
</ItemGroup>
</Project>

View file

@ -0,0 +1,83 @@
using Xunit;
using TicketManager.Models;
namespace TicketManager.Tests
{
public class AppUserModelTests
{
[Fact]
public void GetProjects_Returns3Projects()
{
AppUser user = new AppUser();
Project p1 = new Project();
Project p2 = new Project();
Project p3 = new Project();
Assignment a1 = new Assignment()
{
User = user,
Project = p1
};
user.Assignments.Add(a1);
Assignment a2 = new Assignment()
{
User = user,
Project = p2
};
user.Assignments.Add(a2);
Assignment a3 = new Assignment()
{
User = user,
Project = p3
};
user.Assignments.Add(a3);
var res = user.GetProjects().Count;
Assert.Equal(3, res);
}
[Fact]
public void GetTickets_Returns6Tickets()
{
AppUser user = new AppUser();
Project p1 = new Project();
Project p2 = new Project();
Project p3 = new Project();
Ticket t1 = new Ticket();
Ticket t2 = new Ticket();
Ticket t3 = new Ticket();
Ticket t4 = new Ticket();
Ticket t5 = new Ticket();
Ticket t6 = new Ticket();
Assignment a1 = new Assignment()
{
User = user,
Project = p1
};
user.Assignments.Add(a1);
Assignment a2 = new Assignment()
{
User = user,
Project = p2
};
user.Assignments.Add(a2);
Assignment a3 = new Assignment()
{
User = user,
Project = p3
};
user.Assignments.Add(a3);
p1.Tickets.Add(t1);
p2.Tickets.Add(t2);
p2.Tickets.Add(t3);
p3.Tickets.Add(t4);
p3.Tickets.Add(t5);
p3.Tickets.Add(t6);
var res = user.GetTickets().Count;
Assert.Equal(6, res);
}
}
}

View file

@ -0,0 +1,32 @@
using System;
using Xunit;
using System.Collections.Generic;
using TicketManager.Controllers;
using TicketManager.Data;
using TicketManager.Models;
namespace TicketManager.Tests
{
public class ProjectsControllerTests
{
public ProjectsControllerTests()
{
// _context = context;
}
// [Fact]
// public void Get_ReturnsProjectList()
// {
// // Arange
// // var controller = new ProjectsController();
// // Act
// // var result = controller.GetProjects();
// // Assert
// // Assert.IsType<IEnumerable<Project>>(result);
// }
}
}

View file

@ -0,0 +1,115 @@
using System.Linq;
using Xunit;
using System.Collections.Generic;
using TicketManager.Models;
namespace TicketManager.Tests
{
public class ProjectModelTests
{
[Fact]
public void InitProgressIsSetTo0()
{
Project project = new Project();
Assert.Equal(0, project.Progression);
}
[Fact]
public void Progress_Returns50()
{
Project project = new Project();
Ticket t1 = new Ticket() { Status = Status.Done };
Ticket t2 = new Ticket();
project.Tickets.Add(t1);
project.Tickets.Add(t2);
Assert.Equal(50, project.Progression);
}
[Fact]
public void GetMembers_Returns2Assignments()
{
Project project = new Project();
AppUser u1 = new AppUser();
AppUser u2 = new AppUser();
Assignment a1 = new Assignment()
{
User = u1,
Project = project
};
Assignment a2 = new Assignment()
{
User = u2,
Project = project
};
project.Assignments.Add(a1);
project.Assignments.Add(a2);
var res = project.GetMembers().Count();
Assert.Equal(2, res);
}
[Fact]
public void AddMembers_Add3Assignments()
{
Project project = new Project();
AppUser u1 = new AppUser();
AppUser u2 = new AppUser();
AppUser u3 = new AppUser();
project.AddMembers(new List<AppUser> { u1, u2, u3 });
var res = project.GetMembers().Count();
Assert.Equal(3, res);
}
[Fact]
public void RemoveMembers_Delete1Assignment()
{
Project project = new Project();
AppUser u1 = new AppUser();
AppUser u2 = new AppUser();
AppUser u3 = new AppUser();
project.AddMembers(new List<AppUser> { u1, u2, u3 });
project.RemoveMembers(new List<AppUser> { u2 });
var res = project.GetMembers().Count();
Assert.Equal(2, res);
}
[Fact]
public void SetMembers_Add3Assignments()
{
Project project = new Project();
AppUser u1 = new AppUser();
AppUser u2 = new AppUser();
AppUser u3 = new AppUser();
project.SetMembers(new List<AppUser> { u1, u2, u3 });
var res = project.GetMembers().Count();
Assert.Equal(3, res);
}
[Fact]
public void SetMembers_Delete2Assignment()
{
Project project = new Project();
AppUser u1 = new AppUser();
AppUser u2 = new AppUser();
AppUser u3 = new AppUser();
project.SetMembers(new List<AppUser> { u1, u2, u3 });
project.SetMembers(new List<AppUser> { u2 });
var res = project.GetMembers().Count();
Assert.Equal(1, res);
}
[Fact]
public void CloseProject_IsClosed()
{
Project project = new Project() { Status = Status.InProgress };
project.Close();
Assert.Equal(Status.Done, project.Status);
}
}
}

View file

@ -0,0 +1,36 @@
using Xunit;
using TicketManager.Models;
namespace TicketManager.Tests
{
public class TicketModelTests
{
[Fact]
public void GetAssignees_Returns2()
{
Project project = new Project();
Ticket ticket = new Ticket() { Project = project };
AppUser user = new AppUser();
AppUser user1 = new AppUser();
Assignment assignment = new Assignment()
{
User = user,
Project = project
};
project.Assignments.Add(assignment);
user.Assignments.Add(assignment);
Assignment assignment1 = new Assignment()
{
User = user1,
Project = project
};
project.Assignments.Add(assignment);
user.Assignments.Add(assignment);
Assert.Equal(2, ticket.GetAssignees().Count);
}
}
}

View file

@ -30,6 +30,7 @@
<PackageReference Include="Microsoft.OpenApi" Version="1.1.4" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.0.0" />
<PackageReference Include="Swashbuckle.AspNetCore.Newtonsoft" Version="5.0.0" />
<PackageReference Include="Xunit" Version="2.4.1" />
</ItemGroup>
<ItemGroup>
<Folder Include="client\" />

17
TicketManager.sln Normal file
View file

@ -0,0 +1,17 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TicketManager", "TicketManager.csproj", "{45950CBF-5519-440D-AD30-35816EA6E48F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{45950CBF-5519-440D-AD30-35816EA6E48F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{45950CBF-5519-440D-AD30-35816EA6E48F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{45950CBF-5519-440D-AD30-35816EA6E48F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{45950CBF-5519-440D-AD30-35816EA6E48F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal

2
client/.gitignore vendored
View file

@ -1,5 +1,7 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
react-app-env.d.ts
# dependencies
/node_modules
/.pnp

View file

@ -1,68 +0,0 @@
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
## Available Scripts
In the project directory, you can run:
### `npm start`
Runs the app in the development mode.<br />
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
The page will reload if you make edits.<br />
You will also see any lint errors in the console.
### `npm test`
Launches the test runner in the interactive watch mode.<br />
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
### `npm run build`
Builds the app for production to the `build` folder.<br />
It correctly bundles React in production mode and optimizes the build for the best performance.
The build is minified and the filenames include the hashes.<br />
Your app is ready to be deployed!
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
### `npm run eject`
**Note: this is a one-way operation. Once you `eject`, you cant go back!**
If you arent satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
Instead, it will copy all the configuration files and the transitive dependencies (Webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point youre on your own.
You dont have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldnt feel obligated to use this feature. However we understand that this tool wouldnt be useful if you couldnt customize it when you are ready for it.
## Learn More
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
To learn React, check out the [React documentation](https://reactjs.org/).
### Code Splitting
This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting
### Analyzing the Bundle Size
This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size
### Making a Progressive Web App
This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app
### Advanced Configuration
This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration
### Deployment
This section has moved here: https://facebook.github.io/create-react-app/docs/deployment
### `npm run build` fails to minify
This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify

766
client/package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -6,9 +6,17 @@
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.4.0",
"@testing-library/user-event": "^7.2.1",
"@types/jest": "^24.9.1",
"@types/node": "^12.12.26",
"@types/react": "^16.9.19",
"@types/react-dom": "^16.9.5",
"@types/react-router-dom": "^5.1.3",
"history": "^4.10.1",
"react": "^16.12.0",
"react-dom": "^16.12.0",
"react-scripts": "3.3.1"
"react-router-dom": "^5.1.2",
"react-scripts": "3.3.1",
"typescript": "^3.7.5"
},
"scripts": {
"start": "react-scripts start",

View file

@ -6,38 +6,30 @@
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
name="description"
name="Ticket Manager App"
content="Web site created using create-react-app"
/>
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>React App</title>
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css"
/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>
<link
rel="stylesheet"
href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap"
/>
<link
rel="stylesheet"
href="https://fonts.googleapis.com/icon?family=Material+Icons"
/>
<title>Ticket Manager App</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body>
</html>

View file

@ -1,3 +1,2 @@
# https://www.robotstxt.org/robotstxt.html
User-agent: *
Disallow:

View file

@ -1,38 +1,42 @@
.App {
text-align: center;
.panel {
padding-left: 0px;
padding-top: 10px;
}
.App-logo {
height: 40vmin;
pointer-events: none;
.field {
padding-left: 10px;
padding-right: 10px;
}
@media (prefers-reduced-motion: no-preference) {
.App-logo {
animation: App-logo-spin infinite 20s linear;
}
}
.App-header {
background-color: #282c34;
min-height: 100vh;
.city {
display: flex;
background: linear-gradient(
90deg,
rgba(2, 0, 36, 1) 0%,
rgba(25, 112, 245, 0.6399510487788865) 0%,
rgba(0, 212, 255, 1) 100%
);
flex-direction: column;
align-items: center;
height: 40vh;
justify-content: center;
font-size: calc(10px + 2vmin);
color: white;
align-items: center;
padding: 0px 20px 20px 20px;
margin: 0px 0px 50px 0px;
border: 1px solid;
border-radius: 5px;
box-shadow: 2px 2px #888888;
font-family: "Merriweather", serif;
}
.App-link {
color: #61dafb;
.city h1 {
line-height: 1.2;
}
@keyframes App-logo-spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
.city span {
padding-left: 20px;
}
.city .row {
padding-top: 20px;
}
.weatherError {
color: #f16051;
font-size: 20px;
letter-spacing: 1px;
font-weight: 200;
}

View file

@ -1,26 +0,0 @@
import React from 'react';
import logo from './logo.svg';
import './App.css';
function App() {
return (
<div className="App">
<header className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<p>
Edit <code>src/App.js</code> and save to reload.
</p>
<a
className="App-link"
href="https://reactjs.org"
target="_blank"
rel="noopener noreferrer"
>
Learn React
</a>
</header>
</div>
);
}
export default App;

10
client/src/App.tsx Normal file
View file

@ -0,0 +1,10 @@
import React, { FC } from "react";
import { AppRouter } from "./utils/router";
import "./App.css";
import Layout from "./pages/Layout";
const App: FC = () => {
return <Layout />;
};
export default App;

View file

@ -0,0 +1,16 @@
import React, { FC } from "react";
import { FloatingButton } from "./FloatingButton";
interface AvatarListProps {
avatars: string[];
}
export const AvatarList: FC<AvatarListProps> = ({ avatars }) => {
return (
<>
{avatars.map((avatar: string) => (
<img className="circle" src={avatar} width="32vh" height="32vh" />
))}
</>
);
};

View file

@ -0,0 +1,25 @@
import React, { FC, Children } from "react";
interface IProps {
icon?: string;
size?: string;
shape?: string;
color?: string;
text?: string;
}
export const Button: FC<IProps> = ({
size = "small",
shape = "",
color,
text,
children
}) => {
return (
<button
className={`waves-effect waves-light btn-${size} ${shape} ${color}`}
>
{children}
</button>
);
};

View file

@ -0,0 +1,21 @@
import React, { FC } from "react";
import { Button } from "./Button";
interface IProps {
icon?: string;
size?: string;
color?: string;
}
export const FloatingButton: FC<IProps> = ({
icon = "add",
size = "small",
color = "red"
}) => {
const iconComponent = <i className="material-icons left">{icon}</i>;
return (
<Button color={color} size={size} shape="btn-floating">
{iconComponent}
</Button>
);
};

View file

@ -0,0 +1,15 @@
import React, { FC } from "react";
type HeaderProps = {
title: string;
description: string;
};
export const Header: FC<HeaderProps> = ({ title, description }) => {
return (
<>
<h1>{title}</h1>
<p className="lead">{description}</p>
</>
);
};

View file

@ -0,0 +1,58 @@
import React, { FC, MouseEvent } from "react";
import { AvatarList } from "./AvatarList";
interface IProps {
title: string;
tasksTotalCount?: number;
tasksDone?: number;
remainingDays?: number;
avatars: string[];
validateTicket: (event: MouseEvent) => void;
archiveTicket: (event: MouseEvent) => void;
}
export const HorizontalCard: FC<IProps> = ({
title,
tasksDone,
tasksTotalCount,
remainingDays,
avatars,
archiveTicket,
validateTicket
}) => {
return (
<div className="col s12">
<div className="card horizontal">
<div className="card-stacked">
<div className="card-content">
<div className="row">
<div className="card-title">
<h6>{title}</h6>
</div>
<span>Due {remainingDays} days</span>
{/* <AvatarList avatars={avatars} /> */}
<div className="right">
{/* <i className=" material-icons">playlist_add_check</i>
<span>
{" "}
{tasksDone}/{tasksTotalCount}
</span> */}
<a>
<i className="material-icons" onClick={validateTicket}>
check
</i>
</a>
<a>
<i className="material-icons" onClick={archiveTicket}>
archive
</i>
</a>
</div>
</div>
</div>
</div>
</div>
</div>
);
};

View file

@ -0,0 +1,37 @@
import React, { FC, HTMLAttributes, CSSProperties } from "react";
type ProgressBarProps = {
value: number;
max?: number;
tasksTotalCount?: number;
tasksDone?: number;
remainingDays?: number;
};
export const ProgressBar: FC<ProgressBarProps> = ({
value,
max = 100,
tasksDone,
tasksTotalCount,
remainingDays
}) => {
const styleString: CSSProperties = { width: `${value}%` };
return (
<>
<div className="row">
<div className="progress">
<div className="determinate" style={styleString}></div>
</div>
<div>
<i className="left material-icons">playlist_add_check</i>
<span>
{tasksDone}/{tasksTotalCount}
</span>
<div className="right">
<span>Due {remainingDays} days</span>
</div>
</div>
</div>
</>
);
};

View file

@ -0,0 +1,52 @@
import React, { FC } from "react";
import { TabRouterHeader } from "./TabRouterHeader";
import { TicketList } from "./TicketList";
import { Ticket } from "../types/Ticket";
import { Switch, Route, useRouteMatch, Redirect } from "react-router-dom";
interface IProps {
tickets: Ticket[];
tasksTotalCount?: number;
tasksDone?: number;
remainingDays?: number;
avatars: string[];
}
export const TabRouter: FC<IProps> = ({
tickets,
tasksDone,
tasksTotalCount,
remainingDays,
avatars
}) => {
const { url } = useRouteMatch();
return (
<>
<Switch>
<div className="row">
<TabRouterHeader />
<Redirect from={url} to={`${url}/tickets`} />
<Route path={`${url}/tickets`}>
<TicketList
tickets={tickets}
tasksDone={tasksDone}
tasksTotalCount={tasksTotalCount}
remainingDays={remainingDays}
avatars={avatars}
/>
</Route>
<Route path={`${url}/files`}>
{/* <TicketList tickets={tickets} /> */}
</Route>
<Route path={`${url}/activity`}>
{/* <TicketList tickets={tickets} /> */}
</Route>
</div>
</Switch>
</>
);
};

View file

@ -0,0 +1,79 @@
import React, { FC, useState } from "react";
import { Link, useRouteMatch } from "react-router-dom";
interface TabUnitProps {
tabClass: string;
isActive: number;
setIsActive: React.Dispatch<React.SetStateAction<number>>;
text: string;
value: string;
}
const TabUnit: FC<TabUnitProps> = ({
tabClass,
isActive,
setIsActive,
text,
value
}) => {
const { url } = useRouteMatch();
return (
<li className={tabClass} key={value}>
<Link
to={`${url}/${text}`}
id={value}
className={isActive === parseInt(value) ? "active" : ""}
onClick={() => setIsActive(parseInt(value))}
>
{text}
</Link>
</li>
);
};
interface IProps {
tabClass?: string;
}
export const TabRouterHeader: FC<IProps> = ({
tabClass = "tab col s3",
children
}) => {
const [isActive, setIsActive] = useState(1);
// const switchTab = (e: React.MouseEvent<HTMLAnchorElement>): void => {
// e.preventDefault();
// setIsActive(e.target.id);
// };
return (
<>
<div className="row col s12">
<ul className="tabs">
<TabUnit
text="Tickets"
value="1"
tabClass={tabClass}
isActive={isActive}
setIsActive={setIsActive}
/>
<TabUnit
text="Files"
value="2"
tabClass={tabClass}
isActive={isActive}
setIsActive={setIsActive}
/>
<TabUnit
text="Activity"
value="3"
tabClass={tabClass}
isActive={isActive}
setIsActive={setIsActive}
/>
</ul>
</div>
</>
);
};

View file

@ -0,0 +1,52 @@
import React, { FC } from "react";
import { Ticket } from "../types/Ticket";
import { FloatingButton } from "./FloatingButton";
import { HorizontalCard } from "./HorizontalCard";
type TicketListProps = {
tickets: Ticket[];
tasksTotalCount?: number;
tasksDone?: number;
remainingDays?: number;
avatars: string[];
};
export const TicketList: FC<TicketListProps> = ({
tickets,
tasksDone,
tasksTotalCount,
remainingDays,
avatars
}) => {
const archiveTicket = () => {};
const validateTicket = () => {};
return (
<div className="col s12">
<div className="row valign-wrapper">
<div className="col s6 m4">
<h2>Tickets</h2>
</div>
<div className="col s6 m8">
<FloatingButton color="grey" size="big" />
</div>
</div>
<ul>
{tickets.map((t: Ticket) => (
<li key={t.id}>
<HorizontalCard
title={t.title}
tasksDone={tasksDone}
tasksTotalCount={tasksTotalCount}
remainingDays={remainingDays}
avatars={avatars}
validateTicket={validateTicket}
archiveTicket={archiveTicket}
/>
</li>
))}
</ul>
</div>
);
};

View file

@ -0,0 +1,6 @@
import React, { FC } from "react";
import { HomePage } from "../pages/HomePage";
export const HomeController: FC = () => {
return <HomePage />;
};

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,6 @@
import React, { FC } from "react";
import { TicketPage } from "../pages/TicketPage";
export const TicketController: FC = () => {
return <TicketPage />;
};

View file

@ -0,0 +1,6 @@
import React, { FC } from "react";
import { UserPage } from "../pages/UserPage";
export const UserController: FC = () => {
return <UserPage />;
};

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1,005 KiB

View file

@ -1,12 +0,0 @@
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import * as serviceWorker from './serviceWorker';
ReactDOM.render(<App />, document.getElementById('root'));
// If you want your app to work offline and load faster, you can change
// unregister() to register() below. Note this comes with some pitfalls.
// Learn more about service workers: https://bit.ly/CRA-PWA
serviceWorker.unregister();

9
client/src/index.tsx Normal file
View file

@ -0,0 +1,9 @@
import React from "react";
import ReactDOM from "react-dom";
import "./index.css";
import App from "./App";
import * as serviceWorker from "./serviceWorker";
ReactDOM.render(<App />, document.getElementById("root"));
serviceWorker.unregister();

View file

@ -1,7 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 841.9 595.3">
<g fill="#61DAFB">
<path d="M666.3 296.5c0-32.5-40.7-63.3-103.1-82.4 14.4-63.6 8-114.2-20.2-130.4-6.5-3.8-14.1-5.6-22.4-5.6v22.3c4.6 0 8.3.9 11.4 2.6 13.6 7.8 19.5 37.5 14.9 75.7-1.1 9.4-2.9 19.3-5.1 29.4-19.6-4.8-41-8.5-63.5-10.9-13.5-18.5-27.5-35.3-41.6-50 32.6-30.3 63.2-46.9 84-46.9V78c-27.5 0-63.5 19.6-99.9 53.6-36.4-33.8-72.4-53.2-99.9-53.2v22.3c20.7 0 51.4 16.5 84 46.6-14 14.7-28 31.4-41.3 49.9-22.6 2.4-44 6.1-63.6 11-2.3-10-4-19.7-5.2-29-4.7-38.2 1.1-67.9 14.6-75.8 3-1.8 6.9-2.6 11.5-2.6V78.5c-8.4 0-16 1.8-22.6 5.6-28.1 16.2-34.4 66.7-19.9 130.1-62.2 19.2-102.7 49.9-102.7 82.3 0 32.5 40.7 63.3 103.1 82.4-14.4 63.6-8 114.2 20.2 130.4 6.5 3.8 14.1 5.6 22.5 5.6 27.5 0 63.5-19.6 99.9-53.6 36.4 33.8 72.4 53.2 99.9 53.2 8.4 0 16-1.8 22.6-5.6 28.1-16.2 34.4-66.7 19.9-130.1 62-19.1 102.5-49.9 102.5-82.3zm-130.2-66.7c-3.7 12.9-8.3 26.2-13.5 39.5-4.1-8-8.4-16-13.1-24-4.6-8-9.5-15.8-14.4-23.4 14.2 2.1 27.9 4.7 41 7.9zm-45.8 106.5c-7.8 13.5-15.8 26.3-24.1 38.2-14.9 1.3-30 2-45.2 2-15.1 0-30.2-.7-45-1.9-8.3-11.9-16.4-24.6-24.2-38-7.6-13.1-14.5-26.4-20.8-39.8 6.2-13.4 13.2-26.8 20.7-39.9 7.8-13.5 15.8-26.3 24.1-38.2 14.9-1.3 30-2 45.2-2 15.1 0 30.2.7 45 1.9 8.3 11.9 16.4 24.6 24.2 38 7.6 13.1 14.5 26.4 20.8 39.8-6.3 13.4-13.2 26.8-20.7 39.9zm32.3-13c5.4 13.4 10 26.8 13.8 39.8-13.1 3.2-26.9 5.9-41.2 8 4.9-7.7 9.8-15.6 14.4-23.7 4.6-8 8.9-16.1 13-24.1zM421.2 430c-9.3-9.6-18.6-20.3-27.8-32 9 .4 18.2.7 27.5.7 9.4 0 18.7-.2 27.8-.7-9 11.7-18.3 22.4-27.5 32zm-74.4-58.9c-14.2-2.1-27.9-4.7-41-7.9 3.7-12.9 8.3-26.2 13.5-39.5 4.1 8 8.4 16 13.1 24 4.7 8 9.5 15.8 14.4 23.4zM420.7 163c9.3 9.6 18.6 20.3 27.8 32-9-.4-18.2-.7-27.5-.7-9.4 0-18.7.2-27.8.7 9-11.7 18.3-22.4 27.5-32zm-74 58.9c-4.9 7.7-9.8 15.6-14.4 23.7-4.6 8-8.9 16-13 24-5.4-13.4-10-26.8-13.8-39.8 13.1-3.1 26.9-5.8 41.2-7.9zm-90.5 125.2c-35.4-15.1-58.3-34.9-58.3-50.6 0-15.7 22.9-35.6 58.3-50.6 8.6-3.7 18-7 27.7-10.1 5.7 19.6 13.2 40 22.5 60.9-9.2 20.8-16.6 41.1-22.2 60.6-9.9-3.1-19.3-6.5-28-10.2zM310 490c-13.6-7.8-19.5-37.5-14.9-75.7 1.1-9.4 2.9-19.3 5.1-29.4 19.6 4.8 41 8.5 63.5 10.9 13.5 18.5 27.5 35.3 41.6 50-32.6 30.3-63.2 46.9-84 46.9-4.5-.1-8.3-1-11.3-2.7zm237.2-76.2c4.7 38.2-1.1 67.9-14.6 75.8-3 1.8-6.9 2.6-11.5 2.6-20.7 0-51.4-16.5-84-46.6 14-14.7 28-31.4 41.3-49.9 22.6-2.4 44-6.1 63.6-11 2.3 10.1 4.1 19.8 5.2 29.1zm38.5-66.7c-8.6 3.7-18 7-27.7 10.1-5.7-19.6-13.2-40-22.5-60.9 9.2-20.8 16.6-41.1 22.2-60.6 9.9 3.1 19.3 6.5 28.1 10.2 35.4 15.1 58.3 34.9 58.3 50.6-.1 15.7-23 35.6-58.4 50.6zM320.8 78.4z"/>
<circle cx="420.9" cy="296.5" r="45.7"/>
<path d="M520.5 78.1z"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 2.6 KiB

View file

@ -0,0 +1,9 @@
import React from "react";
export const HomePage: React.FC = () => {
return (
<div className="App">
<p>HomePage</p>
</div>
);
};

View file

@ -0,0 +1,15 @@
import React, { FC } from "react";
import { AppRouter } from "../utils/router";
const Layout: FC = () => {
return (
<>
{/* <NavBar />
<BreadCrumb /> */}
<AppRouter />
{/* <Footer /> */}
</>
);
};
export default Layout;

View file

@ -0,0 +1,47 @@
import React, { FC } from "react";
import { Header } from "../components/Header";
import { AvatarList } from "../components/AvatarList";
import { ProgressBar } from "../components/ProgressBar";
import ProjectVM from "../viewModels/ProjectVM";
import { TabRouter } from "../components/TabRouter";
import { FloatingButton } from "../components/FloatingButton";
interface IProps {
viewModel: ProjectVM;
}
export const ProjectPage: FC<IProps> = ({ viewModel }) => {
const {
title,
description,
avatars,
value,
tickets,
ticketsDone,
ticketsTotalCount,
remainingDays
} = viewModel;
return (
<div className="section">
<div className="container">
<Header title={title} description={description} />
<div className="row valign-wrapper">
<AvatarList avatars={avatars} />
<FloatingButton icon="add" color="grey" size="small" />
</div>
<ProgressBar
value={value}
tasksDone={ticketsDone}
tasksTotalCount={ticketsTotalCount}
remainingDays={remainingDays}
/>
<TabRouter
tickets={tickets}
tasksDone={ticketsDone}
tasksTotalCount={ticketsTotalCount}
remainingDays={remainingDays}
avatars={avatars}
/>
</div>
</div>
);
};

View file

@ -0,0 +1,23 @@
import React, { FC } from "react";
import { Header } from "../components/Header";
import { AvatarList } from "../components/AvatarList";
import { ProgressBar } from "../components/ProgressBar";
export const TicketPage: FC = () => {
return (
<>
<Header
description="Research, ideate and present brand concepts for client consideration"
title="Brand Concept and Design"
/>
<AvatarList avatars={["../images/user_1.jpg", "../images/user_2.jpg"]} />
<ProgressBar value={60} />
{/* // <TabView>
// <ChildTicket/>
// <ChildFile/>
// <ChildActivity/>
// </TabView>
// <Notes/> */}
</>
);
};

View file

@ -0,0 +1,12 @@
import React, { FC } from "react";
import { Header } from "../components/Header";
export const UserPage: FC = () => {
return (
<Header title = "Brand Concept and Design" description = "Research, ideate and present brand concepts for client consideration"/>
// <TabView>
// <CardList>
// <CardList>
// </TabView>
);
};

View file

@ -20,10 +20,18 @@ const isLocalhost = Boolean(
)
);
export function register(config) {
type Config = {
onSuccess?: (registration: ServiceWorkerRegistration) => void;
onUpdate?: (registration: ServiceWorkerRegistration) => void;
};
export function register(config?: Config) {
if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {
// The URL constructor is available in all browsers that support SW.
const publicUrl = new URL(process.env.PUBLIC_URL, window.location.href);
const publicUrl = new URL(
process.env.PUBLIC_URL,
window.location.href
);
if (publicUrl.origin !== window.location.origin) {
// Our service worker won't work if PUBLIC_URL is on a different origin
// from what our page is served on. This might happen if a CDN is used to
@ -54,7 +62,7 @@ export function register(config) {
}
}
function registerValidSW(swUrl, config) {
function registerValidSW(swUrl: string, config?: Config) {
navigator.serviceWorker
.register(swUrl)
.then(registration => {
@ -98,7 +106,7 @@ function registerValidSW(swUrl, config) {
});
}
function checkValidServiceWorker(swUrl, config) {
function checkValidServiceWorker(swUrl: string, config?: Config) {
// Check if the service worker can be found. If it can't reload the page.
fetch(swUrl, {
headers: { 'Service-Worker': 'script' }

3
client/src/types/File.ts Normal file
View file

@ -0,0 +1,3 @@
export interface File {
Id: number;
}

View file

@ -0,0 +1,3 @@
export interface History {
Id: number;
}

3
client/src/types/Note.ts Normal file
View file

@ -0,0 +1,3 @@
export interface Note {
Id: number;
}

View file

@ -0,0 +1,12 @@
import { Ticket } from "./Ticket";
import { User } from "./User";
export interface Project {
id: number;
title: string;
description: string;
progression: number;
tickets: Ticket[];
users: User[];
plannedEnding: string;
}

View file

@ -0,0 +1,5 @@
export interface Ticket {
id: number;
title: string;
status: string;
}

4
client/src/types/User.ts Normal file
View file

@ -0,0 +1,4 @@
export interface User {
id: string;
picture: string;
}

View file

@ -0,0 +1,3 @@
export class Constants {
static getProjectURI: string = "/api/projects";
}

View file

@ -0,0 +1,33 @@
import React from "react";
import { Router, Route, Switch, Link, NavLink } from "react-router-dom";
import * as creacteHistory from "history";
import { TicketPage } from "../pages/TicketPage";
import { HomeController } from "../controllers/HomeController";
import { ProjectController } from "../controllers/ProjectController";
import { UserController } from "../controllers/UserController";
import { TicketController } from "../controllers/TicketController";
export const history = creacteHistory.createBrowserHistory();
export const AppRouter = () => {
return (
<Router history={history}>
<div>
<Switch>
{/* <Route path="/">
<HomeController />
</Route>
<Route path="/users/:id">
<UserController />
</Route> */}
<Route path="/projects/:id">
<ProjectController />
</Route>
{/* <Route path="/tickets/:id">
<TicketController />
</Route> */}
</Switch>
</div>
</Router>
);
};

View file

@ -0,0 +1,46 @@
import { Ticket } from "../types/Ticket";
import { Project } from "../types/Project";
import { Constants } from "../utils/Constants";
import { User } from "../types/User";
export default class ProjectVM {
public id: number;
public title: string;
public description: string;
public value: number;
public tickets: Ticket[];
public avatars: string[];
public ticketsTotalCount: number;
public ticketsDone: number;
public remainingDays: number;
/**
* getMembers
*/
// public getMembers(): string {
// let res: Promise<Response> = fetch(
// `${Constants.getProjectURI}/${this.id}/members`
// );
// return JSON.stringify(res);
// // res.json();
// }
public constructor(project: Project) {
this.id = project.id;
this.title = project.title;
this.description = project.description;
this.avatars = project.users.map(u => u.picture);
this.value = project.progression;
this.tickets = project.tickets;
this.ticketsTotalCount = this.tickets.length;
this.ticketsDone = this.tickets.filter(t => t.status === "Done").length;
let endingDate: Date = new Date(project.plannedEnding);
let today: Date = new Date();
let plannedEnding: number = Math.abs(
endingDate.getDate() - today.getDate()
);
this.remainingDays = plannedEnding;
}
}

View file

@ -0,0 +1,5 @@
export class TicketVM {
public Id?: number;
public constructor() {}
}

View file

@ -0,0 +1,5 @@
export class UserVM {
public Id?: number;
public constructor() {}
}

25
client/tsconfig.json Normal file
View file

@ -0,0 +1,25 @@
{
"compilerOptions": {
"target": "es5",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react"
},
"include": [
"src"
]
}