Skip to content

Commit 7972734

Browse files
authored
Merge pull request #92 from IntersectMBO/dev
From Dev to QA
2 parents 1ec68df + b6b3f07 commit 7972734

File tree

2 files changed

+32
-16
lines changed

2 files changed

+32
-16
lines changed

.github/workflows/publish-to-npm.yaml

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,25 @@ jobs:
2222
registry-url: "https://registry.npmjs.org"
2323
scope: "@intersect.mbo"
2424

25+
- name: Authenticate with Scoped NPM
26+
env:
27+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
28+
registry-url: "https://registry.npmjs.org"
29+
scope: "@intersect.mbo"
30+
run: |
31+
npm config set //registry.npmjs.org/:_authToken=$NPM_TOKEN
32+
npm config set scope "@intersect.mbo"
33+
npm whoami
34+
35+
- name: Check NPM Authentication
36+
run: npm whoami
37+
2538
- name: Install dependencies
2639
run: npm ci
2740
env:
28-
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
41+
NODE_OPTIONS: --max_old_space_size=8192
2942

3043
- name: Publish to npm
31-
run: npm publish
44+
run: npm publish --access public
3245
env:
33-
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
46+
NODE_OPTIONS: --max_old_space_size=8192

backend/src/api/proposal/controllers/proposal.js

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ module.exports = createCoreController(
2020
"api::proposal.proposal",
2121
({ strapi }) => ({
2222
async find(ctx) {
23-
const sanitizedQueryParams = ctx.query
24-
23+
24+
const sanitizedQueryParams = ctx.query;
2525
if (!sanitizedQueryParams.filters) {
2626
sanitizedQueryParams.filters = {};
2727
}
@@ -31,10 +31,11 @@ module.exports = createCoreController(
3131
}
3232

3333
/////GOV ACTION TYPE///////////
34+
3435
const hasGovActionTypeIDFilter = sanitizedQueryParams.filters["$and"]?.find(
3536
(elem) => elem?.hasOwnProperty("gov_action_type_id")
3637
);
37-
38+
3839
if (hasGovActionTypeIDFilter) {
3940
const hasGovActionTypeIDFilterInSanitize =
4041
sanitizedQueryParams?.filters["$and"]?.some((elem) =>
@@ -47,7 +48,6 @@ module.exports = createCoreController(
4748
}
4849
}
4950
//////////////////////////
50-
5151
/////PROPOSAL NAME///////////
5252
const hasPropNameFilter = ctx?.query?.filters["$and"]?.find((elem) =>
5353
elem?.hasOwnProperty("prop_name")
@@ -64,7 +64,6 @@ module.exports = createCoreController(
6464
}
6565
}
6666
//////////////////////////////
67-
6867
/////PROPOSAL SUBMITTED///////////
6968
const hasPropSubmitedFilter = ctx?.query?.filters["$and"]?.find((elem) =>
7069
elem?.hasOwnProperty("prop_submitted")
@@ -96,7 +95,6 @@ module.exports = createCoreController(
9695
}
9796
}
9897
//////////////////////////////
99-
10098
/////PROPOSAL ID///////////
10199
const hasPropIdFilter = ctx?.query?.filters["$and"]?.find((elem) =>
102100
elem?.hasOwnProperty("prop_id")
@@ -122,17 +120,14 @@ module.exports = createCoreController(
122120
});
123121
}
124122
//////////////////////////////
125-
126123
/////IS DRAFT///////////
127124
const hasIsDraftFilter = ctx?.query?.filters["$and"]?.find((elem) =>
128125
elem?.hasOwnProperty("is_draft")
129126
);
130-
131127
if (hasIsDraftFilter) {
132-
if (!ctx?.state?.user) {
133-
return ctx.badRequest(null, "User is required");
134-
}
135-
128+
if (!ctx?.state?.user) {
129+
return ctx.badRequest(null, "User is required");
130+
}
136131
const hasIsDraftFilterInSanitize = sanitizedQueryParams?.filters[
137132
"$and"
138133
]?.some((elem) => elem?.hasOwnProperty("is_draft"));
@@ -142,6 +137,14 @@ module.exports = createCoreController(
142137
user_id: ctx?.state?.user?.id,
143138
});
144139
}
140+
const hasUserFilterInSanitize = sanitizedQueryParams?.filters[
141+
"$and"
142+
]?.some((elem) => elem?.hasOwnProperty("user_id"));
143+
if(!hasUserFilterInSanitize){
144+
sanitizedQueryParams.filters["$and"].push({
145+
user_id: ctx?.state?.user?.id,
146+
})
147+
};
145148
} else {
146149
sanitizedQueryParams.filters["$and"].push({
147150
is_draft: false,
@@ -176,7 +179,7 @@ module.exports = createCoreController(
176179
proposal.content = transformedProposalContent?.data;
177180
proposalsList.push(proposal);
178181
}
179-
182+
console.log(JSON.stringify(sanitizedQueryParams), "params");
180183
return this.transformResponse(proposalsList, { pagination });
181184
},
182185
async findOne(ctx) {

0 commit comments

Comments
 (0)