@@ -21,7 +21,7 @@ public class TechnologyResult
2121 public string Slug { get ; set ; }
2222 }
2323
24- public async Task < CreatePostResponse > Post ( ImportHackerNewsPost request )
24+ public async Task < CreatePostResponse > Post ( ImportNewsPost request )
2525 {
2626 string SanitizeName ( string tech ) => tech . GenerateSlug ( ) ! . Replace ( "-" , "" ) . Trim ( ) ;
2727
@@ -56,6 +56,7 @@ public async Task<CreatePostResponse> Post(ImportHackerNewsPost request)
5656 Url = request . Url ,
5757 Content = request . Summary ,
5858 TechnologyIds = techIds . ToArray ( ) ,
59+ Points = request . Points > 0 ? request . Points : 1 ,
5960 } ;
6061
6162 if ( request . Sentiment != null )
@@ -126,12 +127,12 @@ public async Task<CreatePostResponse> Post(CreatePost request)
126127 throw new ArgumentException ( $ "URL already used in unarchived /posts/{ existingPost . Id } /{ existingPost . Slug } ", nameof ( request . Url ) ) ;
127128
128129 var post = request . ConvertTo < Post > ( ) ;
129- post . Slug = request . Title . GenerateSlug ( ) ;
130+ post . Slug = request . Title . GenerateSlug ( ) ?? "" ;
130131 post . Created = post . Modified = DateTime . Now ;
131132 post . CreatedBy = post . ModifiedBy = user . UserName ;
132133 post . UserId = user . UserAuthId . ToInt ( ) ;
133134 post . UpVotes = 0 ;
134- post . Points = 1 ;
135+ post . Points = request . Points ?? 1 ;
135136 post . ContentHtml = Markdown . Transform ( post . Content ) ;
136137 post . Rank = 0 ;
137138
0 commit comments