diff --git a/.gitignore b/.gitignore index 7b61263..84b0e90 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,5 @@ obj/ .vscode/ Migrations/ app.db -client/node_modules \ No newline at end of file +client/node_modules +Scripts/ \ No newline at end of file diff --git a/Controllers/ProjectsController.cs b/Controllers/ProjectsController.cs index 5f671c1..a596542 100644 --- a/Controllers/ProjectsController.cs +++ b/Controllers/ProjectsController.cs @@ -8,6 +8,7 @@ using Microsoft.EntityFrameworkCore; using TicketManager.Data; using TicketManager.Models; + namespace TicketManager.Controllers { [Route("api/[controller]")] diff --git a/Models/Ticket.cs b/Models/Ticket.cs index 727ca6f..65fc8ae 100644 --- a/Models/Ticket.cs +++ b/Models/Ticket.cs @@ -18,8 +18,8 @@ namespace TicketManager.Models public User Creator { get; set; } public Guid CreatorId { get; set; } - // public Project Project { get; set; } - // public int ProjectId { get; set; } + public Project Project { get; set; } + public int ProjectId { get; set; } private List _notes; public List Notes { diff --git a/Startup.cs b/Startup.cs index 9da91b4..825d07d 100644 --- a/Startup.cs +++ b/Startup.cs @@ -17,6 +17,8 @@ using System.Reflection; using System.IO; using TicketManager.Data; using TicketManager.Models; +using Microsoft.AspNetCore.Mvc.NewtonsoftJson; +using Newtonsoft.Json; namespace TicketManager { @@ -34,7 +36,12 @@ namespace TicketManager { services.AddDbContext(options => options.UseSqlite(Configuration.GetConnectionString("Sqlite"))); - services.AddControllers(); + services.AddControllers() + .AddNewtonsoftJson(options => + { + options.SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore; // avoid cycle ref errors + }); + services.AddSpaStaticFiles(configuration => { configuration.RootPath = "client/build"; diff --git a/TicketManager.csproj b/TicketManager.csproj index ae2c5af..b4ab051 100644 --- a/TicketManager.csproj +++ b/TicketManager.csproj @@ -16,6 +16,7 @@ +