Skip to content

Commit

Permalink
Drawperiod ! (#43)
Browse files Browse the repository at this point in the history
  • Loading branch information
sorensenmarius authored Nov 7, 2023
1 parent acb2d27 commit 8da81ea
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
7 changes: 3 additions & 4 deletions kabinizer-back-end/kabinizer-api/Dtos/Draw/CreateDrawDto.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@

public class CreateDrawDto
{
public DateTime DrawStart { get; set; }
public DateTime DrawEnd { get; set; }
public DateTime DeadlineStart { get; set; }
public DateTime DeadlineEnd { get; set; }
public required string Title { get; set; }
public DateTime PeriodStart { get; set; }
public DateTime PeriodEnd { get; set; }
public required List<DrawPeriod> DrawPeriods { get; set; }
}
7 changes: 7 additions & 0 deletions kabinizer-back-end/kabinizer-api/Dtos/Draw/DrawPeriod.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace kabinizer_api;

public class DrawPeriod
{
public DateTime Start { get; set; }
public DateTime End { get; set; }
}
6 changes: 3 additions & 3 deletions kabinizer-back-end/kabinizer-api/Services/Draw/DrawService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ public void CreateDraw(CreateDrawDto draw)
{
var drawEntity = new DrawEntity
{
Start = draw.DrawStart,
End = draw.DrawEnd,
Start = draw.DeadlineStart,
End = draw.DeadlineEnd,
Title = draw.Title,
Periods = _periodService.CreatePeriods(draw.PeriodStart, draw.PeriodEnd)
Periods = _periodService.CreatePeriods(draw.DrawPeriods)
};
_entityContext.Draws.Add(drawEntity);
_entityContext.SaveChanges();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ namespace kabinizer_api;

public class PeriodService
{
public List<PeriodEntity> CreatePeriods(DateTime start, DateTime end)
public List<PeriodEntity> CreatePeriods(List<DrawPeriod> drawPeriods)
{
// TODO: Compute periods from a larger time span
// Week by week?
Expand Down

0 comments on commit 8da81ea

Please sign in to comment.