Skip to content

Commit

Permalink
Merge pull request #106 from IntersectMBO/dev
Browse files Browse the repository at this point in the history
Into QA from DEV
  • Loading branch information
Nemanzh authored Aug 16, 2024
2 parents ef4c35d + b757633 commit 0cbfb6e
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 11 deletions.
17 changes: 9 additions & 8 deletions .github/workflows/merge.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ jobs:
name: backend
dockerfile: ./backend/Dockerfile
image: ghcr.io/${{ github.repository }}-backend
qovery_container_name: backend

runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -148,15 +149,15 @@ jobs:
# Download and install Qovery CLI
curl -s https://get.qovery.com | bash
qovery application list \
qovery container list \
--organization ${{ vars.ORGANIZATION }} \
--project ${{ vars.PROJECT }} \
--environment $ENVIRONMENT
# qovery service deploy \
# --organization ${{ vars.ORGANIZATION }} \
# --project ${{ vars.PROJECT }} \
# --environment $ENVIRONMENT \
# --service ${{ matrix.name }} \
# --tag ${{ env.TAG }} \
# --watch
qovery container deploy \
--organization ${{ vars.ORGANIZATION }} \
--project ${{ vars.PROJECT }} \
--environment $ENVIRONMENT \
--container ${{ matrix.qovery_container_name }} \
--tag ${{ env.TAG }} \
--watch
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 });
},
})
);

0 comments on commit 0cbfb6e

Please sign in to comment.