@@ -10,14 +10,23 @@ import { AllExceptionsFilter } from 'src/utils/utils';
1010import {
1111 ApiBadRequestResponse ,
1212 ApiBearerAuth ,
13+ ApiNotFoundResponse ,
1314 ApiOkResponse ,
1415 ApiQuery ,
1516 ApiTags ,
1617 ApiUnauthorizedResponse ,
1718} from '@nestjs/swagger' ;
1819import { LogService } from 'src/log/services/log.service' ;
1920import { AuthGuard } from '@nestjs/passport' ;
20- import { FetchUsageRespDetail } from '../dto/create-usage.dto' ;
21+ import {
22+ FetchDetailUsageDto ,
23+ FetchUsageRespDetail ,
24+ } from '../dto/create-usage.dto' ;
25+ import {
26+ UsageError ,
27+ UsageNotFoundError ,
28+ UsageUnAuthorizeError ,
29+ } from '../dto/error-usage.dto' ;
2130@UseFilters ( AllExceptionsFilter )
2231@ApiTags ( 'Utilities' )
2332@ApiBearerAuth ( 'Authorization' )
@@ -32,12 +41,16 @@ export class UsageController {
3241 type : FetchUsageRespDetail ,
3342 } )
3443 @ApiBadRequestResponse ( {
35- description : 'Error has occurred at the time sending verification result' ,
36- // type: ResultErrorResponse,
44+ description : 'Error has occurred at the time of fething usage detail' ,
45+ type : UsageError ,
46+ } )
47+ @ApiNotFoundResponse ( {
48+ description : 'No usage detail found' ,
49+ type : UsageNotFoundError ,
3750 } )
3851 @ApiUnauthorizedResponse ( {
3952 description : 'Authorization token is invalid or expired.' ,
40- // type: ResultUnauthorizationErrorResponse ,
53+ type : UsageUnAuthorizeError ,
4154 } )
4255 @ApiQuery ( {
4356 name : 'serviceId' ,
@@ -58,8 +71,8 @@ export class UsageController {
5871 @Query ( 'serviceId' ) appIdParam : string ,
5972 @Query ( 'startDate' ) startDateParam : Date ,
6073 @Query ( 'endDate' ) endDateParam : Date ,
61- @Req ( ) req , // : Promise<UsageResponseDto>
62- ) {
74+ @Req ( ) req ,
75+ ) : Promise < FetchUsageRespDetail > {
6376 let appId ;
6477 if ( ! appIdParam ) {
6578 appId = req . app . appId ;
@@ -104,15 +117,19 @@ export class UsageController {
104117 @Get ( '/detail' )
105118 @ApiOkResponse ( {
106119 description : 'Detail of api call made' ,
107- // type: FormatedUsageSessionDetailResp ,
120+ type : FetchDetailUsageDto ,
108121 } )
109122 @ApiBadRequestResponse ( {
110- description : 'Error has occurred at the time sending verification result' ,
111- // type: ResultErrorResponse,
123+ description : 'Error has occurred at the time of fething usage detail' ,
124+ type : UsageError ,
125+ } )
126+ @ApiNotFoundResponse ( {
127+ description : 'No usage detail found' ,
128+ type : UsageNotFoundError ,
112129 } )
113130 @ApiUnauthorizedResponse ( {
114131 description : 'Authorization token is invalid or expired.' ,
115- // type: ResultUnauthorizationErrorResponse ,
132+ type : UsageUnAuthorizeError ,
116133 } )
117134 @ApiQuery ( {
118135 name : 'serviceId' ,
@@ -133,8 +150,8 @@ export class UsageController {
133150 @Query ( 'serviceId' ) appIdParam : string ,
134151 @Query ( 'startDate' ) startDateParam : Date ,
135152 @Query ( 'endDate' ) endDateParam : Date ,
136- @Req ( ) req , // : Promise<UsageResponseDto>
137- ) {
153+ @Req ( ) req ,
154+ ) : Promise < FetchDetailUsageDto > {
138155 let appId ;
139156 if ( ! appIdParam ) {
140157 appId = req . app . appId ;
0 commit comments