powr-sdk-api 3.1.0 → 3.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -85,9 +85,7 @@ router.post("/toggle", async (req, res) => {
85
85
 
86
86
  // Get all functions entries
87
87
  router.get('/', async (req, res) => {
88
- const {
89
- projectId
90
- } = req.query;
88
+ const projectId = req.projectId;
91
89
  try {
92
90
  const query = {
93
91
  projectId
@@ -116,9 +114,7 @@ router.get('/', async (req, res) => {
116
114
  // Create a new function
117
115
  router.post('/', async (req, res) => {
118
116
  try {
119
- const {
120
- projectId
121
- } = req.query;
117
+ const projectId = req.projectId;
122
118
  if (!projectId) {
123
119
  return res.status(400).json({
124
120
  success: false,
@@ -162,9 +158,7 @@ router.put('/:function', async (req, res) => {
162
158
  const {
163
159
  code
164
160
  } = req.body;
165
- const {
166
- projectId
167
- } = req.query;
161
+ const projectId = req.projectId;
168
162
  if (!projectId) {
169
163
  return res.status(400).json({
170
164
  success: false,
@@ -227,9 +221,7 @@ router.post("/:function", async (req, res) => {
227
221
  const {
228
222
  function: functionName
229
223
  } = req.params;
230
- const {
231
- projectId
232
- } = req.query;
224
+ const projectId = req.projectId;
233
225
  if (!projectId) {
234
226
  return res.status(400).json({
235
227
  success: false,
@@ -9,9 +9,7 @@ const {
9
9
  ObjectId
10
10
  } = require("mongodb");
11
11
  router.get('/', async (req, res) => {
12
- const {
13
- projectId
14
- } = req.query;
12
+ const projectId = req.projectId;
15
13
  try {
16
14
  const query = {
17
15
  projectId
@@ -40,9 +38,7 @@ router.get('/:invoiceId', async (req, res) => {
40
38
  const {
41
39
  invoiceId
42
40
  } = req.params;
43
- const {
44
- projectId
45
- } = req.query;
41
+ const projectId = req.projectId;
46
42
  try {
47
43
  if (!projectId) {
48
44
  return res.status(400).json({
@@ -69,9 +65,7 @@ router.get('/:invoiceId', async (req, res) => {
69
65
  }
70
66
  });
71
67
  router.post('/', async (req, res) => {
72
- const {
73
- projectId
74
- } = req.query;
68
+ const projectId = req.projectId;
75
69
  const {
76
70
  invoiceNumber,
77
71
  dateOfIssue,
@@ -124,9 +118,7 @@ router.put('/:invoiceId', async (req, res) => {
124
118
  const {
125
119
  invoiceId
126
120
  } = req.params;
127
- const {
128
- projectId
129
- } = req.query;
121
+ const projectId = req.projectId;
130
122
  if (!projectId) {
131
123
  return res.status(400).json({
132
124
  success: false,
@@ -9,9 +9,7 @@ const {
9
9
 
10
10
  // Get notifications
11
11
  router.get('/', async (req, res) => {
12
- const {
13
- projectId
14
- } = req.query;
12
+ const projectId = req.projectId;
15
13
  try {
16
14
  const query = {
17
15
  projectId
@@ -44,12 +42,12 @@ router.get('/', async (req, res) => {
44
42
  // Send notification
45
43
  router.post('/', async (req, res) => {
46
44
  const {
47
- projectId,
48
45
  title,
49
46
  description,
50
47
  filter,
51
48
  imgurl
52
49
  } = req.body;
50
+ const projectId = req.projectId;
53
51
  if (typeof filter !== 'object' || Array.isArray(filter) || filter === null) {
54
52
  return res.status(400).json({
55
53
  success: false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "powr-sdk-api",
3
- "version": "3.1.0",
3
+ "version": "3.1.2",
4
4
  "description": "Shared API core library for PowrStack projects",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",