Migrate Show.Date from DateOnly to DateTime to support time of day
Removes DateOnly/DateTime conversion boilerplate from all Show endpoints and adds the corresponding EF Core migration. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -20,7 +20,7 @@ public class CreateShowEndpoint(PyroFetesDbContext pyroFetesDbContext) : Endpoin
|
||||
Place = req.Place ?? string.Empty,
|
||||
Description = req.Description,
|
||||
PyrotechnicImplementationPlan = req.PyrotechnicImplementationPlan ?? string.Empty,
|
||||
Date = req.Date.HasValue ? DateOnly.FromDateTime(req.Date.Value) : null,
|
||||
Date = req.Date,
|
||||
CityId = req.CityId
|
||||
};
|
||||
|
||||
@@ -34,7 +34,7 @@ public class CreateShowEndpoint(PyroFetesDbContext pyroFetesDbContext) : Endpoin
|
||||
Place = show.Place,
|
||||
Description = show.Description,
|
||||
PyrotechnicImplementationPlan = show.PyrotechnicImplementationPlan,
|
||||
Date = show.Date.HasValue ? show.Date.Value.ToDateTime(TimeOnly.MinValue) : null,
|
||||
Date = show.Date,
|
||||
CityId = show.CityId
|
||||
};
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ public class GetAllShowsEndpoint(PyroFetesDbContext pyroFetesDbContext) : Endpoi
|
||||
Place = s.Place,
|
||||
Description = s.Description,
|
||||
PyrotechnicImplementationPlan = s.PyrotechnicImplementationPlan,
|
||||
Date = s.Date.HasValue ? s.Date.Value.ToDateTime(TimeOnly.MinValue) : null,
|
||||
Date = s.Date,
|
||||
CityId = s.CityId
|
||||
})
|
||||
.ToListAsync(ct);
|
||||
|
||||
@@ -30,7 +30,7 @@ public class GetShowEndpoint(PyroFetesDbContext pyroFetesDbContext) : Endpoint<I
|
||||
Place = s.Place,
|
||||
Description = s.Description,
|
||||
PyrotechnicImplementationPlan = s.PyrotechnicImplementationPlan,
|
||||
Date = s.Date.HasValue ? s.Date.Value.ToDateTime(TimeOnly.MinValue) : null,
|
||||
Date = s.Date,
|
||||
CityId = s.CityId
|
||||
})
|
||||
.FirstOrDefaultAsync(ct);
|
||||
|
||||
@@ -35,7 +35,7 @@ public class UpdateShowEndpoint(PyroFetesDbContext pyroFetesDbContext) : Endpoin
|
||||
show.Description = req.Description ?? show.Description;
|
||||
show.PyrotechnicImplementationPlan = req.PyrotechnicImplementationPlan ?? show.PyrotechnicImplementationPlan;
|
||||
if (req.CityId.HasValue) show.CityId = req.CityId.Value;
|
||||
if (req.Date.HasValue) show.Date = DateOnly.FromDateTime(req.Date.Value);
|
||||
if (req.Date.HasValue) show.Date = req.Date.Value;
|
||||
|
||||
await pyroFetesDbContext.SaveChangesAsync(ct);
|
||||
|
||||
@@ -46,7 +46,7 @@ public class UpdateShowEndpoint(PyroFetesDbContext pyroFetesDbContext) : Endpoin
|
||||
Place = show.Place,
|
||||
Description = show.Description,
|
||||
PyrotechnicImplementationPlan = show.PyrotechnicImplementationPlan,
|
||||
Date = show.Date.HasValue ? show.Date.Value.ToDateTime(TimeOnly.MinValue) : null,
|
||||
Date = show.Date,
|
||||
CityId = show.CityId
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user