hotFix: delete getCurrentWorkerMana #1791
|
@ -318,7 +318,7 @@
|
|||
clear-disabled="true"
|
||||
suffix="%">
|
||||
</vn-input-number>
|
||||
<vn-vertical ng-if="$ctrl.usesMana && $ctrl.currentWorkerMana != 0">
|
||||
<vn-vertical ng-if="$ctrl.usesMana">
|
||||
<vn-radio
|
||||
label="Promotion mana"
|
||||
val="mana"
|
||||
|
|
|
@ -97,14 +97,6 @@ class Controller extends Section {
|
|||
});
|
||||
});
|
||||
this.getUsesMana();
|
||||
this.getCurrentWorkerMana();
|
||||
}
|
||||
|
||||
getCurrentWorkerMana() {
|
||||
this.$http.get(`WorkerManas/getCurrentWorkerMana`)
|
||||
.then(res => {
|
||||
this.currentWorkerMana = res.data;
|
||||
});
|
||||
}
|
||||
|
||||
getUsesMana() {
|
||||
|
|
|
@ -120,12 +120,10 @@ describe('Ticket', () => {
|
|||
const expectedAmount = 250;
|
||||
$httpBackend.expect('GET', 'Tickets/1/getSalesPersonMana').respond(200, expectedAmount);
|
||||
$httpBackend.expect('GET', 'Sales/usesMana').respond(200);
|
||||
$httpBackend.expect('GET', 'WorkerManas/getCurrentWorkerMana').respond(200, expectedAmount);
|
||||
controller.getMana();
|
||||
$httpBackend.flush();
|
||||
|
||||
expect(controller.edit.mana).toEqual(expectedAmount);
|
||||
expect(controller.currentWorkerMana).toEqual(expectedAmount);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -1,26 +0,0 @@
|
|||
module.exports = Self => {
|
||||
Self.remoteMethodCtx('getCurrentWorkerMana', {
|
||||
description: 'Returns the mana of the logged worker',
|
||||
accessType: 'READ',
|
||||
accepts: [],
|
||||
returns: {
|
||||
type: 'number',
|
||||
root: true
|
||||
},
|
||||
http: {
|
||||
path: `/getCurrentWorkerMana`,
|
||||
verb: 'GET'
|
||||
}
|
||||
});
|
||||
|
||||
Self.getCurrentWorkerMana = async ctx => {
|
||||
let userId = ctx.req.accessToken.userId;
|
||||
|
||||
let workerMana = await Self.app.models.WorkerMana.findOne({
|
||||
where: {workerFk: userId},
|
||||
fields: 'amount'
|
||||
});
|
||||
|
||||
return workerMana ? workerMana.amount : 0;
|
||||
};
|
||||
};
|
|
@ -1,15 +0,0 @@
|
|||
const app = require('vn-loopback/server/server');
|
||||
|
||||
describe('workerMana getCurrentWorkerMana()', () => {
|
||||
it('should get the mana of the logged worker', async() => {
|
||||
let mana = await app.models.WorkerMana.getCurrentWorkerMana({req: {accessToken: {userId: 18}}});
|
||||
|
||||
expect(mana).toEqual(124);
|
||||
});
|
||||
|
||||
it('should return 0 if the user doesnt uses mana', async() => {
|
||||
let mana = await app.models.WorkerMana.getCurrentWorkerMana({req: {accessToken: {userId: 9}}});
|
||||
|
||||
expect(mana).toEqual(0);
|
||||
});
|
||||
});
|
|
@ -1,3 +0,0 @@
|
|||
module.exports = Self => {
|
||||
require('../methods/worker-mana/getCurrentWorkerMana')(Self);
|
||||
};
|
Loading…
Reference in New Issue