Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | 1x 1x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 1x | 'use strict';
const Config = use('Config');
const namespace = Config.get('modules.salon.general.namespace');
class ILSalonController {
static get inject() {
return [`${namespace}/Services/SalonService`, `${namespace}/Services/ThirdPartyService`];
}
constructor(salonService, thirdPartyService) {
this.salonService = salonService;
this.thirdPartyService = thirdPartyService;
}
/**
* @swagger
*
* /api/v1/apps/salons:
* get:
* tags:
* - salons
* operationId: 'getAllSalonByIL'
* summary: 'getAllSalonByIL'
* description: 'Get all salon by IL'
* security:
* - BasicAuth: []
* parameters:
* - $ref: '#/components/parameters/PageParam'
* - $ref: '#/components/parameters/LimitParam'
* - $ref: '#/components/parameters/EmailParam'
* - $ref: '#/components/parameters/KeywordParam'
* - $ref: '#/components/parameters/ThirdPartyConnectedQueryParam'
* - $ref: '#/components/parameters/ThirdPartyCodeQueryParam'
* - $ref: '#/components/parameters/ThirdPartyTokenQueryParam'
* - $ref: '#/components/parameters/IdsParam'
* responses:
* 200:
* description: ok
* content:
* application/json; charset=utf-8:
* schema:
* $ref: '#/components/schemas/SystemSalonPaginationResponse'
* 403:
* $ref: '#/components/responses/Forbidden'
* 404:
* $ref: '#/components/responses/NotFound'
* 500:
* description: system error
*/
async index({ request, response, transform }) {
const page = request.input('page', 1);
const limit = request.input('limit', 20);
const ids = request.input('ids') ? request.input('ids').split(',') : [];
const email = request.input('email');
const keyword = request.input('keyword');
const thirdPartyCode = request.input('thirdPartyCode');
const thirdPartyToken = request.input('thirdPartyToken');
const thirdPartyConnected = request.input('thirdPartyConnected');
const includes = ['thirdParties', 'thirdPartyFirstConnection', 'thirdPartyLastConnection'];
const salon = await this.salonService.paginateWithTotalStaff(
{
thirdPartyConnected: Number(thirdPartyConnected),
ids,
keyword,
email,
thirdPartyCode,
thirdPartyToken,
},
Number(page),
Number(limit),
includes,
);
const transformed = await transform.include(includes).paginate(salon, 'SalonTransformer');
response.success(transformed);
}
}
module.exports = ILSalonController;
|