-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #109 from IntersectMBO/pre-prod
From Pre prod to MAIN
- Loading branch information
Showing
5 changed files
with
68 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/sh | ||
|
||
echo "no lint" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 56 additions & 3 deletions
59
backend/src/api/governance-action-type/controllers/governance-action-type.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,62 @@ | ||
'use strict'; | ||
// @ts-nocheck | ||
"use strict"; | ||
|
||
/** | ||
* governance-action-type controller | ||
*/ | ||
|
||
const { createCoreController } = require('@strapi/strapi').factories; | ||
const axios = require("axios"); | ||
const { createCoreController } = require("@strapi/strapi").factories; | ||
|
||
module.exports = createCoreController('api::governance-action-type.governance-action-type'); | ||
module.exports = createCoreController( | ||
"api::governance-action-type.governance-action-type", | ||
({ strapi }) => ({ | ||
async find(ctx) { | ||
const sanitizedQueryParams = await this.sanitizeQuery(ctx); | ||
|
||
try { | ||
const { data } = await axios.get( | ||
`${process.env.GOVTOOL_API_BASE_URL}/epoch/params` | ||
); | ||
|
||
if (data) { | ||
if (!sanitizedQueryParams.filters) { | ||
sanitizedQueryParams.filters = {}; | ||
} | ||
|
||
if (+data?.protocol_major < 9) { | ||
sanitizedQueryParams.filters = { | ||
...sanitizedQueryParams.filters, | ||
$and: [ | ||
{ | ||
gov_action_type_name: { | ||
$ne: "Treasury", | ||
}, | ||
}, | ||
{ | ||
gov_action_type_name: { | ||
$ne: "Info", | ||
}, | ||
}, | ||
], | ||
}; | ||
} | ||
if (+data?.protocol_major === 9) { | ||
sanitizedQueryParams.filters = { | ||
...sanitizedQueryParams.filters, | ||
gov_action_type_name: { | ||
$ne: "Treasury", | ||
}, | ||
}; | ||
} | ||
} | ||
} catch (error) {} | ||
|
||
const { results, pagination } = await strapi | ||
.service("api::governance-action-type.governance-action-type") | ||
.find(sanitizedQueryParams); | ||
|
||
return this.transformResponse(results, { pagination }); | ||
}, | ||
}) | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/sh | ||
|
||
echo "unit tests" |