Skip to content

Commit

Permalink
Merge pull request #109 from IntersectMBO/pre-prod
Browse files Browse the repository at this point in the history
From Pre prod to MAIN
  • Loading branch information
Nemanzh authored Aug 22, 2024
2 parents 66c715a + b2ae474 commit 23374ac
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 6 deletions.
3 changes: 3 additions & 0 deletions backend/lint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

echo "no lint"
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
"info": {
"singularName": "governance-action-type",
"pluralName": "governance-action-types",
"displayName": "Governance action type"
"displayName": "Governance action type",
"description": ""
},
"options": {
"draftAndPublish": false
"draftAndPublish": true
},
"pluginOptions": {},
"attributes": {
Expand Down
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 });
},
})
);
4 changes: 3 additions & 1 deletion backend/types/generated/contentTypes.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -873,9 +873,10 @@ export interface ApiGovernanceActionTypeGovernanceActionType
singularName: 'governance-action-type';
pluralName: 'governance-action-types';
displayName: 'Governance action type';
description: '';
};
options: {
draftAndPublish: false;
draftAndPublish: true;
};
attributes: {
gov_action_type_name: Attribute.String &
Expand All @@ -885,6 +886,7 @@ export interface ApiGovernanceActionTypeGovernanceActionType
}>;
createdAt: Attribute.DateTime;
updatedAt: Attribute.DateTime;
publishedAt: Attribute.DateTime;
createdBy: Attribute.Relation<
'api::governance-action-type.governance-action-type',
'oneToOne',
Expand Down
3 changes: 3 additions & 0 deletions backend/unit-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

echo "unit tests"

0 comments on commit 23374ac

Please sign in to comment.