Updated the domain model with entities, repos and domain services. Looks good. I think I addressed all the user stories however if I fell short we'll revise as needed.
This commit was merged in pull request #6.
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
using LibraryApp.Domain.Entities;
|
||||
|
||||
namespace LibraryApp.Domain;
|
||||
|
||||
public class BookCountReport
|
||||
{
|
||||
public ShelfId ShelfId { get; }
|
||||
public DateTime CountedAt { get; }
|
||||
public IReadOnlyList<BookInstance> MissingInstances { get; }
|
||||
public int TotalExpected { get; }
|
||||
public int TotalFound { get; }
|
||||
|
||||
public BookCountReport(
|
||||
ShelfId shelfId,
|
||||
DateTime countedAt,
|
||||
IReadOnlyList<BookInstance> allInstancesOnShelf,
|
||||
IReadOnlyList<BookInstanceBarcode> scannedBarcodes)
|
||||
{
|
||||
ShelfId = shelfId;
|
||||
CountedAt = countedAt;
|
||||
TotalExpected = allInstancesOnShelf.Count;
|
||||
|
||||
var scannedSet = scannedBarcodes.Select(b => b.Barcode).ToHashSet();
|
||||
MissingInstances = allInstancesOnShelf
|
||||
.Where(i => !scannedSet.Contains(i.Barcode.Barcode))
|
||||
.ToList();
|
||||
|
||||
TotalFound = TotalExpected - MissingInstances.Count;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user