Skip to content

Commit

Permalink
xo fixes - JSdocs & other warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
tmilar committed Jul 11, 2019
1 parent 6b7fe91 commit 0a86bee
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 25 deletions.
11 changes: 6 additions & 5 deletions config/meli-auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,12 @@ const meliAuth = {
* Callback after Mercadolibre authorization.
* Uses default meliAuth.onAuthSuccess() callback, but it can be overwritten for custom logic ie. CLI app.
*
* @param accessToken
* @param refreshToken
* @param profile
* @param done
* @returns {Promise<*>}
* @param {string} accessToken - the MercadoLibre access token
* @param {string} refreshToken - the MercadoLibre refresh token
* @param {*} profile - the authorized mercadolibre account profile
* @param {function} done - callback
*
* @returns {Promise<*>} - execution promise
*/
const authorizedCb = async (accessToken, refreshToken, profile, done) => {
const tokens = {accessToken, refreshToken}
Expand Down
5 changes: 3 additions & 2 deletions lib/meli-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -346,8 +346,9 @@ class MeliClient {
/**
*
* @param {number} id - the id of the user to get info of
* @param {*} [authAccount] - optional: auth account to be used (to get all of the user sensitive info)
* @returns {Promise<void>}
* @param {*} [authAccount] - optional. auth account to be used (in order to retrieve the user private info as well)
*
* @returns {Promise<*>} - mercadolibre user promise
*/
async getUser(id, authAccount = null) {
if (!id) {
Expand Down
18 changes: 10 additions & 8 deletions model/order.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ const deliveryType = {
class Order {
/**
*
* @param meliOrderJson
* @returns {Order}
* @param {*} meliOrderJson - JSON of the MeLi Order object
* @returns {Order} the created Order instance object
*/
static buildFromMeliOrder(meliOrderJson) {
const {
Expand Down Expand Up @@ -108,10 +108,11 @@ class Order {
/**
* Convert item data to it's spreadsheets Hyperlink function.
*
* @param id
* @param title
* @returns {string}
* @private
* @param {string} id - the item id
* @param {string} title - the item title
*
* @returns {string} - the meli item URL
*/
static _itemToHyperlink({id, title}) {
const base = 'http://articulo.mercadolibre.com.ar/'
Expand All @@ -125,9 +126,10 @@ class Order {
/**
* Convert buyer profile to it's nickname spreadsheets hyperlink.
*
* @param nickname
* @returns {string}
* @private
* @param {string} nickname - the nickanme to use for the profile url
*
* @returns {string} the profile URL
*/
static _buyerProfileToHyperlink({nickname}) {
const base = 'https://perfil.mercadolibre.com.ar/'
Expand All @@ -139,7 +141,7 @@ class Order {
/**
* Convert Order to an array of values, ordered to be correctly placed as a row.
*
* @returns {Array}
* @returns {[string]} - row values array
*/
toRowArray({update} = {}) {
// Map Order properties to array values, in columns order.
Expand Down
19 changes: 10 additions & 9 deletions service/orders.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ class OrdersService {
headerRowHeight: this.headerRowHeight,
headerRowWidth: this.headerRowWidth
})

}

static async saveNewOrder(newOrderJson) {
Expand All @@ -62,11 +61,12 @@ class OrdersService {
/**
* For all accounts, fetch all Meli orders between desired dates.
*
* @param startDate
* @param endDate
* @param accounts - {mongoose model}
* @param id - fetch by order id
* @returns {array} all the meli orders for the selected accounts, ordered by date_closed.
* @param {date} [startDate] - filter to retrieve results on or after this date only. Optional.
* @param {date} [endDate] - filter to retrieve results up to this date only. Optional.
* @param {[Account]} [accounts] - filter to retrieve results of these accounts only. Optional.
* @param {number|string} [id] - filter to fetch only one specific order by id
*
* @returns {[*]} all the meli orders for the selected accounts, ordered by date_closed.
*/
static async fetchMeliOrders({startDate, endDate, accounts, id}) {
const ordersResponses = await this.meliClient.getOrders({startDate, endDate, accounts, id})
Expand All @@ -90,9 +90,10 @@ class OrdersService {
/**
* Fetch one specific order by account and id.
*
* @param account - {mongoose account holding the order}
* @param id - orderId
* @returns {Promise.<null>} - order object
* @param {Account} account - the selected account . Optional.
* @param {number|string} [id] - meli order id
*
* @returns {Promise.<{}|null>} - resolves order object, or null if not found
*/
static async fetchOneMeliOrder(account, id) {
const orders = await this.fetchMeliOrders({accounts: [account], id})
Expand Down
1 change: 0 additions & 1 deletion test/unit/lib/meli-client.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable import/first,import/order,import/no-unassigned-import,camelcase */
import test from 'ava'

// Load test env variables
Expand Down

0 comments on commit 0a86bee

Please sign in to comment.