File tree 5 files changed +52
-2
lines changed
indexer-api-gateway/src/api/services
indexer-frontend/src/app/views
5 files changed +52
-2
lines changed Original file line number Diff line number Diff line change @@ -685,6 +685,12 @@ export class EntityApi extends ApiClient {
685
685
example : '0.0.1960' ,
686
686
required : false ,
687
687
} )
688
+ @ApiQuery ( {
689
+ name : 'topicId' ,
690
+ description : 'Topic identifier' ,
691
+ example : '0.0.1960' ,
692
+ required : false ,
693
+ } )
688
694
@HttpCode ( HttpStatus . OK )
689
695
async getTokens (
690
696
@Query ( 'pageIndex' ) pageIndex ?: number ,
@@ -693,6 +699,7 @@ export class EntityApi extends ApiClient {
693
699
@Query ( 'orderDir' ) orderDir ?: string ,
694
700
@Query ( 'tokenId' ) tokenId ?: string ,
695
701
@Query ( 'treasury' ) treasury ?: string ,
702
+ @Query ( 'topicId' ) topicId ?: string ,
696
703
) {
697
704
return await this . send ( IndexerMessageAPI . GET_TOKENS , {
698
705
pageIndex,
@@ -701,6 +708,7 @@ export class EntityApi extends ApiClient {
701
708
orderDir,
702
709
tokenId,
703
710
treasury,
711
+ topicId,
704
712
} ) ;
705
713
}
706
714
Original file line number Diff line number Diff line change @@ -158,6 +158,11 @@ export class TokensComponent extends BaseGridComponent {
158
158
field : 'tokenId' ,
159
159
label : 'grid.token_id'
160
160
} ) )
161
+ this . filters . push ( new Filter ( {
162
+ type : 'input' ,
163
+ field : 'topicId' ,
164
+ label : 'grid.topic_id'
165
+ } ) )
161
166
this . filters . push ( new Filter ( {
162
167
type : 'input' ,
163
168
field : 'treasury' ,
Original file line number Diff line number Diff line change @@ -207,6 +207,14 @@ export class TopicDetailsComponent extends BaseDetailsComponent {
207
207
} ) ;
208
208
}
209
209
210
+ public override onOpenTokens ( ) {
211
+ this . router . navigate ( [ '/tokens' ] , {
212
+ queryParams : {
213
+ 'topicId' : this . id ,
214
+ } ,
215
+ } ) ;
216
+ }
217
+
210
218
public override onOpenRoles ( ) {
211
219
this . router . navigate ( [ '/roles' ] , {
212
220
queryParams : {
Original file line number Diff line number Diff line change @@ -1122,9 +1122,31 @@ export class EntityService {
1122
1122
@Payload ( ) msg : PageFilters
1123
1123
) : Promise < AnyResponse < Page < Token > > > {
1124
1124
try {
1125
- const options = parsePageParams ( msg ) ;
1126
- const filters = parsePageFilters ( msg ) ;
1125
+ const { topicId, ...params } = msg ;
1126
+ const options = parsePageParams ( params ) ;
1127
+ const filters = parsePageFilters ( params ) ;
1127
1128
const em = DataBaseHelper . getEntityManager ( ) ;
1129
+
1130
+ if ( topicId ) {
1131
+ const tokens = await em . find ( Message , {
1132
+ type : MessageType . TOKEN ,
1133
+ topicId,
1134
+ } as any , {
1135
+ ...options ,
1136
+ fields : [ "options" ] ,
1137
+ } ) ;
1138
+
1139
+ filters . tokenId = {
1140
+ $in : tokens . reduce ( ( res , { options } ) => {
1141
+ if ( options ?. tokenId ) {
1142
+ res . push ( options . tokenId ) ;
1143
+ }
1144
+
1145
+ return res ;
1146
+ } , [ ] )
1147
+ }
1148
+ }
1149
+
1128
1150
const [ rows , count ] = await em . findAndCount (
1129
1151
TokenCache ,
1130
1152
filters ,
Original file line number Diff line number Diff line change @@ -886,6 +886,13 @@ paths:
886
886
schema :
887
887
example : 0.0.1960
888
888
type : string
889
+ - name : topicId
890
+ required : false
891
+ in : query
892
+ description : Topic identifier
893
+ schema :
894
+ example : 0.0.1960
895
+ type : string
889
896
responses :
890
897
' 200 ' :
891
898
description : Tokens
You can’t perform that action at this time.
0 commit comments