1- using BookStore . ApiService . Models ;
1+ using System . Collections . Immutable ;
2+ using BookStore . Shared . Models ;
23using Marten ;
34using Microsoft . AspNetCore . Mvc ;
45using Wolverine ;
@@ -9,21 +10,21 @@ public record CreateBookRequest(
910 string Title ,
1011 string ? Isbn ,
1112 string Language ,
12- Dictionary < string , BookTranslationDto > ? Translations ,
13+ IReadOnlyDictionary < string , BookTranslationDto > ? Translations ,
1314 PartialDate ? PublicationDate ,
1415 Guid ? PublisherId ,
15- List < Guid > AuthorIds ,
16- List < Guid > CategoryIds ) ;
16+ IReadOnlyList < Guid > AuthorIds ,
17+ IReadOnlyList < Guid > CategoryIds ) ;
1718
1819 public record UpdateBookRequest (
1920 string Title ,
2021 string ? Isbn ,
2122 string Language ,
22- Dictionary < string , BookTranslationDto > ? Translations ,
23+ IReadOnlyDictionary < string , BookTranslationDto > ? Translations ,
2324 PartialDate ? PublicationDate ,
2425 Guid ? PublisherId ,
25- List < Guid > AuthorIds ,
26- List < Guid > CategoryIds ) ;
26+ IReadOnlyList < Guid > AuthorIds ,
27+ IReadOnlyList < Guid > CategoryIds ) ;
2728}
2829
2930namespace BookStore . ApiService . Endpoints . Admin
@@ -73,8 +74,8 @@ static Task<IResult> CreateBook(
7374 request . Translations ,
7475 request . PublicationDate ,
7576 request . PublisherId ,
76- request . AuthorIds ?? [ ] ,
77- request . CategoryIds ?? [ ] ) ;
77+ request . AuthorIds ?? ImmutableList < Guid > . Empty ,
78+ request . CategoryIds ?? ImmutableList < Guid > . Empty ) ;
7879
7980 // Wolverine invokes the handler, manages transaction, and returns result
8081 return bus . InvokeAsync < IResult > ( command ) ;
@@ -97,8 +98,8 @@ static Task<IResult> UpdateBook(
9798 request . Translations ,
9899 request . PublicationDate ,
99100 request . PublisherId ,
100- request . AuthorIds ?? [ ] ,
101- request . CategoryIds ?? [ ] )
101+ request . AuthorIds ?? ImmutableList < Guid > . Empty ,
102+ request . CategoryIds ?? ImmutableList < Guid > . Empty )
102103 {
103104 ETag = etag
104105 } ;
0 commit comments