File tree Expand file tree Collapse file tree 3 files changed +6
-6
lines changed
Expand file tree Collapse file tree 3 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -522,7 +522,7 @@ macro_rules! seek {
522522 use crate :: util:: errors:: AppResult ;
523523 use crate :: controllers:: helpers:: pagination:: Page ;
524524 impl $name {
525- pub fn after ( & self , page: & Page ) -> AppResult <Option <[ <$name Payload >] >> {
525+ pub fn decode ( & self , page: & Page ) -> AppResult <Option <[ <$name Payload >] >> {
526526 let Page :: Seek ( ref encoded) = * page else {
527527 return Ok ( None ) ;
528528 } ;
@@ -670,7 +670,7 @@ mod tests {
670670 . enable_seek ( true )
671671 . gather ( & mock ( query) )
672672 . unwrap ( ) ;
673- let decoded = seek. after ( & pagination. page ) . unwrap ( ) ;
673+ let decoded = seek. decode ( & pagination. page ) . unwrap ( ) ;
674674 assert_eq ! ( decoded, expect) ;
675675 } ;
676676
@@ -706,7 +706,7 @@ mod tests {
706706 . enable_seek ( true )
707707 . gather ( & mock ( & query) )
708708 . unwrap ( ) ;
709- let error = seek. after ( & pagination. page ) . unwrap_err ( ) ;
709+ let error = seek. decode ( & pagination. page ) . unwrap_err ( ) ;
710710 assert_eq ! ( error. to_string( ) , "invalid seek parameter" ) ;
711711 let response = error. response ( ) ;
712712 assert_eq ! ( response. status( ) , StatusCode :: BAD_REQUEST ) ;
Original file line number Diff line number Diff line change @@ -196,7 +196,7 @@ pub async fn list_crates(
196196 let ( total, next_page, prev_page, data) = if !explicit_page && seek. is_some ( ) {
197197 let seek = seek. unwrap ( ) ;
198198 if let Some ( condition) = seek
199- . after ( & pagination. page ) ?
199+ . decode ( & pagination. page ) ?
200200 . map ( |s| filter_params. seek_after ( & s) )
201201 {
202202 query = query. filter ( condition) ;
Original file line number Diff line number Diff line change @@ -159,7 +159,7 @@ async fn list_by_date(
159159 !matches!( & options. page, Page :: Numeric ( _) ) ,
160160 "?page= is not supported"
161161 ) ;
162- if let Some ( SeekPayload :: Date ( Date { created_at, id } ) ) = Seek :: Date . after ( & options. page ) ? {
162+ if let Some ( SeekPayload :: Date ( Date { created_at, id } ) ) = Seek :: Date . decode ( & options. page ) ? {
163163 query = query. filter (
164164 versions:: created_at
165165 . eq ( created_at)
@@ -297,7 +297,7 @@ async fn list_by_semver(
297297 } ) ;
298298
299299 let mut idx = Some ( 0 ) ;
300- if let Some ( SeekPayload :: Semver ( Semver { id } ) ) = Seek :: Semver . after ( & options. page ) ? {
300+ if let Some ( SeekPayload :: Semver ( Semver { id } ) ) = Seek :: Semver . decode ( & options. page ) ? {
301301 idx = sorted_versions
302302 . get_index_of ( & id)
303303 . filter ( |i| i + 1 < sorted_versions. len ( ) )
You can’t perform that action at this time.
0 commit comments