-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from andresWeitzel/feature-02-add-rate-plans-en…
…dpoints feature-02-add-rate-plans-endpoints
- Loading branch information
Showing
13 changed files
with
423 additions
and
195 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,5 +2,4 @@ | |
import { Injectable } from '@nestjs/common'; | ||
|
||
@Injectable() | ||
export class AppService { | ||
} | ||
export class AppService {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/** | ||
* @description pagination errors names | ||
* @returns the name value of the pagination error | ||
* @example | ||
*/ | ||
export const paginationNameValueError = { | ||
ORDER_BY_NAME_VALUE_ERROR: 'OrderByNameValueError', | ||
ORDER_AT_NAME_VALUE_ERROR: 'OrderAtNameValueError', | ||
}; | ||
|
||
/** | ||
* @description pagination errors description | ||
* @returns the description value of the pagination error | ||
* @example | ||
*/ | ||
export const paginationDescriptionValueError = { | ||
ORDER_BY_DESCRIPTION_VALUE_ERROR: | ||
'It is not possible to apply sorting based on the requested orderBy value. Invalid field', | ||
ORDER_AT_DESCRIPTION_VALUE_ERROR: | ||
'It is not possible to apply sorting based on the requested orderAt value. Invalid field', | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
//Const-vars | ||
let msgResponse: string; | ||
let msgLog: string; | ||
|
||
/** | ||
* @description checks the order by value of the query string param to assign a field value | ||
* @param {String} orderBy String type | ||
* @returns a string with the field value or null | ||
*/ | ||
export const checkOrderBy = async (orderBy: string) => { | ||
try { | ||
msgResponse = null; | ||
msgLog = null; | ||
|
||
switch (orderBy.toLowerCase()) { | ||
case 'id': | ||
orderBy = 'id'; | ||
break; | ||
case 'nombre': | ||
case 'name': | ||
orderBy = 'name'; | ||
break; | ||
case 'descripcion': | ||
case 'description': | ||
orderBy = 'description'; | ||
break; | ||
case 'version_id': | ||
case 'versionid': | ||
orderBy = 'version_id'; | ||
break; | ||
case 'version_plan': | ||
case 'versionplan': | ||
orderBy = 'version_plan'; | ||
break; | ||
case 'status': | ||
orderBy = 'status'; | ||
break; | ||
case 'type_plan': | ||
case 'typeplan': | ||
orderBy = 'type_plan'; | ||
break; | ||
case 'subscription_charge': | ||
case 'subscriptioncharge': | ||
orderBy = 'subscription_charge'; | ||
break; | ||
case 'number_of_tiers': | ||
case 'numberoftiers': | ||
orderBy = 'number_of_tiers'; | ||
break; | ||
case 'creation_date': | ||
case 'creationdate': | ||
orderBy = 'creation_date'; | ||
break; | ||
case 'update_date': | ||
case 'updatedate': | ||
orderBy = 'update_date'; | ||
break; | ||
default: | ||
orderBy = null; | ||
} | ||
console.log(orderBy); | ||
return orderBy; | ||
} catch (error) { | ||
msgResponse = 'ERROR in checkOrderBy() helper function.'; | ||
msgLog = msgResponse + `Caused by ${error}`; | ||
console.log(msgLog); | ||
return null; | ||
} | ||
}; | ||
|
||
/** | ||
* @description checks the order at value of the query string param to assign a field value | ||
* @param {String} orderAt String type | ||
* @returns a string with the field value or null | ||
*/ | ||
export const checkOrderAt = async (orderAt: string) => { | ||
try { | ||
msgResponse = null; | ||
msgLog = null; | ||
|
||
switch (orderAt.toLowerCase()) { | ||
case 'asc': | ||
orderAt = 'ASC'; | ||
break; | ||
case 'desc': | ||
orderAt = 'DESC'; | ||
break; | ||
default: | ||
orderAt = null; | ||
} | ||
return orderAt; | ||
} catch (error) { | ||
msgResponse = 'ERROR in checkOrderAt() helper function.'; | ||
msgLog = msgResponse + `Caused by ${error}`; | ||
console.log(msgLog); | ||
return null; | ||
} | ||
}; |
Oops, something went wrong.