module.exports = Self => {
    Self.remoteMethod('getVolume', {
        description: 'Returns the volumes of a ticket',
        accessType: 'READ',
        accepts: [{
            arg: 'id',
            type: 'number',
            required: true,
            description: 'ticket id',
            http: {source: 'path'}
        }],
        returns: {
            arg: 'volumes'
        },
        http: {
            path: `/:id/getVolume`,
            verb: 'GET'
        }
    });

    Self.getVolume = async ticketFk => {
        let [volume] = await Self.rawSql(`CALL vn.ticketListVolume(?)`, [ticketFk]);
        return volume;
    };
};