Skip to content
This repository was archived by the owner on Mar 7, 2025. It is now read-only.

Commit 23374ac

Browse files
authored
Merge pull request #109 from IntersectMBO/pre-prod
From Pre prod to MAIN
2 parents 66c715a + b2ae474 commit 23374ac

File tree

5 files changed

+68
-6
lines changed

5 files changed

+68
-6
lines changed

backend/lint.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/sh
2+
3+
echo "no lint"

backend/src/api/governance-action-type/content-types/governance-action-type/schema.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@
44
"info": {
55
"singularName": "governance-action-type",
66
"pluralName": "governance-action-types",
7-
"displayName": "Governance action type"
7+
"displayName": "Governance action type",
8+
"description": ""
89
},
910
"options": {
10-
"draftAndPublish": false
11+
"draftAndPublish": true
1112
},
1213
"pluginOptions": {},
1314
"attributes": {
Lines changed: 56 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,62 @@
1-
'use strict';
1+
// @ts-nocheck
2+
"use strict";
23

34
/**
45
* governance-action-type controller
56
*/
67

7-
const { createCoreController } = require('@strapi/strapi').factories;
8+
const axios = require("axios");
9+
const { createCoreController } = require("@strapi/strapi").factories;
810

9-
module.exports = createCoreController('api::governance-action-type.governance-action-type');
11+
module.exports = createCoreController(
12+
"api::governance-action-type.governance-action-type",
13+
({ strapi }) => ({
14+
async find(ctx) {
15+
const sanitizedQueryParams = await this.sanitizeQuery(ctx);
16+
17+
try {
18+
const { data } = await axios.get(
19+
`${process.env.GOVTOOL_API_BASE_URL}/epoch/params`
20+
);
21+
22+
if (data) {
23+
if (!sanitizedQueryParams.filters) {
24+
sanitizedQueryParams.filters = {};
25+
}
26+
27+
if (+data?.protocol_major < 9) {
28+
sanitizedQueryParams.filters = {
29+
...sanitizedQueryParams.filters,
30+
$and: [
31+
{
32+
gov_action_type_name: {
33+
$ne: "Treasury",
34+
},
35+
},
36+
{
37+
gov_action_type_name: {
38+
$ne: "Info",
39+
},
40+
},
41+
],
42+
};
43+
}
44+
if (+data?.protocol_major === 9) {
45+
sanitizedQueryParams.filters = {
46+
...sanitizedQueryParams.filters,
47+
gov_action_type_name: {
48+
$ne: "Treasury",
49+
},
50+
};
51+
}
52+
}
53+
} catch (error) {}
54+
55+
const { results, pagination } = await strapi
56+
.service("api::governance-action-type.governance-action-type")
57+
.find(sanitizedQueryParams);
58+
59+
return this.transformResponse(results, { pagination });
60+
},
61+
})
62+
);

backend/types/generated/contentTypes.d.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -873,9 +873,10 @@ export interface ApiGovernanceActionTypeGovernanceActionType
873873
singularName: 'governance-action-type';
874874
pluralName: 'governance-action-types';
875875
displayName: 'Governance action type';
876+
description: '';
876877
};
877878
options: {
878-
draftAndPublish: false;
879+
draftAndPublish: true;
879880
};
880881
attributes: {
881882
gov_action_type_name: Attribute.String &
@@ -885,6 +886,7 @@ export interface ApiGovernanceActionTypeGovernanceActionType
885886
}>;
886887
createdAt: Attribute.DateTime;
887888
updatedAt: Attribute.DateTime;
889+
publishedAt: Attribute.DateTime;
888890
createdBy: Attribute.Relation<
889891
'api::governance-action-type.governance-action-type',
890892
'oneToOne',

backend/unit-test.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/sh
2+
3+
echo "unit tests"

0 commit comments

Comments
 (0)