@@ -7,7 +7,19 @@ import {
77 walletDetailsSchema ,
88} from "../../schemas/sharedApiSchemas" ;
99
10- // OUTPUT
10+ const QuerySchema = Type . Object ( {
11+ page : Type . Number ( {
12+ description : "The page of wallets to get." ,
13+ examples : [ "1" ] ,
14+ default : "1" ,
15+ } ) ,
16+ limit : Type . Number ( {
17+ description : "The number of wallets to get per page." ,
18+ examples : [ "10" ] ,
19+ default : "10" ,
20+ } ) ,
21+ } ) ;
22+
1123const responseSchema = Type . Object ( {
1224 result : Type . Array ( walletDetailsSchema ) ,
1325} ) ;
@@ -30,6 +42,7 @@ responseSchema.example = {
3042} ;
3143export async function getAll ( fastify : FastifyInstance ) {
3244 fastify . route < {
45+ Querystring : Static < typeof QuerySchema > ;
3346 Reply : Static < typeof responseSchema > ;
3447 } > ( {
3548 method : "GET" ,
@@ -39,15 +52,19 @@ export async function getAll(fastify: FastifyInstance) {
3952 description : "Get all backend wallets." ,
4053 tags : [ "Backend Wallet" ] ,
4154 operationId : "getAll" ,
55+ querystring : QuerySchema ,
4256 response : {
4357 ...standardResponseSchema ,
4458 [ StatusCodes . OK ] : responseSchema ,
4559 } ,
4660 } ,
47- handler : async ( request , reply ) => {
48- const wallets = await getAllWallets ( ) ;
61+ handler : async ( req , res ) => {
62+ const wallets = await getAllWallets ( {
63+ page : req . query . page ,
64+ limit : req . query . limit ,
65+ } ) ;
4966
50- reply . status ( StatusCodes . OK ) . send ( {
67+ res . status ( StatusCodes . OK ) . send ( {
5168 result : wallets ,
5269 } ) ;
5370 } ,
0 commit comments