refator: endpoint name
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
abd2d9a849
commit
39f4445172
|
@ -1,3 +1,7 @@
|
|||
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
|
||||
VALUES
|
||||
('InvoiceOut', 'clientToInvoice', 'WRITE', 'ALLOW', 'ROLE', 'invoicing');
|
||||
('InvoiceOut', 'clientToInvoice', 'WRITE', 'ALLOW', 'ROLE', 'invoicing');
|
||||
|
||||
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
|
||||
VALUES
|
||||
('InvoiceOut', 'invoiceClient', 'WRITE', 'ALLOW', 'ROLE', 'invoicing');
|
|
@ -1,5 +1,5 @@
|
|||
module.exports = Self => {
|
||||
Self.remoteMethodCtx('globalInvoicing', {
|
||||
Self.remoteMethodCtx('invoiceClient', {
|
||||
description: 'Make a invoice of a client',
|
||||
accessType: 'WRITE',
|
||||
accepts: [{
|
||||
|
@ -43,12 +43,12 @@ module.exports = Self => {
|
|||
root: true
|
||||
},
|
||||
http: {
|
||||
path: '/globalInvoicing',
|
||||
path: '/invoiceClient',
|
||||
verb: 'POST'
|
||||
}
|
||||
});
|
||||
|
||||
Self.globalInvoicing = async(ctx, options) => {
|
||||
Self.invoiceClient = async(ctx, options) => {
|
||||
const args = ctx.args;
|
||||
const models = Self.app.models;
|
||||
const myOptions = {};
|
|
@ -1,6 +1,6 @@
|
|||
const models = require('vn-loopback/server/server').models;
|
||||
|
||||
describe('InvoiceOut globalInvoicing()', () => {
|
||||
describe('InvoiceOut invoiceClient()', () => {
|
||||
const userId = 1;
|
||||
const clientId = 1101;
|
||||
const addressId = 121;
|
||||
|
@ -34,7 +34,7 @@ describe('InvoiceOut globalInvoicing()', () => {
|
|||
companyFk: companyFk,
|
||||
minShipped: minShipped
|
||||
};
|
||||
const invoiceOutId = await models.InvoiceOut.globalInvoicing(ctx, options);
|
||||
const invoiceOutId = await models.InvoiceOut.invoiceClient(ctx, options);
|
||||
const invoiceOut = await models.InvoiceOut.findById(invoiceOutId, null, options);
|
||||
const [firstTicket] = await models.Ticket.find({
|
||||
where: {refFk: invoiceOut.ref}
|
|
@ -8,7 +8,7 @@ module.exports = Self => {
|
|||
require('../methods/invoiceOut/createPdf')(Self);
|
||||
require('../methods/invoiceOut/createManualInvoice')(Self);
|
||||
require('../methods/invoiceOut/clientToInvoice')(Self);
|
||||
require('../methods/invoiceOut/globalInvoicing')(Self);
|
||||
require('../methods/invoiceOut/invoiceClient')(Self);
|
||||
require('../methods/invoiceOut/refund')(Self);
|
||||
require('../methods/invoiceOut/invoiceEmail')(Self);
|
||||
require('../methods/invoiceOut/exportationPdf')(Self);
|
||||
|
|
|
@ -68,7 +68,7 @@ class Controller extends Dialog {
|
|||
timeout: this.canceler.promise
|
||||
};
|
||||
|
||||
return this.$http.post(`InvoiceOuts/globalInvoicing`, params, options)
|
||||
return this.$http.post(`InvoiceOuts/invoiceClient`, params, options)
|
||||
.then(() => {
|
||||
this.pos++;
|
||||
return this.invoiceOut(invoice, clientsAndAddresses);
|
||||
|
|
|
@ -112,7 +112,7 @@ describe('InvoiceOut', () => {
|
|||
const serializedParams = $httpParamSerializer({filter});
|
||||
$httpBackend.expectGET(`Clients/findOne?${serializedParams}`).respond(200, {id: 1112});
|
||||
$httpBackend.expect('POST', `InvoiceOuts/clientToInvoice`).respond(response);
|
||||
$httpBackend.expect('POST', `InvoiceOuts/globalInvoicing`).respond({id: 1});
|
||||
$httpBackend.expect('POST', `InvoiceOuts/invoiceClient`).respond({id: 1});
|
||||
controller.responseHandler('accept');
|
||||
$httpBackend.flush();
|
||||
|
||||
|
|
Loading…
Reference in New Issue