@@ -55,7 +55,9 @@ mod priv_ {
55
55
use std:: net:: IpAddr ;
56
56
57
57
use chrono:: { DateTime , Utc } ;
58
+ use mas_storage:: pagination:: Node ;
58
59
use sea_query:: enum_def;
60
+ use ulid:: Ulid ;
59
61
use uuid:: Uuid ;
60
62
61
63
#[ derive( sqlx:: FromRow ) ]
@@ -77,6 +79,12 @@ mod priv_ {
77
79
pub ( super ) last_active_at : Option < DateTime < Utc > > ,
78
80
pub ( super ) last_active_ip : Option < IpAddr > ,
79
81
}
82
+
83
+ impl Node < Ulid > for AppSessionLookup {
84
+ fn cursor ( & self ) -> Ulid {
85
+ self . cursor . into ( )
86
+ }
87
+ }
80
88
}
81
89
82
90
use priv_:: { AppSessionLookup , AppSessionLookupIden } ;
@@ -592,13 +600,13 @@ mod tests {
592
600
let full_list = repo. app_session ( ) . list ( all, pagination) . await . unwrap ( ) ;
593
601
assert_eq ! ( full_list. edges. len( ) , 1 ) ;
594
602
assert_eq ! (
595
- full_list. edges[ 0 ] ,
603
+ full_list. edges[ 0 ] . node ,
596
604
AppSession :: Compat ( Box :: new( compat_session. clone( ) ) )
597
605
) ;
598
606
let active_list = repo. app_session ( ) . list ( active, pagination) . await . unwrap ( ) ;
599
607
assert_eq ! ( active_list. edges. len( ) , 1 ) ;
600
608
assert_eq ! (
601
- active_list. edges[ 0 ] ,
609
+ active_list. edges[ 0 ] . node ,
602
610
AppSession :: Compat ( Box :: new( compat_session. clone( ) ) )
603
611
) ;
604
612
let finished_list = repo. app_session ( ) . list ( finished, pagination) . await . unwrap ( ) ;
@@ -618,15 +626,15 @@ mod tests {
618
626
let full_list = repo. app_session ( ) . list ( all, pagination) . await . unwrap ( ) ;
619
627
assert_eq ! ( full_list. edges. len( ) , 1 ) ;
620
628
assert_eq ! (
621
- full_list. edges[ 0 ] ,
629
+ full_list. edges[ 0 ] . node ,
622
630
AppSession :: Compat ( Box :: new( compat_session. clone( ) ) )
623
631
) ;
624
632
let active_list = repo. app_session ( ) . list ( active, pagination) . await . unwrap ( ) ;
625
633
assert ! ( active_list. edges. is_empty( ) ) ;
626
634
let finished_list = repo. app_session ( ) . list ( finished, pagination) . await . unwrap ( ) ;
627
635
assert_eq ! ( finished_list. edges. len( ) , 1 ) ;
628
636
assert_eq ! (
629
- finished_list. edges[ 0 ] ,
637
+ finished_list. edges[ 0 ] . node ,
630
638
AppSession :: Compat ( Box :: new( compat_session. clone( ) ) )
631
639
) ;
632
640
@@ -680,25 +688,25 @@ mod tests {
680
688
let full_list = repo. app_session ( ) . list ( all, pagination) . await . unwrap ( ) ;
681
689
assert_eq ! ( full_list. edges. len( ) , 2 ) ;
682
690
assert_eq ! (
683
- full_list. edges[ 0 ] ,
691
+ full_list. edges[ 0 ] . node ,
684
692
AppSession :: Compat ( Box :: new( compat_session. clone( ) ) )
685
693
) ;
686
694
assert_eq ! (
687
- full_list. edges[ 1 ] ,
695
+ full_list. edges[ 1 ] . node ,
688
696
AppSession :: OAuth2 ( Box :: new( oauth_session. clone( ) ) )
689
697
) ;
690
698
691
699
let active_list = repo. app_session ( ) . list ( active, pagination) . await . unwrap ( ) ;
692
700
assert_eq ! ( active_list. edges. len( ) , 1 ) ;
693
701
assert_eq ! (
694
- active_list. edges[ 0 ] ,
702
+ active_list. edges[ 0 ] . node ,
695
703
AppSession :: OAuth2 ( Box :: new( oauth_session. clone( ) ) )
696
704
) ;
697
705
698
706
let finished_list = repo. app_session ( ) . list ( finished, pagination) . await . unwrap ( ) ;
699
707
assert_eq ! ( finished_list. edges. len( ) , 1 ) ;
700
708
assert_eq ! (
701
- finished_list. edges[ 0 ] ,
709
+ finished_list. edges[ 0 ] . node ,
702
710
AppSession :: Compat ( Box :: new( compat_session. clone( ) ) )
703
711
) ;
704
712
@@ -716,11 +724,11 @@ mod tests {
716
724
let full_list = repo. app_session ( ) . list ( all, pagination) . await . unwrap ( ) ;
717
725
assert_eq ! ( full_list. edges. len( ) , 2 ) ;
718
726
assert_eq ! (
719
- full_list. edges[ 0 ] ,
727
+ full_list. edges[ 0 ] . node ,
720
728
AppSession :: Compat ( Box :: new( compat_session. clone( ) ) )
721
729
) ;
722
730
assert_eq ! (
723
- full_list. edges[ 1 ] ,
731
+ full_list. edges[ 1 ] . node ,
724
732
AppSession :: OAuth2 ( Box :: new( oauth_session. clone( ) ) )
725
733
) ;
726
734
@@ -730,11 +738,11 @@ mod tests {
730
738
let finished_list = repo. app_session ( ) . list ( finished, pagination) . await . unwrap ( ) ;
731
739
assert_eq ! ( finished_list. edges. len( ) , 2 ) ;
732
740
assert_eq ! (
733
- finished_list. edges[ 0 ] ,
741
+ finished_list. edges[ 0 ] . node ,
734
742
AppSession :: Compat ( Box :: new( compat_session. clone( ) ) )
735
743
) ;
736
744
assert_eq ! (
737
- full_list. edges[ 1 ] ,
745
+ full_list. edges[ 1 ] . node ,
738
746
AppSession :: OAuth2 ( Box :: new( oauth_session. clone( ) ) )
739
747
) ;
740
748
@@ -744,7 +752,7 @@ mod tests {
744
752
let list = repo. app_session ( ) . list ( filter, pagination) . await . unwrap ( ) ;
745
753
assert_eq ! ( list. edges. len( ) , 1 ) ;
746
754
assert_eq ! (
747
- list. edges[ 0 ] ,
755
+ list. edges[ 0 ] . node ,
748
756
AppSession :: Compat ( Box :: new( compat_session. clone( ) ) )
749
757
) ;
750
758
@@ -753,7 +761,7 @@ mod tests {
753
761
let list = repo. app_session ( ) . list ( filter, pagination) . await . unwrap ( ) ;
754
762
assert_eq ! ( list. edges. len( ) , 1 ) ;
755
763
assert_eq ! (
756
- list. edges[ 0 ] ,
764
+ list. edges[ 0 ] . node ,
757
765
AppSession :: OAuth2 ( Box :: new( oauth_session. clone( ) ) )
758
766
) ;
759
767
0 commit comments