fix: begin writing Lists integration tests. fix: list item response model's id value should be of type string so modified the created with id response model that it extends so that the id property is generically typed and type can be passed in.
This commit is contained in:
@@ -219,17 +219,19 @@ export class ApiResponse<T> {
|
||||
}
|
||||
|
||||
/**
|
||||
* @method asCreatedWithIdResponseType - Converts the ApiResponse to an ApiResponse<CreatedWithIdResponse>.
|
||||
* @returns {ApiResponse<CreatedWithIdResponse>} - An ApiResponse<CreatedWithIdResponse>.
|
||||
* @method asCreatedWithIdResponseType - Converts the ApiResponse to an ApiResponse<CreatedWithIdResponse<T>>.
|
||||
* @returns {ApiResponse<CreatedWithIdResponse<T>>} - An ApiResponse<CreatedWithIdResponse<T>>.
|
||||
*/
|
||||
public asCreatedWithIdResponseType(): ApiResponse<CreatedWithIdResponse> {
|
||||
public asCreatedWithIdResponseType<T>(): ApiResponse<
|
||||
CreatedWithIdResponse<T>
|
||||
> {
|
||||
const apiResponse = this as ApiResponse<any>;
|
||||
|
||||
const createdWithIdResponse = new CreatedWithIdResponse(
|
||||
const createdWithIdResponse = new CreatedWithIdResponse<T>(
|
||||
apiResponse.data.id
|
||||
);
|
||||
|
||||
return new ApiResponse<CreatedWithIdResponse>(
|
||||
return new ApiResponse<CreatedWithIdResponse<T>>(
|
||||
apiResponse.statusCode,
|
||||
apiResponse.message,
|
||||
createdWithIdResponse
|
||||
|
||||
Reference in New Issue
Block a user