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 83 84 85 86 87 88 89 90 91 92 | 1x 1x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 1x | 'use strict';
const configs = use('Config').get('modules.staff.general');
const namespace = configs.namespace;
class ILStaffScheduleController {
static get inject() {
return [
`${namespace}/Services/StaffService`,
`${namespace}/Services/SalonService`,
`${namespace}/Services/SettingService`,
'C2C/Services/QueueService',
`C2C/Services/SalonService`,
];
}
constructor(staffService, salonService, settingService, queueService, sharedSalonService) {
this.staffService = staffService;
this.salonService = salonService;
this.settingService = settingService;
this.queue = queueService;
this.sharedSalonService = sharedSalonService;
}
/**
* @swagger
*
* /api/v1/apps/staff/schedules:
* get:
* tags:
* - staff
* operationId: 'getScheduleByIL'
* summary: 'getScheduleByIL'
* description: 'get all schedule of staff by IL'
* parameters:
* - $ref: '#/components/parameters/PageParam'
* - $ref: '#/components/parameters/LimitParam'
* - $ref: '#/components/parameters/ActiveParam'
* - $ref: '#/components/parameters/SortParam'
* - $ref: '#/components/parameters/FromParam'
* - $ref: '#/components/parameters/ToParam'
* - $ref: '#/components/parameters/ConnectionStatusParam'
* - $ref: '#/components/parameters/TypeParam'
* - $ref: '#/components/parameters/IdsParam'
* responses:
* 200:
* description: |-
* A pagination object contain array of schedules
* content:
* application/json; charset=utf-8:
* schema:
* $ref: '#/components/schemas/StaffSchedulePaginationResponse'
* 401:
* $ref: '#/components/responses/Unauthorized'
* 403:
* $ref: '#/components/responses/Forbidden'
* 404:
* $ref: '#/components/responses/NotFound'
* deprecated: false
* security:
* - BasicAuth: []
*/
async index({ request, response, transform }) {
const page = request.input('page', 1);
const limit = request.input('limit', 20);
const sort = request.input('sort', 'createdAt desc');
const active = request.input('active');
const from = request.input('from');
const to = request.input('to');
const connectionStatus = request.input('connectionStatus');
const type = request.input('type', 0);
const ids = request.input('ids');
const staffWithSchedule = await this.staffService.findByPageWithSchedule({
page: Number(page),
limit: Number(limit),
sort,
active,
from,
to,
connectionStatus,
type,
ids,
});
const data = await transform.paginate(staffWithSchedule, 'StaffScheduleTransformer');
return response.success(data);
}
}
module.exports = ILStaffScheduleController;
|