From e50c67c3058bacb56c7964a0c52dc5d9aaff1109 Mon Sep 17 00:00:00 2001 From: guillermo Date: Thu, 29 Aug 2024 12:22:29 +0200 Subject: [PATCH] feat: refs #7905 Added new method getBuysCsv --- db/versions/11206-turquoiseCyca/00-firstScript.sql | 2 +- modules/entry/back/methods/entry/getBuysCsv.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/db/versions/11206-turquoiseCyca/00-firstScript.sql b/db/versions/11206-turquoiseCyca/00-firstScript.sql index c1d63fcec..ab6b35a0f 100644 --- a/db/versions/11206-turquoiseCyca/00-firstScript.sql +++ b/db/versions/11206-turquoiseCyca/00-firstScript.sql @@ -1,2 +1,2 @@ -INSERT INTO salix.ACL (model,property,principalId) +INSERT IGNORE INTO salix.ACL (model,property,principalId) VALUES ('Entry','getBuysCsv','supplier'); diff --git a/modules/entry/back/methods/entry/getBuysCsv.js b/modules/entry/back/methods/entry/getBuysCsv.js index 76b9cdc57..541179a1d 100644 --- a/modules/entry/back/methods/entry/getBuysCsv.js +++ b/modules/entry/back/methods/entry/getBuysCsv.js @@ -2,8 +2,8 @@ const UserError = require('vn-loopback/util/user-error'); const {toCSV} = require('vn-loopback/util/csv'); module.exports = Self => { - Self.remoteMethodCtx('getBuys', { - description: 'Returns buys for one entry', + Self.remoteMethodCtx('getBuysCsv', { + description: 'Returns buys for one entry in CSV file format', accessType: 'READ', accepts: [{ arg: 'id', @@ -34,7 +34,7 @@ module.exports = Self => { } }); - Self.getBuys = async(ctx, id, options) => { + Self.getBuysCsv = async(ctx, id, options) => { const userId = ctx.req.accessToken.userId; const models = Self.app.models; const myOptions = {};