File tree Expand file tree Collapse file tree 1 file changed +18
-10
lines changed Expand file tree Collapse file tree 1 file changed +18
-10
lines changed Original file line number Diff line number Diff line change @@ -162,18 +162,26 @@ [FromQuery] string name
162
162
query = query . Where ( a => a . Username . Contains ( name ) ) ;
163
163
}
164
164
165
- var history = await query
166
- . OrderByDescending ( a => a . History . Select ( h => h . Time ) . FirstOrDefault ( ) )
165
+ var results = await query . FirstOrDefaultAsync ( a => a . Guid == accountGuid ) ;
166
+
167
+ if ( results == null )
168
+ {
169
+ return NotFound ( ) ;
170
+ }
171
+
172
+ results . History = results . History . OrderByDescending ( h => h . Time ) . ToList ( ) ;
173
+
174
+ var history = results . History
167
175
. Skip ( page * 10 )
168
176
. Take ( 10 )
169
- . Select ( a => new AccountHistoryResponse ( )
170
- {
171
- History = a . History ,
172
- Page = page ,
173
- TotalPages = ( int ) Math . Ceiling ( ( double ) a . History . Count / 10 )
174
- } )
175
- . ToListAsync ( ) ;
176
- return Ok ( history . First ( ) ) ;
177
+ . ToList ( ) ;
178
+
179
+ return Ok ( new AccountHistoryResponse ( )
180
+ {
181
+ History = history ,
182
+ Page = page ,
183
+ TotalPages = ( int ) Math . Ceiling ( ( double ) ( results . History . Count / 10 ) )
184
+ } ) ;
177
185
}
178
186
179
187
private bool IsLocal ( ConnectionInfo connection )
You can’t perform that action at this time.
0 commit comments