File tree Expand file tree Collapse file tree 3 files changed +17
-5
lines changed
Expand file tree Collapse file tree 3 files changed +17
-5
lines changed Original file line number Diff line number Diff line change @@ -301,7 +301,7 @@ pub fn build_auth_cookie(token: &str) -> Cookie<'static> {
301301 . path ( "/" )
302302 . http_only ( true )
303303 . same_site ( SameSite :: Lax )
304- . max_age ( TimeDuration :: seconds ( AUTH_COOKIE_TTL_SECONDS ) ) ;
304+ . max_age ( Duration :: seconds ( AUTH_COOKIE_TTL_SECONDS ) ) ;
305305
306306 // Add Secure flag in production (HTTPS only)
307307 if cookies_should_be_secure ( ) {
@@ -331,7 +331,7 @@ pub fn build_cookie_removal() -> Cookie<'static> {
331331 . http_only ( true )
332332 . same_site ( SameSite :: Lax )
333333 . expires ( OffsetDateTime :: UNIX_EPOCH )
334- . max_age ( TimeDuration :: seconds ( 0 ) ) ;
334+ . max_age ( Duration :: seconds ( 0 ) ) ;
335335
336336 // Match security settings of auth cookie
337337 if cookies_should_be_secure ( ) {
Original file line number Diff line number Diff line change @@ -398,7 +398,7 @@ pub async fn vote_comment(
398398 )
399399 } ) ?;
400400
401- if exists. is_none ( ) {
401+ if ! exists {
402402 return Err ( (
403403 StatusCode :: NOT_FOUND ,
404404 Json ( ErrorResponse {
@@ -471,5 +471,17 @@ pub async fn vote_comment(
471471 )
472472 } ) ?;
473473
474- Ok ( Json ( comment) )
474+ // Convert models::Comment to handlers::comments::Comment
475+ let response_comment = Comment {
476+ id : comment. id ,
477+ tutorial_id : comment. tutorial_id ,
478+ post_id : comment. post_id ,
479+ author : comment. author ,
480+ content : comment. content ,
481+ created_at : comment. created_at ,
482+ votes : comment. votes ,
483+ is_admin : comment. is_admin ,
484+ } ;
485+
486+ Ok ( Json ( response_comment) )
475487}
Original file line number Diff line number Diff line change @@ -169,7 +169,7 @@ pub async fn list_posts_for_page(
169169) -> Result < Json < SitePostListResponse > , ( StatusCode , Json < ErrorResponse > ) > {
170170 ensure_admin ( & claims) ?;
171171
172- db :: get_site_page_by_id ( & pool, & page_id)
172+ repositories :: pages :: get_site_page_by_id ( & pool, & page_id)
173173 . await
174174 . map_err ( |err| map_sqlx_error ( err, "Site page" ) ) ?
175175 . ok_or_else ( || {
You can’t perform that action at this time.
0 commit comments