JSonIgnore M2M joint

This commit is contained in:
Ruidy Nemausat 2020-02-28 13:42:23 +01:00
parent 1af2d95e7a
commit f15d725a93
3 changed files with 7 additions and 12 deletions

View file

@ -2,7 +2,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.ComponentModel.DataAnnotations;
using TicketManager.DTO;
using System.Text.Json.Serialization;
namespace TicketManager.Models
{
@ -20,11 +20,13 @@ namespace TicketManager.Models
public string Description { get; set; }
[DataType(DataType.Date)]
[DisplayFormat(DataFormatString = "{0:yyyy-MM-dd}", ApplyFormatInEditMode = false)]
[DisplayFormat(DataFormatString = "{0:yyyy-MM-dd}",
ApplyFormatInEditMode = false)]
public DateTime CreationDate { get; private set; } = DateTime.Now;
[DataType(DataType.Date)]
[DisplayFormat(DataFormatString = "{0:yyyy-MM-dd}", ApplyFormatInEditMode = true)]
[DisplayFormat(DataFormatString = "{0:yyyy-MM-dd}",
ApplyFormatInEditMode = true)]
public DateTime EndingDate { get; set; }
[Display(Name = "Progress")]
@ -45,6 +47,7 @@ namespace TicketManager.Models
[Display(Name = "Project Manager")]
public AppUser Manager { get; set; }
[JsonIgnore]
public List<Assignment> Assignments { get; set; } = new List<Assignment>();
public List<Ticket> Tickets { get; set; } = new List<Ticket>();

View file

@ -22,7 +22,6 @@
- `React` client on the front-end (TypeScript)
- [Materialize](https://materializecss.com) CSS librairy for styling
- API: Newtonsoft.Json, to avoid cycle errors
- Hosting: ?
- Authentication : [Auth0](https://auth0.com/)
- Analytics : Google Analytics & Mixpanel
@ -48,5 +47,5 @@
- [ ] error page redirect when offline.
- [ ] ticket/files/activities list placeholders when empty
- [ ] think about public/private DTO's constructor, getters and setters
- [x] write dtos without circular dependencies
- [<span style="color:red">X</span>] write dtos without circular dependencies.
- [ ] use dtoRequest for PutProjects

View file

@ -12,9 +12,7 @@ using Microsoft.Extensions.Logging;
using Microsoft.AspNetCore.SpaServices.ReactDevelopmentServer;
using Microsoft.EntityFrameworkCore;
using Microsoft.OpenApi.Models;
using Microsoft.AspNetCore.Mvc.NewtonsoftJson;
using Microsoft.AspNetCore.Authentication.JwtBearer;
// using Newtonsoft.Json;
using TicketManager.Data;
[assembly: ApiController]
@ -49,11 +47,6 @@ namespace TicketManager
});
services.AddControllers();
// .AddNewtonsoftJson(options =>
// {
// options.SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore; // avoid cycle ref errors
// }
// );
services.AddSpaStaticFiles(configuration =>
{