From 8da6199246ca4ba576e2319001283cae9baac6dd Mon Sep 17 00:00:00 2001 From: nebojsajsimic <6024893+nebojsajsimic@users.noreply.github.com> Date: Tue, 27 May 2025 10:05:55 +0200 Subject: [PATCH 01/25] Added Hard fork GA BE --- .../proposal-content/schema.json | 6 + .../proposal-hard-fork-content/schema.json | 34 ++ .../controllers/proposal-hard-fork-content.js | 9 + .../1.0.0/proposal-hard-fork-content.json | 507 ++++++++++++++++++ .../routes/proposal-hard-fork-content.js | 9 + .../services/proposal-hard-fork-content.js | 9 + 6 files changed, 574 insertions(+) create mode 100644 backend/src/api/proposal-hard-fork-content/content-types/proposal-hard-fork-content/schema.json create mode 100644 backend/src/api/proposal-hard-fork-content/controllers/proposal-hard-fork-content.js create mode 100644 backend/src/api/proposal-hard-fork-content/documentation/1.0.0/proposal-hard-fork-content.json create mode 100644 backend/src/api/proposal-hard-fork-content/routes/proposal-hard-fork-content.js create mode 100644 backend/src/api/proposal-hard-fork-content/services/proposal-hard-fork-content.js diff --git a/backend/src/api/proposal-content/content-types/proposal-content/schema.json b/backend/src/api/proposal-content/content-types/proposal-content/schema.json index 96407b4..26764cf 100644 --- a/backend/src/api/proposal-content/content-types/proposal-content/schema.json +++ b/backend/src/api/proposal-content/content-types/proposal-content/schema.json @@ -78,6 +78,12 @@ "is_locked": { "type": "boolean", "default": false + }, + "proposal_hard_fork_content": { + "type": "relation", + "relation": "oneToOne", + "target": "api::proposal-hard-fork-content.proposal-hard-fork-content", + "mappedBy": "proposal_content" } } } diff --git a/backend/src/api/proposal-hard-fork-content/content-types/proposal-hard-fork-content/schema.json b/backend/src/api/proposal-hard-fork-content/content-types/proposal-hard-fork-content/schema.json new file mode 100644 index 0000000..0cbba8b --- /dev/null +++ b/backend/src/api/proposal-hard-fork-content/content-types/proposal-hard-fork-content/schema.json @@ -0,0 +1,34 @@ +{ + "kind": "collectionType", + "collectionName": "proposal_hard_fork_contents", + "info": { + "singularName": "proposal-hard-fork-content", + "pluralName": "proposal-hard-fork-contents", + "displayName": "Proposal Hard Fork content", + "description": "" + }, + "options": { + "draftAndPublish": false + }, + "pluginOptions": {}, + "attributes": { + "previous_ga_hash": { + "type": "string" + }, + "previous_ga_id": { + "type": "string" + }, + "major": { + "type": "string" + }, + "minor": { + "type": "string" + }, + "proposal_content": { + "type": "relation", + "relation": "oneToOne", + "target": "api::proposal-content.proposal-content", + "inversedBy": "proposal_hard_fork_content" + } + } +} diff --git a/backend/src/api/proposal-hard-fork-content/controllers/proposal-hard-fork-content.js b/backend/src/api/proposal-hard-fork-content/controllers/proposal-hard-fork-content.js new file mode 100644 index 0000000..f154eb0 --- /dev/null +++ b/backend/src/api/proposal-hard-fork-content/controllers/proposal-hard-fork-content.js @@ -0,0 +1,9 @@ +'use strict'; + +/** + * proposal-hard-fork-content controller + */ + +const { createCoreController } = require('@strapi/strapi').factories; + +module.exports = createCoreController('api::proposal-hard-fork-content.proposal-hard-fork-content'); diff --git a/backend/src/api/proposal-hard-fork-content/documentation/1.0.0/proposal-hard-fork-content.json b/backend/src/api/proposal-hard-fork-content/documentation/1.0.0/proposal-hard-fork-content.json new file mode 100644 index 0000000..92cc06c --- /dev/null +++ b/backend/src/api/proposal-hard-fork-content/documentation/1.0.0/proposal-hard-fork-content.json @@ -0,0 +1,507 @@ +{ + "/proposal-hard-fork-contents": { + "get": { + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProposalHardForkContentListResponse" + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + }, + "tags": [ + "Proposal-hard-fork-content" + ], + "parameters": [ + { + "name": "sort", + "in": "query", + "description": "Sort by attributes ascending (asc) or descending (desc)", + "deprecated": false, + "required": false, + "schema": { + "type": "string" + } + }, + { + "name": "pagination[withCount]", + "in": "query", + "description": "Return page/pageSize (default: true)", + "deprecated": false, + "required": false, + "schema": { + "type": "boolean" + } + }, + { + "name": "pagination[page]", + "in": "query", + "description": "Page number (default: 0)", + "deprecated": false, + "required": false, + "schema": { + "type": "integer" + } + }, + { + "name": "pagination[pageSize]", + "in": "query", + "description": "Page size (default: 25)", + "deprecated": false, + "required": false, + "schema": { + "type": "integer" + } + }, + { + "name": "pagination[start]", + "in": "query", + "description": "Offset value (default: 0)", + "deprecated": false, + "required": false, + "schema": { + "type": "integer" + } + }, + { + "name": "pagination[limit]", + "in": "query", + "description": "Number of entities to return (default: 25)", + "deprecated": false, + "required": false, + "schema": { + "type": "integer" + } + }, + { + "name": "fields", + "in": "query", + "description": "Fields to return (ex: title,author)", + "deprecated": false, + "required": false, + "schema": { + "type": "string" + } + }, + { + "name": "populate", + "in": "query", + "description": "Relations to return", + "deprecated": false, + "required": false, + "schema": { + "type": "string" + } + }, + { + "name": "filters", + "in": "query", + "description": "Filters to apply", + "deprecated": false, + "required": false, + "schema": { + "type": "object" + }, + "style": "deepObject" + }, + { + "name": "locale", + "in": "query", + "description": "Locale to apply", + "deprecated": false, + "required": false, + "schema": { + "type": "string" + } + } + ], + "operationId": "get/proposal-hard-fork-contents" + }, + "post": { + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProposalHardForkContentResponse" + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + }, + "tags": [ + "Proposal-hard-fork-content" + ], + "parameters": [], + "operationId": "post/proposal-hard-fork-contents", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProposalHardForkContentRequest" + } + } + } + } + } + }, + "/proposal-hard-fork-contents/{id}": { + "get": { + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProposalHardForkContentResponse" + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + }, + "tags": [ + "Proposal-hard-fork-content" + ], + "parameters": [ + { + "name": "id", + "in": "path", + "description": "", + "deprecated": false, + "required": true, + "schema": { + "type": "number" + } + } + ], + "operationId": "get/proposal-hard-fork-contents/{id}" + }, + "put": { + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProposalHardForkContentResponse" + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + }, + "tags": [ + "Proposal-hard-fork-content" + ], + "parameters": [ + { + "name": "id", + "in": "path", + "description": "", + "deprecated": false, + "required": true, + "schema": { + "type": "number" + } + } + ], + "operationId": "put/proposal-hard-fork-contents/{id}", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProposalHardForkContentRequest" + } + } + } + } + }, + "delete": { + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + }, + "tags": [ + "Proposal-hard-fork-content" + ], + "parameters": [ + { + "name": "id", + "in": "path", + "description": "", + "deprecated": false, + "required": true, + "schema": { + "type": "number" + } + } + ], + "operationId": "delete/proposal-hard-fork-contents/{id}" + } + } +} diff --git a/backend/src/api/proposal-hard-fork-content/routes/proposal-hard-fork-content.js b/backend/src/api/proposal-hard-fork-content/routes/proposal-hard-fork-content.js new file mode 100644 index 0000000..1739878 --- /dev/null +++ b/backend/src/api/proposal-hard-fork-content/routes/proposal-hard-fork-content.js @@ -0,0 +1,9 @@ +'use strict'; + +/** + * proposal-hard-fork-content router + */ + +const { createCoreRouter } = require('@strapi/strapi').factories; + +module.exports = createCoreRouter('api::proposal-hard-fork-content.proposal-hard-fork-content'); diff --git a/backend/src/api/proposal-hard-fork-content/services/proposal-hard-fork-content.js b/backend/src/api/proposal-hard-fork-content/services/proposal-hard-fork-content.js new file mode 100644 index 0000000..caf0df6 --- /dev/null +++ b/backend/src/api/proposal-hard-fork-content/services/proposal-hard-fork-content.js @@ -0,0 +1,9 @@ +'use strict'; + +/** + * proposal-hard-fork-content service + */ + +const { createCoreService } = require('@strapi/strapi').factories; + +module.exports = createCoreService('api::proposal-hard-fork-content.proposal-hard-fork-content'); From b3576ccb291173572008695331cf950ecd181217 Mon Sep 17 00:00:00 2001 From: nebojsajsimic <6024893+nebojsajsimic@users.noreply.github.com> Date: Tue, 27 May 2025 10:57:35 +0200 Subject: [PATCH 02/25] Added security scheme Add committee member compnent Add Update Proposal content --- .../routes/proposal-hard-fork-content.js | 21 +- .../schema.json | 32 ++ .../proposal-update-committee-content.js | 9 + .../proposal-update-committee-content.json | 507 ++++++++++++++++++ .../proposal-update-committee-content.js | 28 + .../proposal-update-committee-content.js | 9 + .../components/proposal/committee-member.json | 16 + 7 files changed, 621 insertions(+), 1 deletion(-) create mode 100644 backend/src/api/proposal-update-committee-content/content-types/proposal-update-committee-content/schema.json create mode 100644 backend/src/api/proposal-update-committee-content/controllers/proposal-update-committee-content.js create mode 100644 backend/src/api/proposal-update-committee-content/documentation/1.0.0/proposal-update-committee-content.json create mode 100644 backend/src/api/proposal-update-committee-content/routes/proposal-update-committee-content.js create mode 100644 backend/src/api/proposal-update-committee-content/services/proposal-update-committee-content.js create mode 100644 backend/src/components/proposal/committee-member.json diff --git a/backend/src/api/proposal-hard-fork-content/routes/proposal-hard-fork-content.js b/backend/src/api/proposal-hard-fork-content/routes/proposal-hard-fork-content.js index 1739878..c66c3fc 100644 --- a/backend/src/api/proposal-hard-fork-content/routes/proposal-hard-fork-content.js +++ b/backend/src/api/proposal-hard-fork-content/routes/proposal-hard-fork-content.js @@ -6,4 +6,23 @@ const { createCoreRouter } = require('@strapi/strapi').factories; -module.exports = createCoreRouter('api::proposal-hard-fork-content.proposal-hard-fork-content'); +module.exports = createCoreRouter('api::proposal-hard-fork-content.proposal-hard-fork-content', { + config: { + find: { + roles: ["authenticated", "public"], + }, + create: { + roles: ["authenticated"], + }, + findOne: { + roles: ["authenticated", "public"], + }, + update: { + roles: ["authenticated"], + middlewares: ["global::is-owner"], + }, + delete: { + roles: [], + }, + }, +}); diff --git a/backend/src/api/proposal-update-committee-content/content-types/proposal-update-committee-content/schema.json b/backend/src/api/proposal-update-committee-content/content-types/proposal-update-committee-content/schema.json new file mode 100644 index 0000000..a7ab0e4 --- /dev/null +++ b/backend/src/api/proposal-update-committee-content/content-types/proposal-update-committee-content/schema.json @@ -0,0 +1,32 @@ +{ + "kind": "collectionType", + "collectionName": "proposal_update_committee_contents", + "info": { + "singularName": "proposal-update-committee-content", + "pluralName": "proposal-update-committee-contents", + "displayName": "Proposal Update Committee content", + "description": "" + }, + "options": { + "draftAndPublish": false + }, + "pluginOptions": {}, + "attributes": { + "numerator": { + "type": "integer" + }, + "denominator": { + "type": "integer" + }, + "add_members": { + "type": "component", + "repeatable": true, + "component": "proposal.committee-member" + }, + "remove_members": { + "type": "component", + "repeatable": true, + "component": "proposal.committee-member" + } + } +} diff --git a/backend/src/api/proposal-update-committee-content/controllers/proposal-update-committee-content.js b/backend/src/api/proposal-update-committee-content/controllers/proposal-update-committee-content.js new file mode 100644 index 0000000..58d16a1 --- /dev/null +++ b/backend/src/api/proposal-update-committee-content/controllers/proposal-update-committee-content.js @@ -0,0 +1,9 @@ +'use strict'; + +/** + * proposal-update-committee-content controller + */ + +const { createCoreController } = require('@strapi/strapi').factories; + +module.exports = createCoreController('api::proposal-update-committee-content.proposal-update-committee-content'); diff --git a/backend/src/api/proposal-update-committee-content/documentation/1.0.0/proposal-update-committee-content.json b/backend/src/api/proposal-update-committee-content/documentation/1.0.0/proposal-update-committee-content.json new file mode 100644 index 0000000..e6e4a56 --- /dev/null +++ b/backend/src/api/proposal-update-committee-content/documentation/1.0.0/proposal-update-committee-content.json @@ -0,0 +1,507 @@ +{ + "/proposal-update-committee-contents": { + "get": { + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProposalUpdateCommitteeContentListResponse" + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + }, + "tags": [ + "Proposal-update-committee-content" + ], + "parameters": [ + { + "name": "sort", + "in": "query", + "description": "Sort by attributes ascending (asc) or descending (desc)", + "deprecated": false, + "required": false, + "schema": { + "type": "string" + } + }, + { + "name": "pagination[withCount]", + "in": "query", + "description": "Return page/pageSize (default: true)", + "deprecated": false, + "required": false, + "schema": { + "type": "boolean" + } + }, + { + "name": "pagination[page]", + "in": "query", + "description": "Page number (default: 0)", + "deprecated": false, + "required": false, + "schema": { + "type": "integer" + } + }, + { + "name": "pagination[pageSize]", + "in": "query", + "description": "Page size (default: 25)", + "deprecated": false, + "required": false, + "schema": { + "type": "integer" + } + }, + { + "name": "pagination[start]", + "in": "query", + "description": "Offset value (default: 0)", + "deprecated": false, + "required": false, + "schema": { + "type": "integer" + } + }, + { + "name": "pagination[limit]", + "in": "query", + "description": "Number of entities to return (default: 25)", + "deprecated": false, + "required": false, + "schema": { + "type": "integer" + } + }, + { + "name": "fields", + "in": "query", + "description": "Fields to return (ex: title,author)", + "deprecated": false, + "required": false, + "schema": { + "type": "string" + } + }, + { + "name": "populate", + "in": "query", + "description": "Relations to return", + "deprecated": false, + "required": false, + "schema": { + "type": "string" + } + }, + { + "name": "filters", + "in": "query", + "description": "Filters to apply", + "deprecated": false, + "required": false, + "schema": { + "type": "object" + }, + "style": "deepObject" + }, + { + "name": "locale", + "in": "query", + "description": "Locale to apply", + "deprecated": false, + "required": false, + "schema": { + "type": "string" + } + } + ], + "operationId": "get/proposal-update-committee-contents" + }, + "post": { + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProposalUpdateCommitteeContentResponse" + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + }, + "tags": [ + "Proposal-update-committee-content" + ], + "parameters": [], + "operationId": "post/proposal-update-committee-contents", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProposalUpdateCommitteeContentRequest" + } + } + } + } + } + }, + "/proposal-update-committee-contents/{id}": { + "get": { + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProposalUpdateCommitteeContentResponse" + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + }, + "tags": [ + "Proposal-update-committee-content" + ], + "parameters": [ + { + "name": "id", + "in": "path", + "description": "", + "deprecated": false, + "required": true, + "schema": { + "type": "number" + } + } + ], + "operationId": "get/proposal-update-committee-contents/{id}" + }, + "put": { + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProposalUpdateCommitteeContentResponse" + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + }, + "tags": [ + "Proposal-update-committee-content" + ], + "parameters": [ + { + "name": "id", + "in": "path", + "description": "", + "deprecated": false, + "required": true, + "schema": { + "type": "number" + } + } + ], + "operationId": "put/proposal-update-committee-contents/{id}", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProposalUpdateCommitteeContentRequest" + } + } + } + } + }, + "delete": { + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + }, + "tags": [ + "Proposal-update-committee-content" + ], + "parameters": [ + { + "name": "id", + "in": "path", + "description": "", + "deprecated": false, + "required": true, + "schema": { + "type": "number" + } + } + ], + "operationId": "delete/proposal-update-committee-contents/{id}" + } + } +} diff --git a/backend/src/api/proposal-update-committee-content/routes/proposal-update-committee-content.js b/backend/src/api/proposal-update-committee-content/routes/proposal-update-committee-content.js new file mode 100644 index 0000000..39ed9d2 --- /dev/null +++ b/backend/src/api/proposal-update-committee-content/routes/proposal-update-committee-content.js @@ -0,0 +1,28 @@ +'use strict'; + +/** + * proposal-update-committee-content router + */ + +const { createCoreRouter } = require('@strapi/strapi').factories; + +module.exports = createCoreRouter('api::proposal-update-committee-content.proposal-update-committee-content', { + config: { + find: { + roles: ["authenticated", "public"], + }, + create: { + roles: ["authenticated"], + }, + findOne: { + roles: ["authenticated", "public"], + }, + update: { + roles: ["authenticated"], + middlewares: ["global::is-owner"], + }, + delete: { + roles: [], + }, + }, +}); diff --git a/backend/src/api/proposal-update-committee-content/services/proposal-update-committee-content.js b/backend/src/api/proposal-update-committee-content/services/proposal-update-committee-content.js new file mode 100644 index 0000000..845bf90 --- /dev/null +++ b/backend/src/api/proposal-update-committee-content/services/proposal-update-committee-content.js @@ -0,0 +1,9 @@ +'use strict'; + +/** + * proposal-update-committee-content service + */ + +const { createCoreService } = require('@strapi/strapi').factories; + +module.exports = createCoreService('api::proposal-update-committee-content.proposal-update-committee-content'); diff --git a/backend/src/components/proposal/committee-member.json b/backend/src/components/proposal/committee-member.json new file mode 100644 index 0000000..9cbbaff --- /dev/null +++ b/backend/src/components/proposal/committee-member.json @@ -0,0 +1,16 @@ +{ + "collectionName": "components_proposal_committee_members", + "info": { + "displayName": "Committee_member", + "description": "" + }, + "options": {}, + "attributes": { + "address_hash": { + "type": "string" + }, + "epoch": { + "type": "integer" + } + } +} From 3c59973aaf7d65cbb2634e89e45f4ad11b2c9865 Mon Sep 17 00:00:00 2001 From: nebojsajsimic <6024893+nebojsajsimic@users.noreply.github.com> Date: Fri, 30 May 2025 12:25:13 +0200 Subject: [PATCH 03/25] added proxy and govtool proxy --- backend/src/api/proxy/controllers/proxy.js | 69 +++++++++++++++++++ .../api/proxy/documentation/1.0.0/proxy.json | 1 + backend/src/api/proxy/routes/proxy.js | 33 +++++++++ 3 files changed, 103 insertions(+) create mode 100644 backend/src/api/proxy/controllers/proxy.js create mode 100644 backend/src/api/proxy/documentation/1.0.0/proxy.json create mode 100644 backend/src/api/proxy/routes/proxy.js diff --git a/backend/src/api/proxy/controllers/proxy.js b/backend/src/api/proxy/controllers/proxy.js new file mode 100644 index 0000000..3de9bd3 --- /dev/null +++ b/backend/src/api/proxy/controllers/proxy.js @@ -0,0 +1,69 @@ +'use strict'; +const axios = require('axios'); + +module.exports = { + // POST /proxy + async forward(ctx) { + try { + console.log(ctx.request.body); + const { url, method = 'GET', data = {}, params = {}, headers = {} } = ctx.request.body; + const response = await axios({ url, method, data, params, headers }); + ctx.send({ status: response.status, data: response.data }); + } catch (error) { + strapi.log.error('Proxy error:', error); + ctx.status = error.response?.status || 500; + ctx.body = { error: error.message, details: error.response?.data || null }; + } + }, + + // GET /proxy/govtool/:endpoint* + async getGovtoolData(ctx) { + try { + + const endpoint = ctx.params.endpoint; + if (!endpoint) return ctx.badRequest('Endpoint is required'); + console.log(endpoint); + const baseUrl = process.env.GOVTOOL_API_BASE_URL; + const fullUrl = `${baseUrl.replace(/\/$/, '')}/${endpoint}`; +console.log(fullUrl); + const response = await axios.get(fullUrl, { + params: ctx.query, + headers: { + // Authorization: `Bearer ${process.env.GOVTOOL_API_TOKEN}`, + }, + }); + + ctx.send({ status: response.status, data: response.data }); + } catch (error) { + strapi.log.error('GovTool GET error:', error); + ctx.status = error.response?.status || 500; + ctx.body = { error: error.message, details: error.response?.data || null }; + } + }, + + async postGovtoolData(ctx) { + try { + const endpoint = ctx.params.endpoint; + if (!endpoint) return ctx.badRequest('Endpoint is required'); + + const baseUrl = process.env.GOVTOOL_API_BASE_URL; + const fullUrl = `${baseUrl.replace(/\/$/, '')}/${endpoint}`; + + const response = await axios.post(fullUrl, ctx.request.body, { + headers: { + 'Content-Type': 'application/json', + // Authorization: `Bearer ${process.env.GOVTOOL_API_TOKEN}`, + }, + }); + + ctx.send({ status: response.status, data: response.data }); + } catch (error) { + strapi.log.error('GovTool POST error:', error); + ctx.status = error.response?.status || 500; + ctx.body = { + error: error.message, + details: error.response?.data || null, + }; + } + } +}; \ No newline at end of file diff --git a/backend/src/api/proxy/documentation/1.0.0/proxy.json b/backend/src/api/proxy/documentation/1.0.0/proxy.json new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/backend/src/api/proxy/documentation/1.0.0/proxy.json @@ -0,0 +1 @@ +{} diff --git a/backend/src/api/proxy/routes/proxy.js b/backend/src/api/proxy/routes/proxy.js new file mode 100644 index 0000000..adc9570 --- /dev/null +++ b/backend/src/api/proxy/routes/proxy.js @@ -0,0 +1,33 @@ +'use strict'; + +module.exports = { + routes: [ + { + method: 'POST', + path: '/proxy', + handler: 'proxy.forward', + config: { + roles: ['authenticated', 'public'], + auth: false + }, + }, + { + method: 'GET', + path: '/proxy/govtool/:endpoint*', + handler: 'proxy.getGovtoolData', + config: { + roles: ['authenticated', 'public'], + auth: false + }, + }, + { + method: 'POST', + path: '/proxy/govtool/:endpoint*', + handler: 'proxy.postGovtoolData', + config: { + roles: ['authenticated', 'public'], + auth: false + }, + }, + ], +}; From a133800eeb2e07b76d21ac969d7aad78b784909e Mon Sep 17 00:00:00 2001 From: Milos Mihajlovic Date: Fri, 30 May 2025 14:47:27 +0200 Subject: [PATCH 04/25] feat: merge with latest dev, implement hard fork GA --- .../api/migration/controllers/migration.js | 1718 ++-- backend/src/api/migration/routes/migration.js | 109 +- .../proposal-content/schema.json | 6 + .../content-types/proposal/schema.json | 6 + .../src/api/proposal/controllers/proposal.js | 1226 ++- backend/src/api/proxy/controllers/proxy.js | 71 +- backend/src/components/bd/bd-links.json | 6 +- .../components/proposal/proposal-link.json | 15 +- .../1.0.0/full_documentation.json | 8175 +++++++++++++---- .../components/BudgetDiscussionCard/index.jsx | 36 +- .../AdministrationAndAuditing/index.jsx | 4 + .../BudgetDiscussionLinkManager.jsx | 282 +- .../BudgetDiscussionReview/index.jsx | 15 +- .../index.jsx | 6 + .../ProposalOwnership/index.jsx | 41 +- .../StepperActionButtons.jsx | 19 +- .../BudgetDiscussionReviewVersions/index.js | 10 +- .../BudgetDiscussionsList/index.jsx | 62 +- .../CreateBudgetDiscussionDialog/index.jsx | 3 + .../CreateGovernanceActionDialog/index.jsx | 99 +- .../HardForkManager.jsx | 183 + .../CreationGoveranceAction/LinkManager.jsx | 42 +- .../CreationGoveranceAction/Step1.jsx | 11 +- .../CreationGoveranceAction/Step2.jsx | 31 +- .../CreationGoveranceAction/Step3.jsx | 129 +- pdf-ui/src/components/ProposalCard/index.jsx | 24 +- pdf-ui/src/components/ProposalsList/index.jsx | 24 +- .../src/components/ReviewVersions/index.jsx | 56 +- .../Steps/StoreDataStep.jsx | 4 +- pdf-ui/src/lib/api.js | 11 + .../SingleBudgetDiscussion/index.jsx | 130 +- .../SingleGovernanceAction/index.jsx | 180 +- .../pages/ProposedGovernanceActions/index.jsx | 135 +- 33 files changed, 9070 insertions(+), 3799 deletions(-) create mode 100644 pdf-ui/src/components/CreationGoveranceAction/HardForkManager.jsx diff --git a/backend/src/api/migration/controllers/migration.js b/backend/src/api/migration/controllers/migration.js index 3c839b8..6e34b46 100644 --- a/backend/src/api/migration/controllers/migration.js +++ b/backend/src/api/migration/controllers/migration.js @@ -37,888 +37,838 @@ function extractLinksFromString(inputString) { } module.exports = { - async migrateCountries(ctx) { - // @ts-ignore - const body = ctx.request.body; - - const data = body?.data; - - const countryList = await strapi.entityService.findMany( - 'api::country-list.country-list' - ); - - if (countryList.length > 0) { - return { - success: false, - message: 'Country List already exists', - }; - } - - for (const country of data) { - try { - await strapi.entityService.create( - 'api::country-list.country-list', - { - data: { - country_name: country.country_name, - alfa_2_code: country.alfa_2_code, - alfa_3_code: country.alfa_3_code, - publishedAt: new Date(), - }, - } - ); - } catch (error) { - console.error( - `Error creating country ${country.country_name}:`, - error - ); - } - } - - return { - success: true, - }; - }, - async migrateCurrencies(ctx) { - // @ts-ignore - const body = ctx.request.body; - - const data = body?.data; - - const currencyList = await strapi.entityService.findMany( - 'api::bd-currency-list.bd-currency-list' - ); - - if (currencyList.length > 0) { - return { - success: false, - message: 'Currency List already exists', - }; - } - for (const currency of data) { - try { - await strapi.entityService.create( - 'api::bd-currency-list.bd-currency-list', - { - data: { - currency_name: currency.currency_name, - currency_letter_code: currency.currency_letter_code, - currency_number_code: currency.currency_number_code, - publishedAt: new Date(), - }, - } - ); - } catch (error) { - console.error( - `Error creating currency ${currency.currency_name}:`, - error - ); - } - } - - return { - success: true, - }; - }, - - async migrateContractTypes(ctx) { - // @ts-ignore - const body = ctx.request.body; - - const data = body?.data; - - const contractTypeList = await strapi.entityService.findMany( - 'api::bd-contract-type.bd-contract-type' - ); - - if (contractTypeList.length > 0) { - return { - success: false, - message: 'Contract Type List already exists', - }; - } - for (const contractType of data) { - try { - await strapi.entityService.create( - 'api::bd-contract-type.bd-contract-type', - { - data: { - contract_type_name: contractType.contract_type_name, - publishedAt: new Date(), - }, - } - ); - } catch (error) { - console.error( - `Error creating contract type ${contractType.contract_type_name}:`, - error - ); - } - } - - return { - success: true, - }; - }, - - async migrateRoadMap(ctx) { - // @ts-ignore - const body = ctx.request.body; - - const data = body?.data; - - const roadMapList = await strapi.entityService.findMany( - 'api::bd-road-map.bd-road-map' - ); - - if (roadMapList.length > 0) { - return { - success: false, - message: 'Road Map List already exists', - }; - } - for (const roadMap of data) { - try { - await strapi.entityService.create( - 'api::bd-road-map.bd-road-map', - { - data: { - roadmap_name: roadMap.roadmap_name, - publishedAt: new Date(), - }, - } - ); - } catch (error) { - console.error( - `Error creating road map ${roadMap.roadmap_name}:`, - error - ); - } - } - - return { - success: true, - }; - }, - - async migrateBdTypes(ctx) { - // @ts-ignore - const body = ctx.request.body; - - const data = body?.data; - - const bdTypeList = await strapi.entityService.findMany( - 'api::bd-type.bd-type' - ); - - if (bdTypeList.length > 0) { - return { - success: false, - message: 'BD Type List already exists', - }; - } - for (const bdType of data) { - try { - await strapi.entityService.create('api::bd-type.bd-type', { - data: { - type_name: bdType.type_name, - publishedAt: new Date(), - }, - }); - } catch (error) { - console.error( - `Error creating bd type ${bdType.type_name}:`, - error - ); - } - } - - return { - success: true, - }; - }, - - async migrateBdIntersectCommittees(ctx) { - // @ts-ignore - const body = ctx.request.body; - - const data = body?.data; - - const bdIntersectCommitteesList = await strapi.entityService.findMany( - 'api::bd-intersect-committee.bd-intersect-committee' - ); - - if (bdIntersectCommitteesList.length > 0) { - return { - success: false, - message: 'BD Intersect Committee List already exists', - }; - } - for (const committee of data) { - try { - await strapi.entityService.create( - 'api::bd-intersect-committee.bd-intersect-committee', - { - data: { - committee_name: committee.committee_name, - publishedAt: new Date(), - }, - } - ); - } catch (error) { - console.error( - `Error creating intersect committee ${committee.committee_name}:`, - error - ); - } - } - - return { - success: true, - }; - }, - - async migrateSubmissions(ctx) { - // @ts-ignore - const body = ctx.request.body; - - const data = body?.data; - - const formattedJson = data?.map((item) => ({ - 'api::bd-contact-information.bd-contact-information': { - be_full_name: - `${item?.['Beneficiary First Name']} ${item?.['Beneficiary Last Name']}`?.replace( - /\u200B/g, - '' - ), - be_email: item?.['Beneficiary Email']?.replace(/\u200B/g, ''), - be_country_of_res: item?.[ - 'Beneficiary Country of Residence' - ]?.replace(/\u200B/g, ''), - be_nationality: item?.['Beneficiary Nationality']?.replace( - /\u200B/g, - '' - ), - submission_lead_full_name: - `${item?.['Submission Lead First Name']} ${item?.['Submission Lead Last Name']}`?.replace( - /\u200B/g, - '' - ), - submission_lead_email: item?.['Submission Lead Email']?.replace( - /\u200B/g, - '' - ), - }, - 'api::bd-proposal-ownership.bd-proposal-ownership': { - agreed: true, - submited_on_behalf: item?.[ - 'Is this proposal being submitted on behalf of an individual (the beneficiary), company, or some other group?' - ]?.replace(/\u200B/g, ''), - company_name: item?.['Company Name']?.replace(/\u200B/g, ''), - company_domain_name: item?.['Company Domain Name']?.replace( - /\u200B/g, - '' - ), - be_country: item?.['Country of Incorporation']?.replace( - /\u200B/g, - '' - ), - group_name: item?.['Group Name']?.replace(/\u200B/g, ''), - type_of_group: item?.['Type of Group']?.replace(/\u200B/g, ''), - key_info_to_identify_group: item?.[ - 'Key Information to Identify Group' - ]?.replace(/\u200B/g, ''), - proposal_public_champion: item?.[ - 'Proposal Public Champion: Who would you like to be the public proposal champion?' - ]?.replace(/\u200B/g, ''), - social_handles: item?.[ - 'What social handles would you like to be used? E.g. Github, X' - ]?.replace(/\u200B/g, ''), - }, - 'api::bd-psapb.bd-psapb': { - problem_statement: item?.[ - 'Problem Statement: What problem does this proposal seek to address?' - ]?.replace(/\u200B/g, ''), - proposal_benefit: item?.[ - 'Proposal Benefit:  If implemented, what would be the benefit and to which parts of the community? Please include the demonstrated value or return on investment to the Cardano Community.' - ]?.replace(/\u200B/g, ''), - roadmap_name: item?.[ - 'Does this proposal align to the Product Roadmap and Roadmap Goals?' - ]?.replace(/\u200B/g, ''), - type_name: item?.[ - 'Does your proposal align to any of the categories listed below?' - ]?.replace(/\u200B/g, ''), - committee_name: item?.[ - 'Committee Alignment: Which of the Intersect Committees does your proposal align to?' - ]?.replace(/\u200B/g, ''), - supplementary_endorsement: item?.[ - 'Supplementary Endorsement: If possible provide evidence of wider community endorsement for this proposal?' - ]?.replace(/\u200B/g, ''), - explain_proposal_roadmap: item?.[ - 'Please explain how your proposal supports the Product Roadmap.' - ]?.replace(/\u200B/g, ''), - }, - 'api::bd-proposal-detail.bd-proposal-detail': { - proposal_name: item?.[ - 'Proposal Name: What is your proposed name to be used to reference this proposal publicly?' - ]?.replace(/\u200B/g, ''), - proposal_description: item?.[ - 'Proposal Description: Please provide a high-level description / abstract of the proposal (2500 words max).' - ]?.replace(/\u200B/g, ''), - key_dependencies: item?.[ - 'Dependencies: Please list any key dependencies (if any) for this proposal? These can be internal or external to the proposal.' - ]?.replace(/\u200B/g, ''), - maintain_and_support: item?.[ - 'Maintenance: How will this proposal be maintained and supported after initial development?' - ]?.replace(/\u200B/g, ''), - key_proposal_deliverables: item?.[ - 'Key Proposal Deliverable(s) and Definition of Done: What tangible milestones or outcomes are to be delivered and what will the community ultimately receive?*' - ]?.replace(/\u200B/g, ''), - resourcing_duration_estimates: item?.[ - 'Resourcing & Duration Estimates: Please provide estimates of team size and duration to achieve the Key Proposal Deliverables outlined above.' - ]?.replace(/\u200B/g, ''), - experience: item?.[ - 'Experience: Please provide previous experience relevant to complete this project.' - ]?.replace(/\u200B/g, ''), - contract_type_name: item?.[ - 'Contracting: Please describe how you expect to be contracted.' - ]?.replace(/\u200B/g, ''), - other_contract_type: item?.[ - 'Please describe what you have in mind.' - ]?.replace(/\u200B/g, ''), - }, - 'api::bd-costing.bd-costing': { - preferred_currency: item?.['Preferred Currency']?.replace( - /\u200B/g, - '' - ), - amount_in_preferred_currency: - item?.['Amount in preferred currency']?.toString(), - usd_to_ada_conversion_rate: - item?.['USD to ADA Conversion Rate']?.toString(), - ada_amount: item?.['ADA Amount']?.toString(), - cost_breakdown: item?.[ - 'Cost breakdown: Based on your preferred contract type and cost estimate, please provide a cost breakdown in ada and in USD.' - ]?.replace(/\u200B/g, ''), - }, - 'api::bd-further-information.bd-further-information': { - proposal_links: extractLinksFromString( - item?.[ - 'Further Information: Please link to any supplementary information on this proposal to help aid knowledge sharing.' - ]?.replace(/\u200B/g, '') - ), - }, - 'api::bd.bd': { - is_active: true, - privacy_policy: true, - intersect_named_administrator: - item?.[ - "Administration and Auditing: A successful proposal requires an Administrator. To ensure transparency and accuracy, audits may also be undertaken.

Intersect's role as an administrator, through our committees and internal operational function, would consist of the following:
- Contract management 
- Delivery assurance and Communications 
- Fund management 
- Fiat conversion 
- Legal
- KYC / KYB
- Dispute resolution 
- Technical and Financial auditing

Would you like Intersect to be your named Administrator, including acting as the auditor, as per the Cardano Constitution?" - ]?.replace(/\u200B/g, '') === 'Yes' - ? true - : false, - - intersect_admin_further_text: item?.[ - 'Please provide further information to help inform DReps. Who is the vendor and what services are they providing?' - ] - ? item?.[ - 'Please provide further information to help inform DReps. Who is the vendor and what services are they providing?' - ]?.toString() - : '', - }, - })); - - let errorList = []; - try { - for (const item of formattedJson) { - try { - let bdRelationIds = [{}]; - let bdData = {}; - - for (const [key, value] of Object.entries(item)) { - try { - let collectionApiName = key; - let collectionData = value; - - if ( - collectionData.hasOwnProperty( - 'be_country_of_res' - ) - ) { - let entityValue = - collectionData['be_country_of_res']; - - if (!entityValue) { - collectionData['be_country_of_res'] = null; - } else { - let entity = await getEntityByField( - 'api::country-list.country-list', - 'country_name', - collectionData['be_country_of_res'] - ); - - if (!entity?.message) { - collectionData['be_country_of_res'] = - entity?.id; - } else { - console.log(entity); - } - } - } - - if ( - collectionData.hasOwnProperty('be_nationality') - ) { - let entityValue = - collectionData['be_nationality']; - - if (!entityValue) { - collectionData['be_nationality'] = null; - } else { - let entity = await getEntityByField( - 'api::country-list.country-list', - 'country_name', - collectionData['be_nationality'] - ); - - if (!entity?.message) { - collectionData['be_nationality'] = - entity?.id; - } else { - console.log(entity); - } - } - } - - if (collectionData.hasOwnProperty('be_country')) { - let entityValue = collectionData['be_country']; - - if (!entityValue) { - collectionData['be_country'] = null; - } else { - let entity = await getEntityByField( - 'api::country-list.country-list', - 'country_name', - collectionData['be_country'] - ); - - if (!entity?.message) { - collectionData['be_country'] = - entity?.id; - } else { - console.log(entity); - } - } - } - - if (collectionData.hasOwnProperty('roadmap_name')) { - let entityValue = - collectionData['roadmap_name']; - - if (!entityValue) { - collectionData['roadmap_name'] = null; - } else { - let entity = await getEntityByField( - 'api::bd-road-map.bd-road-map', - 'roadmap_name', - collectionData['roadmap_name'] - ); - - if (!entity?.message) { - collectionData['roadmap_name'] = - entity?.id; - } else { - console.log(entity); - } - } - } - - if (collectionData.hasOwnProperty('type_name')) { - let entityValue = collectionData['type_name']; - - if (!entityValue) { - collectionData['type_name'] = null; - } else { - let entity = await getEntityByField( - 'api::bd-type.bd-type', - 'type_name', - collectionData['type_name'] - ); - - if (!entity?.message) { - collectionData['type_name'] = - entity?.id; - } else { - console.log(entity); - } - } - } - - if ( - collectionData.hasOwnProperty('committee_name') - ) { - let entityValue = - collectionData['committee_name']; - - if (!entityValue) { - collectionData['committee_name'] = null; - } else { - let entity = await getEntityByField( - 'api::bd-intersect-committee.bd-intersect-committee', - 'committee_name', - collectionData['committee_name'] - ); - - if (!entity?.message) { - collectionData['committee_name'] = - entity?.id; - } else { - console.log(entity); - } - } - } - - if ( - collectionData.hasOwnProperty( - 'contract_type_name' - ) - ) { - let entityValue = - collectionData['contract_type_name']; - - if (!entityValue) { - collectionData['contract_type_name'] = null; - } else { - let entity = await getEntityByField( - 'api::bd-contract-type.bd-contract-type', - 'contract_type_name', - collectionData['contract_type_name'] - ); - - if (!entity?.message) { - collectionData['contract_type_name'] = - entity?.id; - } else { - console.log(entity); - } - } - } - - if ( - collectionData.hasOwnProperty( - 'preferred_currency' - ) - ) { - let entityValue = - collectionData['preferred_currency']; - - if (!entityValue) { - collectionData['preferred_currency'] = null; - } else { - let entity = await getEntityByField( - 'api::bd-currency-list.bd-currency-list', - 'currency_letter_code', - collectionData['preferred_currency'] - ); - - if (!entity?.message) { - collectionData['preferred_currency'] = - entity?.id; - } else { - console.log(entity); - } - } - } - - if (collectionApiName !== 'api::bd.bd') { - let createdCollectionData = - await strapi.entityService.create( - // @ts-ignore - collectionApiName, - { - data: collectionData, - } - ); - - if (createdCollectionData?.id) { - let fieldName = collectionApiName - .split('::')[1] - .split('.')[0] - .replace(/-/g, '_'); - - bdRelationIds.push({ - [fieldName]: createdCollectionData.id, - }); - } - } else { - bdData = collectionData; - } - } catch (error) { - console.log(error); - } - } - - const createdBd = await strapi.entityService.create( - 'api::bd.bd', - { - data: { - ...bdData, - ...bdRelationIds.reduce( - (acc, obj) => ({ ...acc, ...obj }), - {} - ), - }, - } - ); - - if (createdBd?.id) { - //create bd poll - await strapi.entityService.create( - 'api::bd-poll.bd-poll', - { - data: { - bd_proposal_id: createdBd?.id?.toString(), - poll_yes: 0, - poll_no: 0, - is_poll_active: true, - }, - } - ); - } - } catch (error) { - console.log(error); - errorList.push(item); - } - } - } catch (error) { - console.log(error); - - return console.error(error); - } - - return { - success: true, - error: errorList, - }; - }, - - async migrateBDProposalsMasterId(ctx) { - const coreProposals = await strapi.entityService.findMany( - 'api::bd.bd', - { - filters: { - old_ver: null, - }, - fields: ['id', 'master_id'], - limit: 100000, - } - ); - - async function propagateMasterId(parentId, coreId) { - const children = await strapi.entityService.findMany('api::bd.bd', { - filters: { - old_ver: parentId, - }, - fields: ['id', 'master_id'], - limit: 100000, - }); - - for (const child of children) { - try { - if ( - !child.master_id || - child.master_id !== coreId.toString() - ) { - await strapi.entityService.update( - 'api::bd.bd', - child?.id, - { - data: { - master_id: coreId?.toString(), - }, - } - ); - } - - await propagateMasterId(child?.id, coreId); - } catch (error) { - console.log( - `Error while processing child id ${child?.id}:`, - error - ); - } - } - } - - for (const proposal of coreProposals) { - try { - if (!proposal?.master_id) { - await strapi.entityService.update( - 'api::bd.bd', - proposal?.id, - { - data: { - master_id: proposal?.id?.toString(), - }, - } - ); - } - - await propagateMasterId(proposal?.id, proposal?.id); - } catch (error) { - console.log( - `Error while processing proposal ${proposal?.id}:`, - error - ); - } - } - - return { - success: true, - }; - }, - async migrateCommentsAndPollMasterId(ctx) { - const coreProposals = await strapi.entityService.findMany( - 'api::bd.bd', - { - filters: { - old_ver: null, - }, - fields: ['id', 'master_id'], - limit: 100000, - } - ); - - for (const proposal of coreProposals) { - try { - const masterID = proposal?.master_id; - const allProposalsWithSameMasterId = - await strapi.entityService.findMany('api::bd.bd', { - filters: { - master_id: masterID, - }, - fields: ['id', 'master_id'], - limit: 100000, - }); - - const proposalsIDs = allProposalsWithSameMasterId.map( - (proposal) => proposal?.id?.toString() - ); - - const comments = await strapi.entityService.findMany( - 'api::comment.comment', - { - filters: { - bd_proposal_id: { - $in: proposalsIDs, - }, - }, - fields: ['id', 'bd_proposal_id'], - limit: 100000, - } - ); - - for (const comment of comments) { - await strapi.entityService.update( - 'api::comment.comment', - comment?.id, - { - data: { - bd_proposal_id: masterID, - }, - } - ); - } - - const polls = await strapi.entityService.findMany( - 'api::bd-poll.bd-poll', - { - filters: { - bd_proposal_id: { - $in: proposalsIDs, - }, - }, - fields: ['id', 'bd_proposal_id'], - limit: 100000, - } - ); - - for (const poll of polls) { - await strapi.entityService.update( - 'api::bd-poll.bd-poll', - poll?.id, - { - data: { - bd_proposal_id: masterID, - }, - } - ); - } - } catch (error) { - console.log( - `Error while processing proposal ${proposal?.id}:`, - error - ); - } - } - - return { - success: true, - }; - }, - - async migrateAmounts(ctx) { - const allBdCostings = await strapi.db - .query('api::bd-costing.bd-costing') - .findMany({ - select: [ - 'id', - 'ada_amount', - 'amount_in_preferred_currency', - 'usd_to_ada_conversion_rate', - 'ada_amount_clone', - 'amount_in_preferred_currency_clone', - 'usd_to_ada_conversion_rate_clone', - ], - }); - let unfinishedCostings = []; - for (let bdCost of allBdCostings) { - try { - let updatedEntry = await strapi.entityService.update( - 'api::bd-costing.bd-costing', - bdCost?.id, - { - data: { - ada_amount_clone: - +bdCost?.ada_amount - ?.toString() - ?.replace(',', '.') || 0, - amount_in_preferred_currency_clone: - +bdCost?.amount_in_preferred_currency - ?.toString() - ?.replace(',', '.') || 0, - usd_to_ada_conversion_rate_clone: - +bdCost?.usd_to_ada_conversion_rate - ?.toString() - ?.replace(',', '.') || 0, - }, - } - ); - - if (!updatedEntry) { - unfinishedCostings.push(bdCost?.id); - } - } catch (error) { - console.log(error); - unfinishedCostings.push(bdCost?.id); - } - } - - let returnValue = - unfinishedCostings?.length > 0 - ? { success: 'partial', unfinishedCostings: unfinishedCostings } - : { success: true }; - - return returnValue; - }, + async migrateCountries(ctx) { + // @ts-ignore + const body = ctx.request.body; + + const data = body?.data; + + const countryList = await strapi.entityService.findMany( + "api::country-list.country-list" + ); + + if (countryList.length > 0) { + return { + success: false, + message: "Country List already exists", + }; + } + + for (const country of data) { + try { + await strapi.entityService.create("api::country-list.country-list", { + data: { + country_name: country.country_name, + alfa_2_code: country.alfa_2_code, + alfa_3_code: country.alfa_3_code, + publishedAt: new Date(), + }, + }); + } catch (error) { + console.error(`Error creating country ${country.country_name}:`, error); + } + } + + return { + success: true, + }; + }, + async migrateCurrencies(ctx) { + // @ts-ignore + const body = ctx.request.body; + + const data = body?.data; + + const currencyList = await strapi.entityService.findMany( + "api::bd-currency-list.bd-currency-list" + ); + + if (currencyList.length > 0) { + return { + success: false, + message: "Currency List already exists", + }; + } + for (const currency of data) { + try { + await strapi.entityService.create( + "api::bd-currency-list.bd-currency-list", + { + data: { + currency_name: currency.currency_name, + currency_letter_code: currency.currency_letter_code, + currency_number_code: currency.currency_number_code, + publishedAt: new Date(), + }, + } + ); + } catch (error) { + console.error( + `Error creating currency ${currency.currency_name}:`, + error + ); + } + } + + return { + success: true, + }; + }, + + async migrateContractTypes(ctx) { + // @ts-ignore + const body = ctx.request.body; + + const data = body?.data; + + const contractTypeList = await strapi.entityService.findMany( + "api::bd-contract-type.bd-contract-type" + ); + + if (contractTypeList.length > 0) { + return { + success: false, + message: "Contract Type List already exists", + }; + } + for (const contractType of data) { + try { + await strapi.entityService.create( + "api::bd-contract-type.bd-contract-type", + { + data: { + contract_type_name: contractType.contract_type_name, + publishedAt: new Date(), + }, + } + ); + } catch (error) { + console.error( + `Error creating contract type ${contractType.contract_type_name}:`, + error + ); + } + } + + return { + success: true, + }; + }, + + async migrateRoadMap(ctx) { + // @ts-ignore + const body = ctx.request.body; + + const data = body?.data; + + const roadMapList = await strapi.entityService.findMany( + "api::bd-road-map.bd-road-map" + ); + + if (roadMapList.length > 0) { + return { + success: false, + message: "Road Map List already exists", + }; + } + for (const roadMap of data) { + try { + await strapi.entityService.create("api::bd-road-map.bd-road-map", { + data: { + roadmap_name: roadMap.roadmap_name, + publishedAt: new Date(), + }, + }); + } catch (error) { + console.error( + `Error creating road map ${roadMap.roadmap_name}:`, + error + ); + } + } + + return { + success: true, + }; + }, + + async migrateBdTypes(ctx) { + // @ts-ignore + const body = ctx.request.body; + + const data = body?.data; + + const bdTypeList = await strapi.entityService.findMany( + "api::bd-type.bd-type" + ); + + if (bdTypeList.length > 0) { + return { + success: false, + message: "BD Type List already exists", + }; + } + for (const bdType of data) { + try { + await strapi.entityService.create("api::bd-type.bd-type", { + data: { + type_name: bdType.type_name, + publishedAt: new Date(), + }, + }); + } catch (error) { + console.error(`Error creating bd type ${bdType.type_name}:`, error); + } + } + + return { + success: true, + }; + }, + + async migrateBdIntersectCommittees(ctx) { + // @ts-ignore + const body = ctx.request.body; + + const data = body?.data; + + const bdIntersectCommitteesList = await strapi.entityService.findMany( + "api::bd-intersect-committee.bd-intersect-committee" + ); + + if (bdIntersectCommitteesList.length > 0) { + return { + success: false, + message: "BD Intersect Committee List already exists", + }; + } + for (const committee of data) { + try { + await strapi.entityService.create( + "api::bd-intersect-committee.bd-intersect-committee", + { + data: { + committee_name: committee.committee_name, + publishedAt: new Date(), + }, + } + ); + } catch (error) { + console.error( + `Error creating intersect committee ${committee.committee_name}:`, + error + ); + } + } + + return { + success: true, + }; + }, + + async migrateSubmissions(ctx) { + // @ts-ignore + const body = ctx.request.body; + + const data = body?.data; + + const formattedJson = data?.map((item) => ({ + "api::bd-contact-information.bd-contact-information": { + be_full_name: + `${item?.["Beneficiary First Name"]} ${item?.["Beneficiary Last Name"]}`?.replace( + /\u200B/g, + "" + ), + be_email: item?.["Beneficiary Email"]?.replace(/\u200B/g, ""), + be_country_of_res: item?.["Beneficiary Country of Residence"]?.replace( + /\u200B/g, + "" + ), + be_nationality: item?.["Beneficiary Nationality"]?.replace( + /\u200B/g, + "" + ), + submission_lead_full_name: + `${item?.["Submission Lead First Name"]} ${item?.["Submission Lead Last Name"]}`?.replace( + /\u200B/g, + "" + ), + submission_lead_email: item?.["Submission Lead Email"]?.replace( + /\u200B/g, + "" + ), + }, + "api::bd-proposal-ownership.bd-proposal-ownership": { + agreed: true, + submited_on_behalf: item?.[ + "Is this proposal being submitted on behalf of an individual (the beneficiary), company, or some other group?" + ]?.replace(/\u200B/g, ""), + company_name: item?.["Company Name"]?.replace(/\u200B/g, ""), + company_domain_name: item?.["Company Domain Name"]?.replace( + /\u200B/g, + "" + ), + be_country: item?.["Country of Incorporation"]?.replace(/\u200B/g, ""), + group_name: item?.["Group Name"]?.replace(/\u200B/g, ""), + type_of_group: item?.["Type of Group"]?.replace(/\u200B/g, ""), + key_info_to_identify_group: item?.[ + "Key Information to Identify Group" + ]?.replace(/\u200B/g, ""), + proposal_public_champion: item?.[ + "Proposal Public Champion: Who would you like to be the public proposal champion?" + ]?.replace(/\u200B/g, ""), + social_handles: item?.[ + "What social handles would you like to be used? E.g. Github, X" + ]?.replace(/\u200B/g, ""), + }, + "api::bd-psapb.bd-psapb": { + problem_statement: item?.[ + "Problem Statement: What problem does this proposal seek to address?" + ]?.replace(/\u200B/g, ""), + proposal_benefit: item?.[ + "Proposal Benefit:  If implemented, what would be the benefit and to which parts of the community? Please include the demonstrated value or return on investment to the Cardano Community." + ]?.replace(/\u200B/g, ""), + roadmap_name: item?.[ + "Does this proposal align to the Product Roadmap and Roadmap Goals?" + ]?.replace(/\u200B/g, ""), + type_name: item?.[ + "Does your proposal align to any of the categories listed below?" + ]?.replace(/\u200B/g, ""), + committee_name: item?.[ + "Committee Alignment: Which of the Intersect Committees does your proposal align to?" + ]?.replace(/\u200B/g, ""), + supplementary_endorsement: item?.[ + "Supplementary Endorsement: If possible provide evidence of wider community endorsement for this proposal?" + ]?.replace(/\u200B/g, ""), + explain_proposal_roadmap: item?.[ + "Please explain how your proposal supports the Product Roadmap." + ]?.replace(/\u200B/g, ""), + }, + "api::bd-proposal-detail.bd-proposal-detail": { + proposal_name: item?.[ + "Proposal Name: What is your proposed name to be used to reference this proposal publicly?" + ]?.replace(/\u200B/g, ""), + proposal_description: item?.[ + "Proposal Description: Please provide a high-level description / abstract of the proposal (2500 words max)." + ]?.replace(/\u200B/g, ""), + key_dependencies: item?.[ + "Dependencies: Please list any key dependencies (if any) for this proposal? These can be internal or external to the proposal." + ]?.replace(/\u200B/g, ""), + maintain_and_support: item?.[ + "Maintenance: How will this proposal be maintained and supported after initial development?" + ]?.replace(/\u200B/g, ""), + key_proposal_deliverables: item?.[ + "Key Proposal Deliverable(s) and Definition of Done: What tangible milestones or outcomes are to be delivered and what will the community ultimately receive?*" + ]?.replace(/\u200B/g, ""), + resourcing_duration_estimates: item?.[ + "Resourcing & Duration Estimates: Please provide estimates of team size and duration to achieve the Key Proposal Deliverables outlined above." + ]?.replace(/\u200B/g, ""), + experience: item?.[ + "Experience: Please provide previous experience relevant to complete this project." + ]?.replace(/\u200B/g, ""), + contract_type_name: item?.[ + "Contracting: Please describe how you expect to be contracted." + ]?.replace(/\u200B/g, ""), + other_contract_type: item?.[ + "Please describe what you have in mind." + ]?.replace(/\u200B/g, ""), + }, + "api::bd-costing.bd-costing": { + preferred_currency: item?.["Preferred Currency"]?.replace( + /\u200B/g, + "" + ), + amount_in_preferred_currency: + item?.["Amount in preferred currency"]?.toString(), + usd_to_ada_conversion_rate: + item?.["USD to ADA Conversion Rate"]?.toString(), + ada_amount: item?.["ADA Amount"]?.toString(), + cost_breakdown: item?.[ + "Cost breakdown: Based on your preferred contract type and cost estimate, please provide a cost breakdown in ada and in USD." + ]?.replace(/\u200B/g, ""), + }, + "api::bd-further-information.bd-further-information": { + proposal_links: extractLinksFromString( + item?.[ + "Further Information: Please link to any supplementary information on this proposal to help aid knowledge sharing." + ]?.replace(/\u200B/g, "") + ), + }, + "api::bd.bd": { + is_active: true, + privacy_policy: true, + intersect_named_administrator: + item?.[ + "Administration and Auditing: A successful proposal requires an Administrator. To ensure transparency and accuracy, audits may also be undertaken.

Intersect's role as an administrator, through our committees and internal operational function, would consist of the following:
- Contract management 
- Delivery assurance and Communications 
- Fund management 
- Fiat conversion 
- Legal
- KYC / KYB
- Dispute resolution 
- Technical and Financial auditing

Would you like Intersect to be your named Administrator, including acting as the auditor, as per the Cardano Constitution?" + ]?.replace(/\u200B/g, "") === "Yes" + ? true + : false, + + intersect_admin_further_text: item?.[ + "Please provide further information to help inform DReps. Who is the vendor and what services are they providing?" + ] + ? item?.[ + "Please provide further information to help inform DReps. Who is the vendor and what services are they providing?" + ]?.toString() + : "", + }, + })); + + let errorList = []; + try { + for (const item of formattedJson) { + try { + let bdRelationIds = [{}]; + let bdData = {}; + + for (const [key, value] of Object.entries(item)) { + try { + let collectionApiName = key; + let collectionData = value; + + if (collectionData.hasOwnProperty("be_country_of_res")) { + let entityValue = collectionData["be_country_of_res"]; + + if (!entityValue) { + collectionData["be_country_of_res"] = null; + } else { + let entity = await getEntityByField( + "api::country-list.country-list", + "country_name", + collectionData["be_country_of_res"] + ); + + if (!entity?.message) { + collectionData["be_country_of_res"] = entity?.id; + } else { + console.log(entity); + } + } + } + + if (collectionData.hasOwnProperty("be_nationality")) { + let entityValue = collectionData["be_nationality"]; + + if (!entityValue) { + collectionData["be_nationality"] = null; + } else { + let entity = await getEntityByField( + "api::country-list.country-list", + "country_name", + collectionData["be_nationality"] + ); + + if (!entity?.message) { + collectionData["be_nationality"] = entity?.id; + } else { + console.log(entity); + } + } + } + + if (collectionData.hasOwnProperty("be_country")) { + let entityValue = collectionData["be_country"]; + + if (!entityValue) { + collectionData["be_country"] = null; + } else { + let entity = await getEntityByField( + "api::country-list.country-list", + "country_name", + collectionData["be_country"] + ); + + if (!entity?.message) { + collectionData["be_country"] = entity?.id; + } else { + console.log(entity); + } + } + } + + if (collectionData.hasOwnProperty("roadmap_name")) { + let entityValue = collectionData["roadmap_name"]; + + if (!entityValue) { + collectionData["roadmap_name"] = null; + } else { + let entity = await getEntityByField( + "api::bd-road-map.bd-road-map", + "roadmap_name", + collectionData["roadmap_name"] + ); + + if (!entity?.message) { + collectionData["roadmap_name"] = entity?.id; + } else { + console.log(entity); + } + } + } + + if (collectionData.hasOwnProperty("type_name")) { + let entityValue = collectionData["type_name"]; + + if (!entityValue) { + collectionData["type_name"] = null; + } else { + let entity = await getEntityByField( + "api::bd-type.bd-type", + "type_name", + collectionData["type_name"] + ); + + if (!entity?.message) { + collectionData["type_name"] = entity?.id; + } else { + console.log(entity); + } + } + } + + if (collectionData.hasOwnProperty("committee_name")) { + let entityValue = collectionData["committee_name"]; + + if (!entityValue) { + collectionData["committee_name"] = null; + } else { + let entity = await getEntityByField( + "api::bd-intersect-committee.bd-intersect-committee", + "committee_name", + collectionData["committee_name"] + ); + + if (!entity?.message) { + collectionData["committee_name"] = entity?.id; + } else { + console.log(entity); + } + } + } + + if (collectionData.hasOwnProperty("contract_type_name")) { + let entityValue = collectionData["contract_type_name"]; + + if (!entityValue) { + collectionData["contract_type_name"] = null; + } else { + let entity = await getEntityByField( + "api::bd-contract-type.bd-contract-type", + "contract_type_name", + collectionData["contract_type_name"] + ); + + if (!entity?.message) { + collectionData["contract_type_name"] = entity?.id; + } else { + console.log(entity); + } + } + } + + if (collectionData.hasOwnProperty("preferred_currency")) { + let entityValue = collectionData["preferred_currency"]; + + if (!entityValue) { + collectionData["preferred_currency"] = null; + } else { + let entity = await getEntityByField( + "api::bd-currency-list.bd-currency-list", + "currency_letter_code", + collectionData["preferred_currency"] + ); + + if (!entity?.message) { + collectionData["preferred_currency"] = entity?.id; + } else { + console.log(entity); + } + } + } + + if (collectionApiName !== "api::bd.bd") { + let createdCollectionData = await strapi.entityService.create( + // @ts-ignore + collectionApiName, + { + data: collectionData, + } + ); + + if (createdCollectionData?.id) { + let fieldName = collectionApiName + .split("::")[1] + .split(".")[0] + .replace(/-/g, "_"); + + bdRelationIds.push({ + [fieldName]: createdCollectionData.id, + }); + } + } else { + bdData = collectionData; + } + } catch (error) { + console.log(error); + } + } + + const createdBd = await strapi.entityService.create("api::bd.bd", { + data: { + ...bdData, + ...bdRelationIds.reduce((acc, obj) => ({ ...acc, ...obj }), {}), + }, + }); + + if (createdBd?.id) { + //create bd poll + await strapi.entityService.create("api::bd-poll.bd-poll", { + data: { + bd_proposal_id: createdBd?.id?.toString(), + poll_yes: 0, + poll_no: 0, + is_poll_active: true, + }, + }); + } + } catch (error) { + console.log(error); + errorList.push(item); + } + } + } catch (error) { + console.log(error); + + return console.error(error); + } + + return { + success: true, + error: errorList, + }; + }, + + async migrateBDProposalsMasterId(ctx) { + const coreProposals = await strapi.entityService.findMany("api::bd.bd", { + filters: { + old_ver: null, + }, + fields: ["id", "master_id"], + limit: 100000, + }); + + async function propagateMasterId(parentId, coreId) { + const children = await strapi.entityService.findMany("api::bd.bd", { + filters: { + old_ver: parentId, + }, + fields: ["id", "master_id"], + limit: 100000, + }); + + for (const child of children) { + try { + if (!child.master_id || child.master_id !== coreId.toString()) { + await strapi.entityService.update("api::bd.bd", child?.id, { + data: { + master_id: coreId?.toString(), + }, + }); + } + + await propagateMasterId(child?.id, coreId); + } catch (error) { + console.log(`Error while processing child id ${child?.id}:`, error); + } + } + } + + for (const proposal of coreProposals) { + try { + if (!proposal?.master_id) { + await strapi.entityService.update("api::bd.bd", proposal?.id, { + data: { + master_id: proposal?.id?.toString(), + }, + }); + } + + await propagateMasterId(proposal?.id, proposal?.id); + } catch (error) { + console.log(`Error while processing proposal ${proposal?.id}:`, error); + } + } + + return { + success: true, + }; + }, + async migrateCommentsAndPollMasterId(ctx) { + const coreProposals = await strapi.entityService.findMany("api::bd.bd", { + filters: { + old_ver: null, + }, + fields: ["id", "master_id"], + limit: 100000, + }); + + for (const proposal of coreProposals) { + try { + const masterID = proposal?.master_id; + const allProposalsWithSameMasterId = + await strapi.entityService.findMany("api::bd.bd", { + filters: { + master_id: masterID, + }, + fields: ["id", "master_id"], + limit: 100000, + }); + + const proposalsIDs = allProposalsWithSameMasterId.map((proposal) => + proposal?.id?.toString() + ); + + const comments = await strapi.entityService.findMany( + "api::comment.comment", + { + filters: { + bd_proposal_id: { + $in: proposalsIDs, + }, + }, + fields: ["id", "bd_proposal_id"], + limit: 100000, + } + ); + + for (const comment of comments) { + await strapi.entityService.update( + "api::comment.comment", + comment?.id, + { + data: { + bd_proposal_id: masterID, + }, + } + ); + } + + const polls = await strapi.entityService.findMany( + "api::bd-poll.bd-poll", + { + filters: { + bd_proposal_id: { + $in: proposalsIDs, + }, + }, + fields: ["id", "bd_proposal_id"], + limit: 100000, + } + ); + + for (const poll of polls) { + await strapi.entityService.update("api::bd-poll.bd-poll", poll?.id, { + data: { + bd_proposal_id: masterID, + }, + }); + } + } catch (error) { + console.log(`Error while processing proposal ${proposal?.id}:`, error); + } + } + + return { + success: true, + }; + }, + + async migrateAmounts(ctx) { + const allBdCostings = await strapi.db + .query("api::bd-costing.bd-costing") + .findMany({ + select: [ + "id", + "ada_amount", + "amount_in_preferred_currency", + "usd_to_ada_conversion_rate", + "ada_amount_clone", + "amount_in_preferred_currency_clone", + "usd_to_ada_conversion_rate_clone", + ], + }); + let unfinishedCostings = []; + for (let bdCost of allBdCostings) { + try { + let updatedEntry = await strapi.entityService.update( + "api::bd-costing.bd-costing", + bdCost?.id, + { + data: { + ada_amount_clone: + +bdCost?.ada_amount?.toString()?.replace(",", ".") || 0, + amount_in_preferred_currency_clone: + +bdCost?.amount_in_preferred_currency + ?.toString() + ?.replace(",", ".") || 0, + usd_to_ada_conversion_rate_clone: + +bdCost?.usd_to_ada_conversion_rate + ?.toString() + ?.replace(",", ".") || 0, + }, + } + ); + + if (!updatedEntry) { + unfinishedCostings.push(bdCost?.id); + } + } catch (error) { + console.log(error); + unfinishedCostings.push(bdCost?.id); + } + } + + let returnValue = + unfinishedCostings?.length > 0 + ? { success: "partial", unfinishedCostings: unfinishedCostings } + : { success: true }; + + return returnValue; + }, + + async migrateLinkProposalToProposalContent(ctx) { + const allProposalContent = await strapi.db + .query("api::proposal-content.proposal-content") + .findMany({ + populate: { proposal: true }, + }); + + let result = { + success: [], + failed: [], + }; + + for (const item of allProposalContent) { + try { + await strapi.entityService.update( + "api::proposal-content.proposal-content", + item.id, + { + data: { + proposal: parseInt(item.proposal_id), + }, + populate: ["proposal"], + } + ); + + result.success.push(item.id); + } catch (error) { + result.failed.push({ + id: item.id, + error: error.message || error, + }); + } + } + return { result }; + }, }; diff --git a/backend/src/api/migration/routes/migration.js b/backend/src/api/migration/routes/migration.js index bfbdc8a..839d73b 100644 --- a/backend/src/api/migration/routes/migration.js +++ b/backend/src/api/migration/routes/migration.js @@ -1,54 +1,59 @@ module.exports = { - routes: [ - { - method: 'POST', - path: '/migration/country-lists', - handler: 'migration.migrateCountries', - }, - { - method: 'POST', - path: '/migration/currency-lists', - handler: 'migration.migrateCurrencies', - }, - { - method: 'POST', - path: '/migration/contract-types', - handler: 'migration.migrateContractTypes', - }, - { - method: 'POST', - path: '/migration/road-maps', - handler: 'migration.migrateRoadMap', - }, - { - method: 'POST', - path: '/migration/bd-types', - handler: 'migration.migrateBdTypes', - }, - { - method: 'POST', - path: '/migration/bd-intersect-committees', - handler: 'migration.migrateBdIntersectCommittees', - }, - { - method: 'POST', - path: '/migration/submissions', - handler: 'migration.migrateSubmissions', - }, - { - method: 'GET', - path: '/migration/proposal-master-id', - handler: 'migration.migrateBDProposalsMasterId', - }, - { - method: 'GET', - path: '/migration/comments-and-poll-master-id', - handler: 'migration.migrateCommentsAndPollMasterId', - }, - { - method: 'POST', - path: '/migration/bd-costing-amounts', - handler: 'migration.migrateAmounts', - }, - ], + routes: [ + { + method: "POST", + path: "/migration/country-lists", + handler: "migration.migrateCountries", + }, + { + method: "POST", + path: "/migration/currency-lists", + handler: "migration.migrateCurrencies", + }, + { + method: "POST", + path: "/migration/contract-types", + handler: "migration.migrateContractTypes", + }, + { + method: "POST", + path: "/migration/road-maps", + handler: "migration.migrateRoadMap", + }, + { + method: "POST", + path: "/migration/bd-types", + handler: "migration.migrateBdTypes", + }, + { + method: "POST", + path: "/migration/bd-intersect-committees", + handler: "migration.migrateBdIntersectCommittees", + }, + { + method: "POST", + path: "/migration/submissions", + handler: "migration.migrateSubmissions", + }, + { + method: "GET", + path: "/migration/proposal-master-id", + handler: "migration.migrateBDProposalsMasterId", + }, + { + method: "GET", + path: "/migration/comments-and-poll-master-id", + handler: "migration.migrateCommentsAndPollMasterId", + }, + { + method: "POST", + path: "/migration/bd-costing-amounts", + handler: "migration.migrateAmounts", + }, + { + method: "GET", + path: "/migration/proposal-link-to-proposal-content", + handler: "migration.migrateLinkProposalToProposalContent", + }, + ], }; diff --git a/backend/src/api/proposal-content/content-types/proposal-content/schema.json b/backend/src/api/proposal-content/content-types/proposal-content/schema.json index 26764cf..af9f2e1 100644 --- a/backend/src/api/proposal-content/content-types/proposal-content/schema.json +++ b/backend/src/api/proposal-content/content-types/proposal-content/schema.json @@ -84,6 +84,12 @@ "relation": "oneToOne", "target": "api::proposal-hard-fork-content.proposal-hard-fork-content", "mappedBy": "proposal_content" + }, + "proposal": { + "type": "relation", + "relation": "manyToOne", + "target": "api::proposal.proposal", + "inversedBy": "proposal_contents" } } } diff --git a/backend/src/api/proposal/content-types/proposal/schema.json b/backend/src/api/proposal/content-types/proposal/schema.json index 81b22ce..41a2e42 100644 --- a/backend/src/api/proposal/content-types/proposal/schema.json +++ b/backend/src/api/proposal/content-types/proposal/schema.json @@ -27,6 +27,12 @@ "user_id": { "type": "string", "required": true + }, + "proposal_contents": { + "type": "relation", + "relation": "oneToMany", + "target": "api::proposal-content.proposal-content", + "mappedBy": "proposal" } } } diff --git a/backend/src/api/proposal/controllers/proposal.js b/backend/src/api/proposal/controllers/proposal.js index 4a97626..b0362d6 100644 --- a/backend/src/api/proposal/controllers/proposal.js +++ b/backend/src/api/proposal/controllers/proposal.js @@ -4,8 +4,10 @@ /** * proposal controller */ -const {Address,RewardAddress} = require("@emurgo/cardano-serialization-lib-nodejs"); - +const { + Address, + RewardAddress, +} = require("@emurgo/cardano-serialization-lib-nodejs"); const { createCoreController } = require("@strapi/strapi").factories; async function isRewardAddress(address) { @@ -17,626 +19,602 @@ async function isRewardAddress(address) { } } module.exports = createCoreController( - 'api::proposal.proposal', - ({ strapi }) => ({ - async find(ctx) { - let sanitizedQueryParams = ctx.query; - if (!sanitizedQueryParams.filters) { - sanitizedQueryParams.filters = {}; - } - - if (!sanitizedQueryParams.filters['$and']) { - sanitizedQueryParams.filters['$and'] = []; - } - - /////GOV ACTION TYPE/////////// - - const hasGovActionTypeIDFilter = sanitizedQueryParams.filters[ - '$and' - ]?.find((elem) => elem?.hasOwnProperty('gov_action_type_id')); - - if (hasGovActionTypeIDFilter) { - const hasGovActionTypeIDFilterInSanitize = - sanitizedQueryParams?.filters['$and']?.some((elem) => - elem?.hasOwnProperty('gov_action_type_id') - ); - if (!hasGovActionTypeIDFilterInSanitize) { - sanitizedQueryParams.filters['$and'].push({ - gov_action_type_id: - hasGovActionTypeIDFilter?.gov_action_type_id, - }); - } - } - ////////////////////////// - /////PROPOSAL NAME/////////// - const hasPropNameFilter = ctx?.query?.filters['$and']?.find( - (elem) => elem?.hasOwnProperty('prop_name') - ); - - if (hasPropNameFilter) { - const hasPropNameFilterInSanitize = - sanitizedQueryParams?.filters['$and']?.some((elem) => - elem?.hasOwnProperty('prop_name') - ); - if (!hasPropNameFilterInSanitize) { - sanitizedQueryParams.filters['$and'].push({ - prop_name: hasPropNameFilter?.prop_name, - }); - } - } - ////////////////////////////// - /////PROPOSAL SUBMITTED/////////// - const hasPropSubmitedFilter = ctx?.query?.filters['$and']?.find( - (elem) => elem?.hasOwnProperty('prop_submitted') - ); - - if (hasPropSubmitedFilter) { - const hasPropSubmitedFilterInSanitize = - sanitizedQueryParams?.filters['$and']?.some((elem) => - elem?.hasOwnProperty('prop_submitted') - ); - if (!hasPropSubmitedFilterInSanitize) { - if (hasPropSubmitedFilter?.prop_submitted === 'true') { - sanitizedQueryParams.filters['$and'].push({ - prop_submitted: - hasPropSubmitedFilter?.prop_submitted, - }); - } else { - sanitizedQueryParams.filters['$and'].push({ - $or: [ - { - prop_submitted: false, - }, - { - prop_submitted: { - $null: true, - }, - }, - ], - }); - } - } - } - ////////////////////////////// - /////PROPOSAL ID/////////// - const hasPropIdFilter = ctx?.query?.filters['$and']?.find((elem) => - elem?.hasOwnProperty('prop_id') - ); - - if (hasPropIdFilter) { - const hasPropIdFilterInSanitize = sanitizedQueryParams?.filters[ - '$and' - ]?.some((elem) => elem?.hasOwnProperty('prop_id')); - - if (hasPropIdFilterInSanitize) { - sanitizedQueryParams.filters['$and'] = - sanitizedQueryParams.filters['$and']?.filter( - (elem) => !elem?.hasOwnProperty('prop_id') - ); - - sanitizedQueryParams.filters['$and'].push({ - proposal_id: hasPropIdFilter?.prop_id, - }); - } - } else { - sanitizedQueryParams.filters['$and'].push({ - prop_rev_active: true, - }); - } - ////////////////////////////// - /////IS DRAFT/////////// - const hasIsDraftFilter = ctx?.query?.filters['$and']?.find((elem) => - elem?.hasOwnProperty('is_draft') - ); - if (hasIsDraftFilter) { - if (!ctx?.state?.user) { - return ctx.badRequest(null, 'User is required'); - } - const hasIsDraftFilterInSanitize = - sanitizedQueryParams?.filters['$and']?.some((elem) => - elem?.hasOwnProperty('is_draft') - ); - if (!hasIsDraftFilterInSanitize) { - sanitizedQueryParams.filters['$and'].push({ - is_draft: hasIsDraftFilter?.is_draft, - user_id: ctx?.state?.user?.id, - }); - } - const hasUserFilterInSanitize = sanitizedQueryParams?.filters[ - '$and' - ]?.some((elem) => elem?.hasOwnProperty('user_id')); - if (!hasUserFilterInSanitize) { - sanitizedQueryParams.filters['$and'].push({ - user_id: ctx?.state?.user?.id, - }); - } - } else { - sanitizedQueryParams.filters['$and'].push({ - is_draft: false, - }); - } - ////////////////////////////// - - let proposalsList = []; - - const { results, pagination } = await strapi - .controller('api::proposal-content.proposal-content') - .find(sanitizedQueryParams); - - for (const proposalContent of results) { - const proposal = await strapi.entityService.findOne( - 'api::proposal.proposal', - proposalContent?.proposal_id - ); - - const proposalUser = await strapi - .query('plugin::users-permissions.user') - .findOne({ where: { id: +proposal?.user_id } }); - - if (proposalUser?.govtool_username) { - proposal.user_govtool_username = - proposalUser?.govtool_username; - } else { - proposal.user_govtool_username = 'Anonymous'; - } - - const transformedProposalContent = - this.transformResponse(proposalContent); - proposal.content = transformedProposalContent?.data; - proposalsList.push(proposal); - } - return this.transformResponse(proposalsList, { pagination }); - }, - async findOne(ctx) { - const { id } = ctx?.params; - - if (!id) { - return ctx.badRequest(null, 'Proposal ID is required'); - } - // const sanitizedQueryParams = await this.sanitizeQuery(ctx); - - const proposal = await strapi.entityService.findOne( - 'api::proposal.proposal', - id - ); - - if (!proposal) { - return ctx.badRequest(null, 'Proposal not found'); - } - - const proposalContent = await strapi - .controller('api::proposal-content.proposal-content') - .find({ - query: { - filters: { - proposal_id: proposal.id, - prop_rev_active: true, - }, - }, - }); - - if (proposalContent?.data?.length > 0) { - if (proposalContent?.data?.[0]?.attributes?.is_draft) { - return ctx.badRequest( - null, - 'You can not access draft proposal details.' - ); - } - proposal.content = proposalContent?.data?.[0]; - } else { - proposal.content = null; - } - - const proposalUser = await strapi - .query('plugin::users-permissions.user') - .findOne({ where: { id: +proposal?.user_id } }); - - if (proposalUser?.govtool_username) { - proposal.user_govtool_username = proposalUser?.govtool_username; - } else { - proposal.user_govtool_username = 'Anonymous'; - } - - return this.transformResponse(proposal); - }, - async create(ctx) { - const { data } = ctx?.request?.body; - const user = ctx?.state?.user; - const gov_action_type_id = data?.gov_action_type_id?.toString(); - if (!user) { - return ctx.badRequest(null, 'User is required'); - } - - let proposal; - let proposal_content; - // Delete the Prposal - const deleteProposal = async () => { - let deletedProposal = await strapi.entityService.delete( - 'api::proposal.proposal', - proposal?.id - ); - - if (!deletedProposal) { - return ctx.badRequest(null, 'Proposal not deleted'); - } - }; - - // Delete the Proposal Content - const deleteProposalContent = async () => { - let deletedProposal = await strapi.entityService.delete( - 'api::proposal-content.proposal-content', - proposal_content?.id - ); - - if (!deletedProposal) { - return ctx.badRequest(null, 'Proposal content not deleted'); - } - }; - - try { - // chek if treasuiry action have adress and amount - const gaTypes = await strapi.entityService.findOne( - 'api::governance-action-type.governance-action-type', - data?.gov_action_type_id - ); - // 2. Treasuty - if (gov_action_type_id == 2 && !data?.is_draft) { - // check if withdrawal parameters exist - if (data?.proposal_withdrawals?.length === 0) { - return ctx.badRequest( - null, - 'Withdrawal parametars not exist' - ); - } - // Check if data is invalid - const isInvalid = await Promise.all( - data.proposal_withdrawals.map(async (item) => { - return ( - !(await isRewardAddress( - item.prop_receiving_address - )) || - !item.prop_amount || - item.prop_amount <= 0 - ); - }) - ).then((results) => results.some((result) => result)); - if (isInvalid) - return ctx.badRequest( - null, - 'Withdrawal addrress or amount parametars not valid' - ); - } - // 3. Constitution - if (gov_action_type_id == 3 && !data?.is_draft) { - const { proposal_constitution_content } = data; - // Check if proposal_constitution_content exists - if (!proposal_constitution_content) { - return ctx.badRequest( - null, - 'proposal_constitution_content is required for Constitution action' - ); - } - // Validate prop_constitution_url (required and must be a valid URL) - const isValidUrl = (url) => { - try { - new URL(url); // Check if the URL is valid - return true; - } catch (e) { - return false; - } - }; - if ( - !proposal_constitution_content.prop_constitution_url || - !isValidUrl( - proposal_constitution_content.prop_constitution_url - ) - ) { - return ctx.badRequest( - null, - 'prop_constitution_url is required and must be a valid URL (IPFS is allowed)' - ); - } - // Validate prop_have_guardrails_script - if ( - proposal_constitution_content.prop_have_guardrails_script === - true - ) { - // If true, check if prop_guardrails_script_url and prop_guardrails_script_hash exist - if ( - !proposal_constitution_content.prop_guardrails_script_url || - !isValidUrl( - proposal_constitution_content.prop_guardrails_script_url - ) - ) { - return ctx.badRequest( - null, - 'prop_guardrails_script_url is required and must be a valid URL when prop_have_guardrails_script is true' - ); - } - if ( - !proposal_constitution_content.prop_guardrails_script_hash - ) { - return ctx.badRequest( - null, - 'prop_guardrails_script_hash is required when prop_have_guardrails_script is true' - ); - } - } else if ( - proposal_constitution_content.prop_have_guardrails_script === - false || - proposal_constitution_content.prop_have_guardrails_script === - null - ) { - // If false or null, check if prop_guardrails_script_url and prop_guardrails_script_hash are absent - if ( - proposal_constitution_content.prop_guardrails_script_url || - proposal_constitution_content.prop_guardrails_script_hash - ) { - return ctx.badRequest( - null, - 'prop_guardrails_script_url and prop_guardrails_script_hash must not be provided when prop_have_guardrails_script is false or null' - ); - } - } else { - proposal_constitution_content.prop_have_guardrails_script = false; - // If prop_have_guardrails_script is not a boolean or null, return an error - //return ctx.badRequest(null, "prop_have_guardrails_script must be a boolean or null"); - } - } - // Create the Proposal - try { - try { - proposal = await strapi.entityService.create( - 'api::proposal.proposal', - { - data: { - ...data, - user_id: user?.id?.toString(), - }, - } - ); - if (!proposal?.id) { - return ctx.badRequest( - null, - 'Proposal not created or missing ID' - ); - } - } catch (error) { - console.error('Error creating proposal:', error); - return ctx.badRequest(null, 'Proposal not created'); - } - try { - const proposalContentData = { - ...data, - proposal_id: proposal.id.toString(), - gov_action_type_id: - data?.gov_action_type_id?.toString(), - prop_rev_active: true, - user_id: user?.id?.toString(), - }; - // Only create proposal_constitution_content if gov_action_type_id is 3 - let proposalConstitutionContent = null; - if ( - gov_action_type_id == 3 && - data.proposal_constitution_content - ) { - proposalConstitutionContent = - await strapi.entityService.create( - 'api::proposal-constitution-content.proposal-constitution-content', - { - data: { - prop_constitution_url: - data - .proposal_constitution_content - .prop_constitution_url, - prop_have_guardrails_script: - data - .proposal_constitution_content - .prop_have_guardrails_script, - ...(data - .proposal_constitution_content - .prop_have_guardrails_script === - true && { - prop_guardrails_script_url: - data - .proposal_constitution_content - .prop_guardrails_script_url, - prop_guardrails_script_hash: - data - .proposal_constitution_content - .prop_guardrails_script_hash, - }), - }, - } - ); - if (!proposalConstitutionContent?.id) { - return ctx.badRequest( - null, - 'Proposal constitution content not created' - ); - } - // connect proposal_constitution_content with proposal_content - proposalContentData.proposal_constitution_content = - { - connect: [proposalConstitutionContent.id], // over ID - }; - } - proposal_content = await strapi.entityService.create( - 'api::proposal-content.proposal-content', - { - data: proposalContentData, - } - ); - } catch (error) { - console.error( - 'Error creating proposal content:', - error - ); - // Delete the Proposal because the Proposal content was not created - await deleteProposal(); - return ctx.badRequest( - null, - 'Proposal content not created' - ); - } - // proposal = await strapi.entityService.create( - // "api::proposal.proposal", - // { - // data: { - // ...data, - // user_id: user?.id?.toString(), - // }, - // } - // ); - - // if (!proposal) { - // return ctx.badRequest(null, "Proposal not created"); - // } - // } catch (error) { - // return ctx.badRequest(null, "Proposal not created"); - // } - - // // Create Proposal content - // try { - // proposal_content = await strapi.entityService.create( - // "api::proposal-content.proposal-content", - // { - // data: { - // ...data, - // proposal_id: proposal?.id.toString(), - // gov_action_type_id: data?.gov_action_type_id?.toString(), - // prop_rev_active: true, - // user_id: user?.id?.toString(), - // proposal_constitution_content: gov_action_type_id == 3 ? { - // prop_constitution_url: data.proposal_constitution_content.prop_constitution_url, - // prop_have_guardrails_script: data.proposal_constitution_content.prop_have_guardrails_script, - // ...(data.proposal_constitution_content.prop_have_guardrails_script === true && { - // prop_guardrails_script_url: data.proposal_constitution_content.prop_guardrails_script_url, - // prop_guardrails_script_hash: data.proposal_constitution_content.prop_guardrails_script_hash, - // }), - // } : null, // Only for gov_action_type_id == 3 - // }, - // } - // ); - } catch (error) { - // Delete the Proposal because the Proposal content was not created - await deleteProposal(); - - return ctx.badRequest(null, 'Proposal content not created'); - } - - return this.transformResponse({ - proposal_id: proposal.id, - proposal_content_id: proposal_content.id, - }); - - // Global error catch - } catch (error) { - proposal_content && (await deleteProposalContent()); - proposal && (await deleteProposal()); - ctx.status = 500; - ctx.body = { error: error, message: error.message }; - } - }, - async delete(ctx) { - const { id } = ctx.params; - try { - // Delete proposal - let deletedProposal = await strapi.entityService.delete( - 'api::proposal.proposal', - id - ); - - if (!deletedProposal) { - throw new Error('Proposal not found or delete failed'); - } - // Find all proposal-content entries related to the proposal - const proposalContents = await strapi.db - .query('api::proposal-content.proposal-content') - .findMany({ - where: { - proposal_id: id, - }, - populate: { - proposal_constitution_content: true, // Populate the related proposal_constitution_content - }, - }); - - // Delete all related proposal_constitution_content - for (const proposalContent of proposalContents) { - if (proposalContent.proposal_constitution_content) { - await strapi.entityService.delete( - 'api::proposal-constitution-content.proposal-constitution-content', - proposalContent.proposal_constitution_content.id - ); - } - } - // Delete proposal content - let deletedProposalContent = await strapi.db - .query('api::proposal-content.proposal-content') - .deleteMany({ - where: { - proposal_id: id, - }, - }); - - // Handling proposal submitions - await strapi.db - .query('api::proposal-submition.proposal-submition') - .deleteMany({ - where: { - proposal_id: id, - }, - }); - - // Delete proposal votes - await strapi.db - .query('api::proposal-vote.proposal-vote') - .deleteMany({ - where: { - proposal_id: id, - }, - }); - - // Delete comments - await strapi.db.query('api::comment.comment').deleteMany({ - where: { - proposal_id: id, - }, - }); - - // Handling polls and poll votes - const polls = await strapi.db.query('api::poll.poll').findMany({ - where: { - proposal_id: id, - }, - }); - - for (const poll of polls) { - await strapi.db - .query('api::poll-vote.poll-vote') - .deleteMany({ - where: { - poll_id: poll.id, - }, - }); - } - - await strapi.db.query('api::poll.poll').deleteMany({ - where: { - proposal_id: id, - }, - }); - - return this.transformResponse(deletedProposal); - } catch (error) { - return ctx.badRequest( - 'Failed to delete proposal and related data', - { - error: error.message, - } - ); - } - }, - }) + "api::proposal.proposal", + ({ strapi }) => ({ + async find(ctx) { + let sanitizedQueryParams = ctx.query; + if (!sanitizedQueryParams.filters) { + sanitizedQueryParams.filters = {}; + } + + if (!sanitizedQueryParams.filters["$and"]) { + sanitizedQueryParams.filters["$and"] = []; + } + + /////GOV ACTION TYPE/////////// + + const hasGovActionTypeIDFilter = sanitizedQueryParams.filters[ + "$and" + ]?.find((elem) => elem?.hasOwnProperty("gov_action_type_id")); + + if (hasGovActionTypeIDFilter) { + const hasGovActionTypeIDFilterInSanitize = + sanitizedQueryParams?.filters["$and"]?.some((elem) => + elem?.hasOwnProperty("gov_action_type_id") + ); + if (!hasGovActionTypeIDFilterInSanitize) { + sanitizedQueryParams.filters["$and"].push({ + gov_action_type_id: hasGovActionTypeIDFilter?.gov_action_type_id, + }); + } + } + ////////////////////////// + /////PROPOSAL NAME/////////// + const hasPropNameFilter = ctx?.query?.filters["$and"]?.find((elem) => + elem?.hasOwnProperty("prop_name") + ); + + if (hasPropNameFilter) { + const hasPropNameFilterInSanitize = sanitizedQueryParams?.filters[ + "$and" + ]?.some((elem) => elem?.hasOwnProperty("prop_name")); + if (!hasPropNameFilterInSanitize) { + sanitizedQueryParams.filters["$and"].push({ + prop_name: hasPropNameFilter?.prop_name, + }); + } + } + ////////////////////////////// + /////PROPOSAL SUBMITTED/////////// + const hasPropSubmitedFilter = ctx?.query?.filters["$and"]?.find((elem) => + elem?.hasOwnProperty("prop_submitted") + ); + + if (hasPropSubmitedFilter) { + const hasPropSubmitedFilterInSanitize = sanitizedQueryParams?.filters[ + "$and" + ]?.some((elem) => elem?.hasOwnProperty("prop_submitted")); + if (!hasPropSubmitedFilterInSanitize) { + if (hasPropSubmitedFilter?.prop_submitted === "true") { + sanitizedQueryParams.filters["$and"].push({ + prop_submitted: hasPropSubmitedFilter?.prop_submitted, + }); + } else { + sanitizedQueryParams.filters["$and"].push({ + $or: [ + { + prop_submitted: false, + }, + { + prop_submitted: { + $null: true, + }, + }, + ], + }); + } + } + } + ////////////////////////////// + /////PROPOSAL ID/////////// + const hasPropIdFilter = ctx?.query?.filters["$and"]?.find((elem) => + elem?.hasOwnProperty("prop_id") + ); + + if (hasPropIdFilter) { + const hasPropIdFilterInSanitize = sanitizedQueryParams?.filters[ + "$and" + ]?.some((elem) => elem?.hasOwnProperty("prop_id")); + + if (hasPropIdFilterInSanitize) { + sanitizedQueryParams.filters["$and"] = sanitizedQueryParams.filters[ + "$and" + ]?.filter((elem) => !elem?.hasOwnProperty("prop_id")); + + sanitizedQueryParams.filters["$and"].push({ + proposal_id: hasPropIdFilter?.prop_id, + }); + } + } else { + sanitizedQueryParams.filters["$and"].push({ + prop_rev_active: true, + }); + } + ////////////////////////////// + /////IS DRAFT/////////// + const hasIsDraftFilter = ctx?.query?.filters["$and"]?.find((elem) => + elem?.hasOwnProperty("is_draft") + ); + if (hasIsDraftFilter) { + if (!ctx?.state?.user) { + return ctx.badRequest(null, "User is required"); + } + const hasIsDraftFilterInSanitize = sanitizedQueryParams?.filters[ + "$and" + ]?.some((elem) => elem?.hasOwnProperty("is_draft")); + if (!hasIsDraftFilterInSanitize) { + sanitizedQueryParams.filters["$and"].push({ + is_draft: hasIsDraftFilter?.is_draft, + user_id: ctx?.state?.user?.id, + }); + } + const hasUserFilterInSanitize = sanitizedQueryParams?.filters[ + "$and" + ]?.some((elem) => elem?.hasOwnProperty("user_id")); + if (!hasUserFilterInSanitize) { + sanitizedQueryParams.filters["$and"].push({ + user_id: ctx?.state?.user?.id, + }); + } + } else { + sanitizedQueryParams.filters["$and"].push({ + is_draft: false, + }); + } + ////////////////////////////// + + let proposalsList = []; + + const { results, pagination } = await strapi + .controller("api::proposal-content.proposal-content") + .find(sanitizedQueryParams); + + for (const proposalContent of results) { + const proposal = await strapi.entityService.findOne( + "api::proposal.proposal", + proposalContent?.proposal_id + ); + + const proposalUser = await strapi + .query("plugin::users-permissions.user") + .findOne({ where: { id: +proposal?.user_id } }); + + if (proposalUser?.govtool_username) { + proposal.user_govtool_username = proposalUser?.govtool_username; + } else { + proposal.user_govtool_username = "Anonymous"; + } + + const transformedProposalContent = + this.transformResponse(proposalContent); + proposal.content = transformedProposalContent?.data; + proposalsList.push(proposal); + } + + return this.transformResponse(proposalsList, { pagination }); + }, + async findOne(ctx) { + const { id } = ctx?.params; + let proposal; + if (!id) { + return ctx.badRequest(null, "Proposal ID is required"); + } + try { + if(id.length !== 64) { + // const sanitizedQueryParams = await this.sanitizeQuery(ctx); + proposal = await strapi.entityService.findOne( + "api::proposal.proposal",id); + } else { + const proposalByHash = await strapi.entityService.findMany( + "api::proposal-content.proposal-content", + { + filters: { + prop_submission_tx_hash: { + $eq: id, + }, + }, + } + ); + if (!proposalByHash) { + return ctx.badRequest(null, "Proposal not found"); + } + let xid = parseInt(proposalByHash[0].proposal_id, 10); + proposal = await strapi.entityService.findOne( + "api::proposal.proposal", + xid + ); + } + + } + catch (error) { + return ctx.badRequest(null, "Proposal wit ID or Hash not found"); + } + if (!proposal) { + return ctx.badRequest(null, "Proposal not found"); + } + const proposalContent = await strapi + .controller("api::proposal-content.proposal-content") + .find({ + query: { + filters: { + proposal_id: proposal.id, + prop_rev_active: true, + }, + }, + }); + if (proposalContent?.data?.length > 0) { + if (proposalContent?.data?.[0]?.attributes?.is_draft) { + return ctx.badRequest( + null, + "You can not access draft proposal details." + ); + } + proposal.content = proposalContent?.data?.[0]; + } else { + proposal.content = null; + } + + const proposalUser = await strapi + .query("plugin::users-permissions.user") + .findOne({ where: { id: +proposal?.user_id } }); + + if (proposalUser?.govtool_username) { + proposal.user_govtool_username = proposalUser?.govtool_username; + } else { + proposal.user_govtool_username = "Anonymous"; + } + + return this.transformResponse(proposal); + }, + async create(ctx) { + const { data } = ctx?.request?.body; + const user = ctx?.state?.user; + const gov_action_type_id = data?.gov_action_type_id?.toString(); + if (!user) { + return ctx.badRequest(null, "User is required"); + } + + let proposal; + let proposal_content; + // Delete the Prposal + const deleteProposal = async () => { + let deletedProposal = await strapi.entityService.delete( + "api::proposal.proposal", + proposal?.id + ); + + if (!deletedProposal) { + return ctx.badRequest(null, "Proposal not deleted"); + } + }; + + // Delete the Proposal Content + const deleteProposalContent = async () => { + let deletedProposal = await strapi.entityService.delete( + "api::proposal-content.proposal-content", + proposal_content?.id + ); + + if (!deletedProposal) { + return ctx.badRequest(null, "Proposal content not deleted"); + } + }; + + try { + // chek if treasuiry action have adress and amount + const gaTypes = await strapi.entityService.findOne( + "api::governance-action-type.governance-action-type", + data?.gov_action_type_id + ); + // 2. Treasuty + if (gov_action_type_id == 2 && !data?.is_draft) { + // check if withdrawal parameters exist + if (data?.proposal_withdrawals?.length === 0) { + return ctx.badRequest(null, "Withdrawal parametars not exist"); + } + // Check if data is invalid + const isInvalid = await Promise.all( + data.proposal_withdrawals.map(async (item) => { + return ( + !(await isRewardAddress(item.prop_receiving_address)) || + !item.prop_amount || + item.prop_amount <= 0 + ); + }) + ).then((results) => results.some((result) => result)); + if (isInvalid) + return ctx.badRequest( + null, + "Withdrawal addrress or amount parametars not valid" + ); + } + // 3. Constitution + if (gov_action_type_id == 3 && !data?.is_draft) { + const { proposal_constitution_content } = data; + // Check if proposal_constitution_content exists + if (!proposal_constitution_content) { + return ctx.badRequest( + null, + "proposal_constitution_content is required for Constitution action" + ); + } + // Validate prop_constitution_url (required and must be a valid URL) + const isValidUrl = (url) => { + try { + new URL(url); // Check if the URL is valid + return true; + } catch (e) { + return false; + } + }; + if ( + !proposal_constitution_content.prop_constitution_url || + !isValidUrl(proposal_constitution_content.prop_constitution_url) + ) { + return ctx.badRequest( + null, + "prop_constitution_url is required and must be a valid URL (IPFS is allowed)" + ); + } + // Validate prop_have_guardrails_script + if ( + proposal_constitution_content.prop_have_guardrails_script === true + ) { + // If true, check if prop_guardrails_script_url and prop_guardrails_script_hash exist + if ( + !proposal_constitution_content.prop_guardrails_script_url || + !isValidUrl( + proposal_constitution_content.prop_guardrails_script_url + ) + ) { + return ctx.badRequest( + null, + "prop_guardrails_script_url is required and must be a valid URL when prop_have_guardrails_script is true" + ); + } + if (!proposal_constitution_content.prop_guardrails_script_hash) { + return ctx.badRequest( + null, + "prop_guardrails_script_hash is required when prop_have_guardrails_script is true" + ); + } + } else if ( + proposal_constitution_content.prop_have_guardrails_script === + false || + proposal_constitution_content.prop_have_guardrails_script === null + ) { + // If false or null, check if prop_guardrails_script_url and prop_guardrails_script_hash are absent + if ( + proposal_constitution_content.prop_guardrails_script_url || + proposal_constitution_content.prop_guardrails_script_hash + ) { + return ctx.badRequest( + null, + "prop_guardrails_script_url and prop_guardrails_script_hash must not be provided when prop_have_guardrails_script is false or null" + ); + } + } else { + proposal_constitution_content.prop_have_guardrails_script = false; + // If prop_have_guardrails_script is not a boolean or null, return an error + //return ctx.badRequest(null, "prop_have_guardrails_script must be a boolean or null"); + } + } + // Create the Proposal + try { + try { + proposal = await strapi.entityService.create( + "api::proposal.proposal", + { + data: { + ...data, + user_id: user?.id?.toString(), + }, + } + ); + if (!proposal?.id) { + return ctx.badRequest(null, "Proposal not created or missing ID"); + } + } catch (error) { + console.error("Error creating proposal:", error); + return ctx.badRequest(null, "Proposal not created"); + } + try { + const proposalContentData = { + ...data, + proposal_id: proposal.id.toString(), + gov_action_type_id: data?.gov_action_type_id?.toString(), + prop_rev_active: true, + user_id: user?.id?.toString(), + proposal: proposal?.id, + }; + // Only create proposal_constitution_content if gov_action_type_id is 3 + let proposalConstitutionContent = null; + if (gov_action_type_id == 3 && data.proposal_constitution_content) { + proposalConstitutionContent = await strapi.entityService.create( + "api::proposal-constitution-content.proposal-constitution-content", + { + data: { + prop_constitution_url: + data.proposal_constitution_content.prop_constitution_url, + prop_have_guardrails_script: + data.proposal_constitution_content + .prop_have_guardrails_script, + ...(data.proposal_constitution_content + .prop_have_guardrails_script === true && { + prop_guardrails_script_url: + data.proposal_constitution_content + .prop_guardrails_script_url, + prop_guardrails_script_hash: + data.proposal_constitution_content + .prop_guardrails_script_hash, + }), + }, + } + ); + if (!proposalConstitutionContent?.id) { + return ctx.badRequest( + null, + "Proposal constitution content not created" + ); + } + // connect proposal_constitution_content with proposal_content + proposalContentData.proposal_constitution_content = { + connect: [proposalConstitutionContent.id], // over ID + }; + } + proposal_content = await strapi.entityService.create( + "api::proposal-content.proposal-content", + { + data: proposalContentData, + } + ); + } catch (error) { + console.error("Error creating proposal content:", error); + // Delete the Proposal because the Proposal content was not created + await deleteProposal(); + return ctx.badRequest(null, "Proposal content not created"); + } + // proposal = await strapi.entityService.create( + // "api::proposal.proposal", + // { + // data: { + // ...data, + // user_id: user?.id?.toString(), + // }, + // } + // ); + + // if (!proposal) { + // return ctx.badRequest(null, "Proposal not created"); + // } + // } catch (error) { + // return ctx.badRequest(null, "Proposal not created"); + // } + + // // Create Proposal content + // try { + // proposal_content = await strapi.entityService.create( + // "api::proposal-content.proposal-content", + // { + // data: { + // ...data, + // proposal_id: proposal?.id.toString(), + // gov_action_type_id: data?.gov_action_type_id?.toString(), + // prop_rev_active: true, + // user_id: user?.id?.toString(), + // proposal_constitution_content: gov_action_type_id == 3 ? { + // prop_constitution_url: data.proposal_constitution_content.prop_constitution_url, + // prop_have_guardrails_script: data.proposal_constitution_content.prop_have_guardrails_script, + // ...(data.proposal_constitution_content.prop_have_guardrails_script === true && { + // prop_guardrails_script_url: data.proposal_constitution_content.prop_guardrails_script_url, + // prop_guardrails_script_hash: data.proposal_constitution_content.prop_guardrails_script_hash, + // }), + // } : null, // Only for gov_action_type_id == 3 + // }, + // } + // ); + } catch (error) { + // Delete the Proposal because the Proposal content was not created + await deleteProposal(); + + return ctx.badRequest(null, "Proposal content not created"); + } + + return this.transformResponse({ + proposal_id: proposal.id, + proposal_content_id: proposal_content.id, + }); + + // Global error catch + } catch (error) { + proposal_content && (await deleteProposalContent()); + proposal && (await deleteProposal()); + ctx.status = 500; + ctx.body = { error: error, message: error.message }; + } + }, + async delete(ctx) { + const { id } = ctx.params; + try { + // Delete proposal + let deletedProposal = await strapi.entityService.delete( + "api::proposal.proposal", + id + ); + + if (!deletedProposal) { + throw new Error("Proposal not found or delete failed"); + } + // Find all proposal-content entries related to the proposal + const proposalContents = await strapi.db + .query("api::proposal-content.proposal-content") + .findMany({ + where: { + proposal_id: id, + }, + populate: { + proposal_constitution_content: true, // Populate the related proposal_constitution_content + }, + }); + + // Delete all related proposal_constitution_content + for (const proposalContent of proposalContents) { + if (proposalContent.proposal_constitution_content) { + await strapi.entityService.delete( + "api::proposal-constitution-content.proposal-constitution-content", + proposalContent.proposal_constitution_content.id + ); + } + } + // Delete proposal content + let deletedProposalContent = await strapi.db + .query("api::proposal-content.proposal-content") + .deleteMany({ + where: { + proposal_id: id, + }, + }); + + // Handling proposal submitions + await strapi.db + .query("api::proposal-submition.proposal-submition") + .deleteMany({ + where: { + proposal_id: id, + }, + }); + + // Delete proposal votes + await strapi.db.query("api::proposal-vote.proposal-vote").deleteMany({ + where: { + proposal_id: id, + }, + }); + + // Delete comments + await strapi.db.query("api::comment.comment").deleteMany({ + where: { + proposal_id: id, + }, + }); + + // Handling polls and poll votes + const polls = await strapi.db.query("api::poll.poll").findMany({ + where: { + proposal_id: id, + }, + }); + + for (const poll of polls) { + await strapi.db.query("api::poll-vote.poll-vote").deleteMany({ + where: { + poll_id: poll.id, + }, + }); + } + + await strapi.db.query("api::poll.poll").deleteMany({ + where: { + proposal_id: id, + }, + }); + + return this.transformResponse(deletedProposal); + } catch (error) { + return ctx.badRequest("Failed to delete proposal and related data", { + error: error.message, + }); + } + }, + }) ); diff --git a/backend/src/api/proxy/controllers/proxy.js b/backend/src/api/proxy/controllers/proxy.js index 3de9bd3..134fec0 100644 --- a/backend/src/api/proxy/controllers/proxy.js +++ b/backend/src/api/proxy/controllers/proxy.js @@ -1,69 +1,80 @@ -'use strict'; -const axios = require('axios'); +"use strict"; +const axios = require("axios"); module.exports = { // POST /proxy async forward(ctx) { + console.log("🚀 ~ forward ~ ctx:", ctx); try { - console.log(ctx.request.body); - const { url, method = 'GET', data = {}, params = {}, headers = {} } = ctx.request.body; + const { + url, + method = "GET", + data = {}, + params = {}, + headers = {}, + } = ctx.request.body; const response = await axios({ url, method, data, params, headers }); ctx.send({ status: response.status, data: response.data }); } catch (error) { - strapi.log.error('Proxy error:', error); + strapi.log.error("Proxy error:", error); ctx.status = error.response?.status || 500; - ctx.body = { error: error.message, details: error.response?.data || null }; + ctx.body = { + error: error.message, + details: error.response?.data || null, + }; } }, // GET /proxy/govtool/:endpoint* async getGovtoolData(ctx) { try { - const endpoint = ctx.params.endpoint; - if (!endpoint) return ctx.badRequest('Endpoint is required'); - console.log(endpoint); + if (!endpoint) return ctx.badRequest("Endpoint is required"); + console.log(endpoint); const baseUrl = process.env.GOVTOOL_API_BASE_URL; - const fullUrl = `${baseUrl.replace(/\/$/, '')}/${endpoint}`; -console.log(fullUrl); + const fullUrl = `${baseUrl.replace(/\/$/, "")}/${endpoint}`; + console.log(fullUrl); const response = await axios.get(fullUrl, { params: ctx.query, headers: { - // Authorization: `Bearer ${process.env.GOVTOOL_API_TOKEN}`, + // Authorization: `Bearer ${process.env.GOVTOOL_API_TOKEN}`, }, }); ctx.send({ status: response.status, data: response.data }); } catch (error) { - strapi.log.error('GovTool GET error:', error); + strapi.log.error("GovTool GET error:", error); ctx.status = error.response?.status || 500; - ctx.body = { error: error.message, details: error.response?.data || null }; + ctx.body = { + error: error.message, + details: error.response?.data || null, + }; } }, - async postGovtoolData(ctx) { + async postGovtoolData(ctx) { try { - const endpoint = ctx.params.endpoint; - if (!endpoint) return ctx.badRequest('Endpoint is required'); + const endpoint = ctx.params.endpoint; + if (!endpoint) return ctx.badRequest("Endpoint is required"); - const baseUrl = process.env.GOVTOOL_API_BASE_URL; - const fullUrl = `${baseUrl.replace(/\/$/, '')}/${endpoint}`; + const baseUrl = process.env.GOVTOOL_API_BASE_URL; + const fullUrl = `${baseUrl.replace(/\/$/, "")}/${endpoint}`; - const response = await axios.post(fullUrl, ctx.request.body, { + const response = await axios.post(fullUrl, ctx.request.body, { headers: { - 'Content-Type': 'application/json', - // Authorization: `Bearer ${process.env.GOVTOOL_API_TOKEN}`, + "Content-Type": "application/json", + // Authorization: `Bearer ${process.env.GOVTOOL_API_TOKEN}`, }, - }); + }); - ctx.send({ status: response.status, data: response.data }); + ctx.send({ status: response.status, data: response.data }); } catch (error) { - strapi.log.error('GovTool POST error:', error); - ctx.status = error.response?.status || 500; - ctx.body = { + strapi.log.error("GovTool POST error:", error); + ctx.status = error.response?.status || 500; + ctx.body = { error: error.message, details: error.response?.data || null, - }; + }; } - } -}; \ No newline at end of file + }, +}; diff --git a/backend/src/components/bd/bd-links.json b/backend/src/components/bd/bd-links.json index 6eef1df..3174f67 100644 --- a/backend/src/components/bd/bd-links.json +++ b/backend/src/components/bd/bd-links.json @@ -7,10 +7,12 @@ "options": {}, "attributes": { "prop_link": { - "type": "string" + "type": "text", + "maxLength": 2048 }, "prop_link_text": { - "type": "string" + "type": "string", + "maxLength": 255 } } } diff --git a/backend/src/components/proposal/proposal-link.json b/backend/src/components/proposal/proposal-link.json index 6b6a9f0..c354bd7 100644 --- a/backend/src/components/proposal/proposal-link.json +++ b/backend/src/components/proposal/proposal-link.json @@ -6,12 +6,13 @@ }, "options": {}, "attributes": { - "prop_link": { - "type": "text", - "maxLength": 300 - }, - "prop_link_text": { - "type": "string" - } + "prop_link": { + "type": "text", + "maxLength": 2048 + }, + "prop_link_text": { + "type": "string", + "maxLength": 255 + } } } diff --git a/backend/src/extensions/documentation/documentation/1.0.0/full_documentation.json b/backend/src/extensions/documentation/documentation/1.0.0/full_documentation.json index 3aaa86f..64c1c2e 100644 --- a/backend/src/extensions/documentation/documentation/1.0.0/full_documentation.json +++ b/backend/src/extensions/documentation/documentation/1.0.0/full_documentation.json @@ -13,10 +13,12 @@ "name": "Apache 2.0", "url": "https://www.apache.org/licenses/LICENSE-2.0.html" }, - "x-generation-date": "2025-04-30T09:53:57.423Z" + "x-generation-date": "2025-05-30T11:01:02.957Z" }, "x-strapi-config": { - "plugins": [], + "plugins": [ + "users-permissions" + ], "path": "/documentation" }, "openapi": "3.0.0", @@ -625,6 +627,10 @@ }, "master_id": { "type": "string" + }, + "submitted_for_vote": { + "type": "string", + "format": "date-time" } } } @@ -2495,6 +2501,10 @@ "master_id": { "type": "string" }, + "submitted_for_vote": { + "type": "string", + "format": "date-time" + }, "createdAt": { "type": "string", "format": "date-time" @@ -2555,6 +2565,10 @@ "master_id": { "type": "string" }, + "submitted_for_vote": { + "type": "string", + "format": "date-time" + }, "createdAt": { "type": "string", "format": "date-time" @@ -12830,6 +12844,20 @@ }, "user_id": { "type": "string" + }, + "proposal_contents": { + "type": "array", + "items": { + "oneOf": [ + { + "type": "integer" + }, + { + "type": "string" + } + ], + "example": "string or id" + } } } } @@ -12899,54 +12927,96 @@ "user_id": { "type": "string" }, - "createdAt": { - "type": "string", - "format": "date-time" - }, - "updatedAt": { - "type": "string", - "format": "date-time" - }, - "createdBy": { + "proposal_contents": { "type": "object", "properties": { "data": { - "type": "object", - "properties": { - "id": { - "type": "number" - }, - "attributes": { - "type": "object", - "properties": { - "firstname": { - "type": "string" - }, - "lastname": { - "type": "string" - }, - "username": { - "type": "string" - }, - "email": { - "type": "string", - "format": "email" - }, - "resetPasswordToken": { - "type": "string" - }, - "registrationToken": { - "type": "string" - }, - "isActive": { - "type": "boolean" - }, - "roles": { - "type": "object", - "properties": { - "data": { - "type": "array", - "items": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "type": "object", + "properties": { + "proposal_id": { + "type": "string" + }, + "prop_rev_active": { + "type": "boolean" + }, + "prop_abstract": { + "type": "string" + }, + "prop_motivation": { + "type": "string" + }, + "prop_rationale": { + "type": "string" + }, + "gov_action_type_id": { + "type": "string" + }, + "prop_name": { + "type": "string" + }, + "proposal_links": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "prop_link": { + "type": "string" + }, + "prop_link_text": { + "type": "string" + } + } + } + }, + "is_draft": { + "type": "boolean" + }, + "user_id": { + "type": "string" + }, + "prop_submitted": { + "type": "boolean" + }, + "prop_submission_tx_hash": { + "type": "string" + }, + "prop_submission_date": { + "type": "string", + "format": "date" + }, + "proposal_withdrawals": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "prop_receiving_address": { + "type": "string" + }, + "prop_amount": { + "type": "number", + "format": "float" + } + } + } + }, + "proposal_constitution_content": { + "type": "object", + "properties": { + "data": { "type": "object", "properties": { "id": { @@ -12955,119 +13025,30 @@ "attributes": { "type": "object", "properties": { - "name": { + "prop_constitution_url": { "type": "string" }, - "code": { - "type": "string" + "prop_have_guardrails_script": { + "type": "boolean" }, - "description": { + "prop_guardrails_script_url": { "type": "string" }, - "users": { - "type": "object", - "properties": { - "data": { - "type": "array", - "items": { - "type": "object", - "properties": { - "id": { - "type": "number" - }, - "attributes": { - "type": "object", - "properties": {} - } - } - } - } - } + "prop_guardrails_script_hash": { + "type": "string" }, - "permissions": { + "proposal_content": { "type": "object", "properties": { "data": { - "type": "array", - "items": { - "type": "object", - "properties": { - "id": { - "type": "number" - }, - "attributes": { - "type": "object", - "properties": { - "action": { - "type": "string" - }, - "actionParameters": {}, - "subject": { - "type": "string" - }, - "properties": {}, - "conditions": {}, - "role": { - "type": "object", - "properties": { - "data": { - "type": "object", - "properties": { - "id": { - "type": "number" - }, - "attributes": { - "type": "object", - "properties": {} - } - } - } - } - }, - "createdAt": { - "type": "string", - "format": "date-time" - }, - "updatedAt": { - "type": "string", - "format": "date-time" - }, - "createdBy": { - "type": "object", - "properties": { - "data": { - "type": "object", - "properties": { - "id": { - "type": "number" - }, - "attributes": { - "type": "object", - "properties": {} - } - } - } - } - }, - "updatedBy": { - "type": "object", - "properties": { - "data": { - "type": "object", - "properties": { - "id": { - "type": "number" - }, - "attributes": { - "type": "object", - "properties": {} - } - } - } - } - } - } - } + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "type": "object", + "properties": {} } } } @@ -13092,113 +13073,568 @@ }, "attributes": { "type": "object", - "properties": {} - } - } - } - } - }, - "updatedBy": { - "type": "object", - "properties": { - "data": { - "type": "object", - "properties": { - "id": { - "type": "number" - }, - "attributes": { - "type": "object", - "properties": {} + "properties": { + "firstname": { + "type": "string" + }, + "lastname": { + "type": "string" + }, + "username": { + "type": "string" + }, + "email": { + "type": "string", + "format": "email" + }, + "resetPasswordToken": { + "type": "string" + }, + "registrationToken": { + "type": "string" + }, + "isActive": { + "type": "boolean" + }, + "roles": { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "code": { + "type": "string" + }, + "description": { + "type": "string" + }, + "users": { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "type": "object", + "properties": {} + } + } + } + } + } + }, + "permissions": { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "type": "object", + "properties": { + "action": { + "type": "string" + }, + "actionParameters": {}, + "subject": { + "type": "string" + }, + "properties": {}, + "conditions": {}, + "role": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "type": "object", + "properties": {} + } + } + } + } + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "updatedAt": { + "type": "string", + "format": "date-time" + }, + "createdBy": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "type": "object", + "properties": {} + } + } + } + } + }, + "updatedBy": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "type": "object", + "properties": {} + } + } + } + } + } + } + } + } + } + } + } + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "updatedAt": { + "type": "string", + "format": "date-time" + }, + "createdBy": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "type": "object", + "properties": {} + } + } + } + } + }, + "updatedBy": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "type": "object", + "properties": {} + } + } + } + } + } + } + } + } + } + } + } + }, + "blocked": { + "type": "boolean" + }, + "preferedLanguage": { + "type": "string" + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "updatedAt": { + "type": "string", + "format": "date-time" + }, + "createdBy": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "type": "object", + "properties": {} + } + } + } + } + }, + "updatedBy": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "type": "object", + "properties": {} + } + } + } + } + } + } } } } } - } - } - } + }, + "updatedBy": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "type": "object", + "properties": {} + } + } + } + } + } + } + } } } } - } - }, - "blocked": { - "type": "boolean" - }, - "preferedLanguage": { - "type": "string" - }, - "createdAt": { - "type": "string", - "format": "date-time" - }, - "updatedAt": { - "type": "string", - "format": "date-time" - }, - "createdBy": { - "type": "object", - "properties": { - "data": { - "type": "object", - "properties": { - "id": { - "type": "number" - }, - "attributes": { - "type": "object", - "properties": {} + }, + "is_locked": { + "type": "boolean" + }, + "proposal_hard_fork_content": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "type": "object", + "properties": { + "previous_ga_hash": { + "type": "string" + }, + "previous_ga_id": { + "type": "string" + }, + "major": { + "type": "string" + }, + "minor": { + "type": "string" + }, + "proposal_content": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "type": "object", + "properties": {} + } + } + } + } + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "updatedAt": { + "type": "string", + "format": "date-time" + }, + "createdBy": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "type": "object", + "properties": {} + } + } + } + } + }, + "updatedBy": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "type": "object", + "properties": {} + } + } + } + } + } + } + } } } } - } - }, - "updatedBy": { - "type": "object", - "properties": { - "data": { - "type": "object", - "properties": { - "id": { - "type": "number" - }, - "attributes": { - "type": "object", - "properties": {} + }, + "proposal": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "type": "object", + "properties": { + "prop_likes": { + "type": "integer" + }, + "prop_dislikes": { + "type": "integer" + }, + "prop_comments_number": { + "type": "integer" + }, + "user_id": { + "type": "string" + }, + "proposal_contents": { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "type": "object", + "properties": {} + } + } + } + } + } + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "updatedAt": { + "type": "string", + "format": "date-time" + }, + "createdBy": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "type": "object", + "properties": {} + } + } + } + } + }, + "updatedBy": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "type": "object", + "properties": {} + } + } + } + } + } + } + } } } } - } - } - } - } - } - } - } - }, - "updatedBy": { - "type": "object", - "properties": { - "data": { - "type": "object", - "properties": { - "id": { - "type": "number" - }, - "attributes": { - "type": "object", - "properties": {} - } - } - } - } - } - } - }, - "ProposalResponseDataObject": { - "type": "object", - "properties": { - "id": { + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "updatedAt": { + "type": "string", + "format": "date-time" + }, + "createdBy": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "type": "object", + "properties": {} + } + } + } + } + }, + "updatedBy": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "type": "object", + "properties": {} + } + } + } + } + } + } + } + } + } + } + } + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "updatedAt": { + "type": "string", + "format": "date-time" + }, + "createdBy": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "type": "object", + "properties": {} + } + } + } + } + }, + "updatedBy": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "type": "object", + "properties": {} + } + } + } + } + } + } + }, + "ProposalResponseDataObject": { + "type": "object", + "properties": { + "id": { "type": "number" }, "attributes": { @@ -13739,15 +14175,10 @@ } } }, - "createdAt": { - "type": "string", - "format": "date-time" - }, - "updatedAt": { - "type": "string", - "format": "date-time" + "is_locked": { + "type": "boolean" }, - "createdBy": { + "proposal_hard_fork_content": { "type": "object", "properties": { "data": { @@ -13758,13 +14189,85 @@ }, "attributes": { "type": "object", - "properties": {} + "properties": { + "previous_ga_hash": { + "type": "string" + }, + "previous_ga_id": { + "type": "string" + }, + "major": { + "type": "string" + }, + "minor": { + "type": "string" + }, + "proposal_content": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "type": "object", + "properties": {} + } + } + } + } + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "updatedAt": { + "type": "string", + "format": "date-time" + }, + "createdBy": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "type": "object", + "properties": {} + } + } + } + } + }, + "updatedBy": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "type": "object", + "properties": {} + } + } + } + } + } + } } } } } }, - "updatedBy": { + "proposal": { "type": "object", "properties": { "data": { @@ -13775,19 +14278,136 @@ }, "attributes": { "type": "object", - "properties": {} + "properties": { + "prop_likes": { + "type": "integer" + }, + "prop_dislikes": { + "type": "integer" + }, + "prop_comments_number": { + "type": "integer" + }, + "user_id": { + "type": "string" + }, + "proposal_contents": { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "type": "object", + "properties": {} + } + } + } + } + } + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "updatedAt": { + "type": "string", + "format": "date-time" + }, + "createdBy": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "type": "object", + "properties": {} + } + } + } + } + }, + "updatedBy": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "type": "object", + "properties": {} + } + } + } + } + } + } } } } } - } - } - } - } - } - } - }, - "createdAt": { + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "updatedAt": { + "type": "string", + "format": "date-time" + }, + "createdBy": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "type": "object", + "properties": {} + } + } + } + } + }, + "updatedBy": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "type": "object", + "properties": {} + } + } + } + } + } + } + } + } + } + } + }, + "createdAt": { "type": "string", "format": "date-time" }, @@ -13925,6 +14545,31 @@ } ], "example": "string or id" + }, + "is_locked": { + "type": "boolean" + }, + "proposal_hard_fork_content": { + "oneOf": [ + { + "type": "integer" + }, + { + "type": "string" + } + ], + "example": "string or id" + }, + "proposal": { + "oneOf": [ + { + "type": "integer" + }, + { + "type": "string" + } + ], + "example": "string or id" } } } @@ -14157,15 +14802,10 @@ } } }, - "createdAt": { - "type": "string", - "format": "date-time" - }, - "updatedAt": { - "type": "string", - "format": "date-time" + "is_locked": { + "type": "boolean" }, - "createdBy": { + "proposal_hard_fork_content": { "type": "object", "properties": { "data": { @@ -14177,123 +14817,106 @@ "attributes": { "type": "object", "properties": { - "firstname": { + "previous_ga_hash": { "type": "string" }, - "lastname": { + "previous_ga_id": { "type": "string" }, - "username": { + "major": { "type": "string" }, - "email": { - "type": "string", - "format": "email" - }, - "resetPasswordToken": { + "minor": { "type": "string" }, - "registrationToken": { - "type": "string" + "proposal_content": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "type": "object", + "properties": {} + } + } + } + } }, - "isActive": { - "type": "boolean" + "createdAt": { + "type": "string", + "format": "date-time" }, - "roles": { + "updatedAt": { + "type": "string", + "format": "date-time" + }, + "createdBy": { "type": "object", "properties": { "data": { - "type": "array", - "items": { - "type": "object", - "properties": { - "id": { - "type": "number" - }, - "attributes": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "code": { - "type": "string" - }, - "description": { - "type": "string" - }, - "users": { - "type": "object", - "properties": { - "data": { - "type": "array", - "items": { - "type": "object", - "properties": { - "id": { - "type": "number" - }, - "attributes": { - "type": "object", - "properties": {} - } - } - } - } - } - }, - "permissions": { - "type": "object", - "properties": { - "data": { - "type": "array", - "items": { - "type": "object", - "properties": { - "id": { - "type": "number" - }, - "attributes": { - "type": "object", - "properties": { - "action": { - "type": "string" - }, - "actionParameters": {}, - "subject": { - "type": "string" - }, - "properties": {}, - "conditions": {}, - "role": { - "type": "object", - "properties": { - "data": { - "type": "object", - "properties": { - "id": { - "type": "number" - }, - "attributes": { - "type": "object", - "properties": {} - } - } - } - } - }, - "createdAt": { - "type": "string", - "format": "date-time" - }, - "updatedAt": { - "type": "string", - "format": "date-time" - }, - "createdBy": { - "type": "object", - "properties": { - "data": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "type": "object", + "properties": { + "firstname": { + "type": "string" + }, + "lastname": { + "type": "string" + }, + "username": { + "type": "string" + }, + "email": { + "type": "string", + "format": "email" + }, + "resetPasswordToken": { + "type": "string" + }, + "registrationToken": { + "type": "string" + }, + "isActive": { + "type": "boolean" + }, + "roles": { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "code": { + "type": "string" + }, + "description": { + "type": "string" + }, + "users": { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { "type": "object", "properties": { "id": { @@ -14306,11 +14929,14 @@ } } } - }, - "updatedBy": { - "type": "object", - "properties": { - "data": { + } + }, + "permissions": { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { "type": "object", "properties": { "id": { @@ -14318,57 +14944,174 @@ }, "attributes": { "type": "object", - "properties": {} - } - } - } - } - } - } - } - } + "properties": { + "action": { + "type": "string" + }, + "actionParameters": {}, + "subject": { + "type": "string" + }, + "properties": {}, + "conditions": {}, + "role": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "type": "object", + "properties": {} + } + } + } + } + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "updatedAt": { + "type": "string", + "format": "date-time" + }, + "createdBy": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "type": "object", + "properties": {} + } + } + } + } + }, + "updatedBy": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "type": "object", + "properties": {} + } + } + } + } + } + } + } + } + } + } + } + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "updatedAt": { + "type": "string", + "format": "date-time" + }, + "createdBy": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "type": "object", + "properties": {} + } + } + } + } + }, + "updatedBy": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "type": "object", + "properties": {} + } + } + } + } + } + } + } } } } - }, - "createdAt": { - "type": "string", - "format": "date-time" - }, - "updatedAt": { - "type": "string", - "format": "date-time" - }, - "createdBy": { - "type": "object", - "properties": { - "data": { - "type": "object", - "properties": { - "id": { - "type": "number" - }, - "attributes": { - "type": "object", - "properties": {} - } + } + }, + "blocked": { + "type": "boolean" + }, + "preferedLanguage": { + "type": "string" + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "updatedAt": { + "type": "string", + "format": "date-time" + }, + "createdBy": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "type": "object", + "properties": {} } } } - }, - "updatedBy": { - "type": "object", - "properties": { - "data": { - "type": "object", - "properties": { - "id": { - "type": "number" - }, - "attributes": { - "type": "object", - "properties": {} - } + } + }, + "updatedBy": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "type": "object", + "properties": {} } } } @@ -14380,12 +15123,73 @@ } } }, - "blocked": { - "type": "boolean" + "updatedBy": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "type": "object", + "properties": {} + } + } + } + } + } + } + } + } + } + } + }, + "proposal": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "type": "object", + "properties": { + "prop_likes": { + "type": "integer" }, - "preferedLanguage": { + "prop_dislikes": { + "type": "integer" + }, + "prop_comments_number": { + "type": "integer" + }, + "user_id": { "type": "string" }, + "proposal_contents": { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "type": "object", + "properties": {} + } + } + } + } + } + }, "createdAt": { "type": "string", "format": "date-time" @@ -14434,6 +15238,31 @@ } } }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "updatedAt": { + "type": "string", + "format": "date-time" + }, + "createdBy": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "type": "object", + "properties": {} + } + } + } + } + }, "updatedBy": { "type": "object", "properties": { @@ -14505,15 +15334,10 @@ } } }, - "createdAt": { - "type": "string", - "format": "date-time" - }, - "updatedAt": { - "type": "string", - "format": "date-time" + "is_locked": { + "type": "boolean" }, - "createdBy": { + "proposal_hard_fork_content": { "type": "object", "properties": { "data": { @@ -14530,7 +15354,7 @@ } } }, - "updatedBy": { + "proposal": { "type": "object", "properties": { "data": { @@ -14546,22 +15370,64 @@ } } } - } - } - }, - "ProposalContentResponseDataObject": { - "type": "object", - "properties": { - "id": { - "type": "number" }, - "attributes": { - "$ref": "#/components/schemas/ProposalContent" - } - } - }, - "ProposalContentResponse": { - "type": "object", + "createdAt": { + "type": "string", + "format": "date-time" + }, + "updatedAt": { + "type": "string", + "format": "date-time" + }, + "createdBy": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "type": "object", + "properties": {} + } + } + } + } + }, + "updatedBy": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "type": "object", + "properties": {} + } + } + } + } + } + } + }, + "ProposalContentResponseDataObject": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "$ref": "#/components/schemas/ProposalContent" + } + } + }, + "ProposalContentResponse": { + "type": "object", "properties": { "data": { "$ref": "#/components/schemas/ProposalContentResponseDataObject" @@ -14600,7 +15466,7 @@ } } }, - "ProposalSubmitionRequest": { + "ProposalHardForkContentRequest": { "type": "object", "required": [ "data" @@ -14609,35 +15475,51 @@ "data": { "type": "object", "properties": { - "proposal_id": { + "previous_ga_hash": { "type": "string" }, - "sub_json_path": {}, - "sub_location_url": { + "previous_ga_id": { + "type": "string" + }, + "major": { + "type": "string" + }, + "minor": { "type": "string" + }, + "proposal_content": { + "oneOf": [ + { + "type": "integer" + }, + { + "type": "string" + } + ], + "example": "string or id" } } } } }, - "ProposalSubmitionListResponseDataItem": { + "ProposalHardForkContentListResponseDataItem": { "type": "object", "properties": { "id": { "type": "number" }, "attributes": { - "$ref": "#/components/schemas/ProposalSubmition" + "$ref": "#/components/schemas/ProposalHardForkContent" } } }, - "ProposalSubmitionListResponse": { + "ProposalHardForkContentListResponse": { "type": "object", "properties": { "data": { "type": "array", "items": { - "$ref": "#/components/schemas/ProposalSubmitionListResponseDataItem" + "$ref": "#/components/schemas/ProposalHardForkContentListResponseDataItem" } }, "meta": { @@ -14666,25 +15548,22 @@ } } }, - "ProposalSubmition": { + "ProposalHardForkContent": { "type": "object", "properties": { - "proposal_id": { + "previous_ga_hash": { "type": "string" }, - "sub_json_path": {}, - "sub_location_url": { + "previous_ga_id": { "type": "string" }, - "createdAt": { - "type": "string", - "format": "date-time" + "major": { + "type": "string" }, - "updatedAt": { - "type": "string", - "format": "date-time" + "minor": { + "type": "string" }, - "createdBy": { + "proposal_content": { "type": "object", "properties": { "data": { @@ -14696,150 +15575,385 @@ "attributes": { "type": "object", "properties": { - "firstname": { + "proposal_id": { "type": "string" }, - "lastname": { + "prop_rev_active": { + "type": "boolean" + }, + "prop_abstract": { "type": "string" }, - "username": { + "prop_motivation": { "type": "string" }, - "email": { - "type": "string", - "format": "email" + "prop_rationale": { + "type": "string" }, - "resetPasswordToken": { + "gov_action_type_id": { "type": "string" }, - "registrationToken": { + "prop_name": { "type": "string" }, - "isActive": { + "proposal_links": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "prop_link": { + "type": "string" + }, + "prop_link_text": { + "type": "string" + } + } + } + }, + "is_draft": { "type": "boolean" }, - "roles": { + "user_id": { + "type": "string" + }, + "prop_submitted": { + "type": "boolean" + }, + "prop_submission_tx_hash": { + "type": "string" + }, + "prop_submission_date": { + "type": "string", + "format": "date" + }, + "proposal_withdrawals": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "prop_receiving_address": { + "type": "string" + }, + "prop_amount": { + "type": "number", + "format": "float" + } + } + } + }, + "proposal_constitution_content": { "type": "object", "properties": { "data": { - "type": "array", - "items": { - "type": "object", - "properties": { - "id": { - "type": "number" - }, - "attributes": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "code": { - "type": "string" - }, - "description": { - "type": "string" - }, - "users": { - "type": "object", - "properties": { - "data": { - "type": "array", - "items": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "type": "object", + "properties": { + "prop_constitution_url": { + "type": "string" + }, + "prop_have_guardrails_script": { + "type": "boolean" + }, + "prop_guardrails_script_url": { + "type": "string" + }, + "prop_guardrails_script_hash": { + "type": "string" + }, + "proposal_content": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { "type": "object", - "properties": { - "id": { - "type": "number" - }, - "attributes": { - "type": "object", - "properties": {} - } - } + "properties": {} } } } - }, - "permissions": { - "type": "object", - "properties": { - "data": { - "type": "array", - "items": { + } + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "updatedAt": { + "type": "string", + "format": "date-time" + }, + "createdBy": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { "type": "object", "properties": { - "id": { - "type": "number" + "firstname": { + "type": "string" }, - "attributes": { + "lastname": { + "type": "string" + }, + "username": { + "type": "string" + }, + "email": { + "type": "string", + "format": "email" + }, + "resetPasswordToken": { + "type": "string" + }, + "registrationToken": { + "type": "string" + }, + "isActive": { + "type": "boolean" + }, + "roles": { "type": "object", "properties": { - "action": { - "type": "string" - }, - "actionParameters": {}, - "subject": { - "type": "string" - }, - "properties": {}, - "conditions": {}, - "role": { - "type": "object", - "properties": { - "data": { - "type": "object", - "properties": { - "id": { - "type": "number" - }, - "attributes": { - "type": "object", - "properties": {} + "data": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "code": { + "type": "string" + }, + "description": { + "type": "string" + }, + "users": { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "type": "object", + "properties": {} + } + } + } + } + } + }, + "permissions": { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "type": "object", + "properties": { + "action": { + "type": "string" + }, + "actionParameters": {}, + "subject": { + "type": "string" + }, + "properties": {}, + "conditions": {}, + "role": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "type": "object", + "properties": {} + } + } + } + } + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "updatedAt": { + "type": "string", + "format": "date-time" + }, + "createdBy": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "type": "object", + "properties": {} + } + } + } + } + }, + "updatedBy": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "type": "object", + "properties": {} + } + } + } + } + } + } + } + } + } + } + } + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "updatedAt": { + "type": "string", + "format": "date-time" + }, + "createdBy": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "type": "object", + "properties": {} + } + } + } + } + }, + "updatedBy": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "type": "object", + "properties": {} + } + } + } + } + } } } } } - }, - "createdAt": { - "type": "string", - "format": "date-time" - }, - "updatedAt": { - "type": "string", - "format": "date-time" - }, - "createdBy": { + } + } + }, + "blocked": { + "type": "boolean" + }, + "preferedLanguage": { + "type": "string" + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "updatedAt": { + "type": "string", + "format": "date-time" + }, + "createdBy": { + "type": "object", + "properties": { + "data": { "type": "object", "properties": { - "data": { + "id": { + "type": "number" + }, + "attributes": { "type": "object", - "properties": { - "id": { - "type": "number" - }, - "attributes": { - "type": "object", - "properties": {} - } - } + "properties": {} } } - }, - "updatedBy": { + } + } + }, + "updatedBy": { + "type": "object", + "properties": { + "data": { "type": "object", "properties": { - "data": { + "id": { + "type": "number" + }, + "attributes": { "type": "object", - "properties": { - "id": { - "type": "number" - }, - "attributes": { - "type": "object", - "properties": {} - } - } + "properties": {} } } } @@ -14849,36 +15963,153 @@ } } } - }, - "createdAt": { - "type": "string", - "format": "date-time" - }, - "updatedAt": { - "type": "string", - "format": "date-time" - }, - "createdBy": { - "type": "object", - "properties": { - "data": { - "type": "object", - "properties": { - "id": { - "type": "number" - }, - "attributes": { - "type": "object", - "properties": {} - } + } + }, + "updatedBy": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "type": "object", + "properties": {} } } } - }, - "updatedBy": { - "type": "object", - "properties": { - "data": { + } + } + } + } + } + } + } + }, + "is_locked": { + "type": "boolean" + }, + "proposal_hard_fork_content": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "type": "object", + "properties": { + "previous_ga_hash": { + "type": "string" + }, + "previous_ga_id": { + "type": "string" + }, + "major": { + "type": "string" + }, + "minor": { + "type": "string" + }, + "proposal_content": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "type": "object", + "properties": {} + } + } + } + } + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "updatedAt": { + "type": "string", + "format": "date-time" + }, + "createdBy": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "type": "object", + "properties": {} + } + } + } + } + }, + "updatedBy": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "type": "object", + "properties": {} + } + } + } + } + } + } + } + } + } + } + }, + "proposal": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "type": "object", + "properties": { + "prop_likes": { + "type": "integer" + }, + "prop_dislikes": { + "type": "integer" + }, + "prop_comments_number": { + "type": "integer" + }, + "user_id": { + "type": "string" + }, + "proposal_contents": { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { "type": "object", "properties": { "id": { @@ -14892,6 +16123,48 @@ } } } + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "updatedAt": { + "type": "string", + "format": "date-time" + }, + "createdBy": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "type": "object", + "properties": {} + } + } + } + } + }, + "updatedBy": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "type": "object", + "properties": {} + } + } + } + } } } } @@ -14899,12 +16172,6 @@ } } }, - "blocked": { - "type": "boolean" - }, - "preferedLanguage": { - "type": "string" - }, "createdAt": { "type": "string", "format": "date-time" @@ -14953,7 +16220,15 @@ } } }, - "updatedBy": { + "createdAt": { + "type": "string", + "format": "date-time" + }, + "updatedAt": { + "type": "string", + "format": "date-time" + }, + "createdBy": { "type": "object", "properties": { "data": { @@ -14969,75 +16244,86 @@ } } } - } - } - }, - "ProposalSubmitionResponseDataObject": { - "type": "object", - "properties": { - "id": { - "type": "number" }, - "attributes": { - "$ref": "#/components/schemas/ProposalSubmition" + "updatedBy": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "type": "object", + "properties": {} + } + } + } + } } } }, - "ProposalSubmitionResponse": { + "ProposalHardForkContentResponseDataObject": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "$ref": "#/components/schemas/ProposalHardForkContent" + } + } + }, + "ProposalHardForkContentResponse": { "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/ProposalSubmitionResponseDataObject" + "$ref": "#/components/schemas/ProposalHardForkContentResponseDataObject" }, "meta": { "type": "object" } } }, - "ProposalVoteRequest": { + "ProposalSubmitionRequest": { "type": "object", "required": [ "data" ], "properties": { "data": { - "required": [ - "proposal_id", - "user_id" - ], "type": "object", "properties": { "proposal_id": { "type": "string" }, - "user_id": { + "sub_json_path": {}, + "sub_location_url": { "type": "string" - }, - "vote_result": { - "type": "boolean" } } } } }, - "ProposalVoteListResponseDataItem": { + "ProposalSubmitionListResponseDataItem": { "type": "object", "properties": { "id": { "type": "number" }, "attributes": { - "$ref": "#/components/schemas/ProposalVote" + "$ref": "#/components/schemas/ProposalSubmition" } } }, - "ProposalVoteListResponse": { + "ProposalSubmitionListResponse": { "type": "object", "properties": { "data": { "type": "array", "items": { - "$ref": "#/components/schemas/ProposalVoteListResponseDataItem" + "$ref": "#/components/schemas/ProposalSubmitionListResponseDataItem" } }, "meta": { @@ -15066,22 +16352,16 @@ } } }, - "ProposalVote": { + "ProposalSubmition": { "type": "object", - "required": [ - "proposal_id", - "user_id" - ], "properties": { "proposal_id": { "type": "string" }, - "user_id": { + "sub_json_path": {}, + "sub_location_url": { "type": "string" }, - "vote_result": { - "type": "boolean" - }, "createdAt": { "type": "string", "format": "date-time" @@ -15378,29 +16658,29 @@ } } }, - "ProposalVoteResponseDataObject": { + "ProposalSubmitionResponseDataObject": { "type": "object", "properties": { "id": { "type": "number" }, "attributes": { - "$ref": "#/components/schemas/ProposalVote" + "$ref": "#/components/schemas/ProposalSubmition" } } }, - "ProposalVoteResponse": { + "ProposalSubmitionResponse": { "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/ProposalVoteResponseDataObject" + "$ref": "#/components/schemas/ProposalSubmitionResponseDataObject" }, "meta": { "type": "object" } } }, - "WalletTypeRequest": { + "ProposalUpdateCommitteeContentRequest": { "type": "object", "required": [ "data" @@ -15409,37 +16689,46 @@ "data": { "type": "object", "properties": { - "wallet_name": { - "type": "string" + "numerator": { + "type": "integer" }, - "wallet_image": { - "type": "string" + "denominator": { + "type": "integer" }, - "wallet_active": { - "type": "boolean" + "add_members": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ProposalCommitteeMemberComponent" + } + }, + "remove_members": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ProposalCommitteeMemberComponent" + } } } } } }, - "WalletTypeListResponseDataItem": { + "ProposalUpdateCommitteeContentListResponseDataItem": { "type": "object", "properties": { "id": { "type": "number" }, "attributes": { - "$ref": "#/components/schemas/WalletType" + "$ref": "#/components/schemas/ProposalUpdateCommitteeContent" } } }, - "WalletTypeListResponse": { + "ProposalUpdateCommitteeContentListResponse": { "type": "object", "properties": { "data": { "type": "array", "items": { - "$ref": "#/components/schemas/WalletTypeListResponseDataItem" + "$ref": "#/components/schemas/ProposalUpdateCommitteeContentListResponseDataItem" } }, "meta": { @@ -15468,17 +16757,26 @@ } } }, - "WalletType": { + "ProposalUpdateCommitteeContent": { "type": "object", "properties": { - "wallet_name": { - "type": "string" + "numerator": { + "type": "integer" }, - "wallet_image": { - "type": "string" + "denominator": { + "type": "integer" }, - "wallet_active": { - "type": "boolean" + "add_members": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ProposalCommitteeMemberComponent" + } + }, + "remove_members": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ProposalCommitteeMemberComponent" + } }, "createdAt": { "type": "string", @@ -15757,51 +17055,3034 @@ } } }, - "updatedBy": { - "type": "object", - "properties": { - "data": { - "type": "object", - "properties": { - "id": { - "type": "number" - }, - "attributes": { - "type": "object", - "properties": {} - } + "updatedBy": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "type": "object", + "properties": {} + } + } + } + } + } + } + }, + "ProposalUpdateCommitteeContentResponseDataObject": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "$ref": "#/components/schemas/ProposalUpdateCommitteeContent" + } + } + }, + "ProposalUpdateCommitteeContentResponse": { + "type": "object", + "properties": { + "data": { + "$ref": "#/components/schemas/ProposalUpdateCommitteeContentResponseDataObject" + }, + "meta": { + "type": "object" + } + } + }, + "ProposalCommitteeMemberComponent": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "address_hash": { + "type": "string" + }, + "epoch": { + "type": "integer" + } + } + }, + "ProposalVoteRequest": { + "type": "object", + "required": [ + "data" + ], + "properties": { + "data": { + "required": [ + "proposal_id", + "user_id" + ], + "type": "object", + "properties": { + "proposal_id": { + "type": "string" + }, + "user_id": { + "type": "string" + }, + "vote_result": { + "type": "boolean" + } + } + } + } + }, + "ProposalVoteListResponseDataItem": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "$ref": "#/components/schemas/ProposalVote" + } + } + }, + "ProposalVoteListResponse": { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ProposalVoteListResponseDataItem" + } + }, + "meta": { + "type": "object", + "properties": { + "pagination": { + "type": "object", + "properties": { + "page": { + "type": "integer" + }, + "pageSize": { + "type": "integer", + "minimum": 25 + }, + "pageCount": { + "type": "integer", + "maximum": 1 + }, + "total": { + "type": "integer" + } + } + } + } + } + } + }, + "ProposalVote": { + "type": "object", + "required": [ + "proposal_id", + "user_id" + ], + "properties": { + "proposal_id": { + "type": "string" + }, + "user_id": { + "type": "string" + }, + "vote_result": { + "type": "boolean" + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "updatedAt": { + "type": "string", + "format": "date-time" + }, + "createdBy": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "type": "object", + "properties": { + "firstname": { + "type": "string" + }, + "lastname": { + "type": "string" + }, + "username": { + "type": "string" + }, + "email": { + "type": "string", + "format": "email" + }, + "resetPasswordToken": { + "type": "string" + }, + "registrationToken": { + "type": "string" + }, + "isActive": { + "type": "boolean" + }, + "roles": { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "code": { + "type": "string" + }, + "description": { + "type": "string" + }, + "users": { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "type": "object", + "properties": {} + } + } + } + } + } + }, + "permissions": { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "type": "object", + "properties": { + "action": { + "type": "string" + }, + "actionParameters": {}, + "subject": { + "type": "string" + }, + "properties": {}, + "conditions": {}, + "role": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "type": "object", + "properties": {} + } + } + } + } + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "updatedAt": { + "type": "string", + "format": "date-time" + }, + "createdBy": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "type": "object", + "properties": {} + } + } + } + } + }, + "updatedBy": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "type": "object", + "properties": {} + } + } + } + } + } + } + } + } + } + } + } + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "updatedAt": { + "type": "string", + "format": "date-time" + }, + "createdBy": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "type": "object", + "properties": {} + } + } + } + } + }, + "updatedBy": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "type": "object", + "properties": {} + } + } + } + } + } + } + } + } + } + } + } + }, + "blocked": { + "type": "boolean" + }, + "preferedLanguage": { + "type": "string" + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "updatedAt": { + "type": "string", + "format": "date-time" + }, + "createdBy": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "type": "object", + "properties": {} + } + } + } + } + }, + "updatedBy": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "type": "object", + "properties": {} + } + } + } + } + } + } + } + } + } + } + }, + "updatedBy": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "type": "object", + "properties": {} + } + } + } + } + } + } + }, + "ProposalVoteResponseDataObject": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "$ref": "#/components/schemas/ProposalVote" + } + } + }, + "ProposalVoteResponse": { + "type": "object", + "properties": { + "data": { + "$ref": "#/components/schemas/ProposalVoteResponseDataObject" + }, + "meta": { + "type": "object" + } + } + }, + "WalletTypeRequest": { + "type": "object", + "required": [ + "data" + ], + "properties": { + "data": { + "type": "object", + "properties": { + "wallet_name": { + "type": "string" + }, + "wallet_image": { + "type": "string" + }, + "wallet_active": { + "type": "boolean" + } + } + } + } + }, + "WalletTypeListResponseDataItem": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "$ref": "#/components/schemas/WalletType" + } + } + }, + "WalletTypeListResponse": { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/WalletTypeListResponseDataItem" + } + }, + "meta": { + "type": "object", + "properties": { + "pagination": { + "type": "object", + "properties": { + "page": { + "type": "integer" + }, + "pageSize": { + "type": "integer", + "minimum": 25 + }, + "pageCount": { + "type": "integer", + "maximum": 1 + }, + "total": { + "type": "integer" + } + } + } + } + } + } + }, + "WalletType": { + "type": "object", + "properties": { + "wallet_name": { + "type": "string" + }, + "wallet_image": { + "type": "string" + }, + "wallet_active": { + "type": "boolean" + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "updatedAt": { + "type": "string", + "format": "date-time" + }, + "createdBy": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "type": "object", + "properties": { + "firstname": { + "type": "string" + }, + "lastname": { + "type": "string" + }, + "username": { + "type": "string" + }, + "email": { + "type": "string", + "format": "email" + }, + "resetPasswordToken": { + "type": "string" + }, + "registrationToken": { + "type": "string" + }, + "isActive": { + "type": "boolean" + }, + "roles": { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "code": { + "type": "string" + }, + "description": { + "type": "string" + }, + "users": { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "type": "object", + "properties": {} + } + } + } + } + } + }, + "permissions": { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "type": "object", + "properties": { + "action": { + "type": "string" + }, + "actionParameters": {}, + "subject": { + "type": "string" + }, + "properties": {}, + "conditions": {}, + "role": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "type": "object", + "properties": {} + } + } + } + } + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "updatedAt": { + "type": "string", + "format": "date-time" + }, + "createdBy": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "type": "object", + "properties": {} + } + } + } + } + }, + "updatedBy": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "type": "object", + "properties": {} + } + } + } + } + } + } + } + } + } + } + } + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "updatedAt": { + "type": "string", + "format": "date-time" + }, + "createdBy": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "type": "object", + "properties": {} + } + } + } + } + }, + "updatedBy": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "type": "object", + "properties": {} + } + } + } + } + } + } + } + } + } + } + } + }, + "blocked": { + "type": "boolean" + }, + "preferedLanguage": { + "type": "string" + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "updatedAt": { + "type": "string", + "format": "date-time" + }, + "createdBy": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "type": "object", + "properties": {} + } + } + } + } + }, + "updatedBy": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "type": "object", + "properties": {} + } + } + } + } + } + } + } + } + } + } + }, + "updatedBy": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "type": "object", + "properties": {} + } + } + } + } + } + } + }, + "WalletTypeResponseDataObject": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "attributes": { + "$ref": "#/components/schemas/WalletType" + } + } + }, + "WalletTypeResponse": { + "type": "object", + "properties": { + "data": { + "$ref": "#/components/schemas/WalletTypeResponseDataObject" + }, + "meta": { + "type": "object" + } + } + }, + "Users-Permissions-Role": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "type": { + "type": "string" + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "updatedAt": { + "type": "string", + "format": "date-time" + } + } + }, + "Users-Permissions-User": { + "type": "object", + "properties": { + "id": { + "type": "number", + "example": 1 + }, + "username": { + "type": "string", + "example": "foo.bar" + }, + "email": { + "type": "string", + "example": "foo.bar@strapi.io" + }, + "provider": { + "type": "string", + "example": "local" + }, + "confirmed": { + "type": "boolean", + "example": true + }, + "blocked": { + "type": "boolean", + "example": false + }, + "createdAt": { + "type": "string", + "format": "date-time", + "example": "2022-06-02T08:32:06.258Z" + }, + "updatedAt": { + "type": "string", + "format": "date-time", + "example": "2022-06-02T08:32:06.267Z" + } + } + }, + "Users-Permissions-UserRegistration": { + "type": "object", + "properties": { + "jwt": { + "type": "string", + "example": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c" + }, + "user": { + "$ref": "#/components/schemas/Users-Permissions-User" + } + } + }, + "Users-Permissions-PermissionsTree": { + "type": "object", + "additionalProperties": { + "type": "object", + "description": "every api", + "properties": { + "controllers": { + "description": "every controller of the api", + "type": "object", + "additionalProperties": { + "type": "object", + "additionalProperties": { + "description": "every action of every controller", + "type": "object", + "properties": { + "enabled": { + "type": "boolean" + }, + "policy": { + "type": "string" + } + } + } + } + } + } + } + } + }, + "requestBodies": { + "Users-Permissions-RoleRequest": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "type": { + "type": "string" + }, + "permissions": { + "$ref": "#/components/schemas/Users-Permissions-PermissionsTree" + } + } + }, + "example": { + "name": "foo", + "description": "role foo", + "permissions": { + "api::content-type.content-type": { + "controllers": { + "controllerA": { + "find": { + "enabled": true + } + } + } + } + } + } + } + } + } + } + }, + "paths": { + "/auth-challenges": { + "get": { + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AuthChallengeListResponse" + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + }, + "tags": [ + "Auth-challenge" + ], + "parameters": [ + { + "name": "sort", + "in": "query", + "description": "Sort by attributes ascending (asc) or descending (desc)", + "deprecated": false, + "required": false, + "schema": { + "type": "string" + } + }, + { + "name": "pagination[withCount]", + "in": "query", + "description": "Return page/pageSize (default: true)", + "deprecated": false, + "required": false, + "schema": { + "type": "boolean" + } + }, + { + "name": "pagination[page]", + "in": "query", + "description": "Page number (default: 0)", + "deprecated": false, + "required": false, + "schema": { + "type": "integer" + } + }, + { + "name": "pagination[pageSize]", + "in": "query", + "description": "Page size (default: 25)", + "deprecated": false, + "required": false, + "schema": { + "type": "integer" + } + }, + { + "name": "pagination[start]", + "in": "query", + "description": "Offset value (default: 0)", + "deprecated": false, + "required": false, + "schema": { + "type": "integer" + } + }, + { + "name": "pagination[limit]", + "in": "query", + "description": "Number of entities to return (default: 25)", + "deprecated": false, + "required": false, + "schema": { + "type": "integer" + } + }, + { + "name": "fields", + "in": "query", + "description": "Fields to return (ex: title,author)", + "deprecated": false, + "required": false, + "schema": { + "type": "string" + } + }, + { + "name": "populate", + "in": "query", + "description": "Relations to return", + "deprecated": false, + "required": false, + "schema": { + "type": "string" + } + }, + { + "name": "filters", + "in": "query", + "description": "Filters to apply", + "deprecated": false, + "required": false, + "schema": { + "type": "object" + }, + "style": "deepObject" + }, + { + "name": "locale", + "in": "query", + "description": "Locale to apply", + "deprecated": false, + "required": false, + "schema": { + "type": "string" + } + } + ], + "operationId": "get/auth-challenges" + }, + "post": { + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AuthChallengeResponse" + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + }, + "tags": [ + "Auth-challenge" + ], + "parameters": [], + "operationId": "post/auth-challenges", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AuthChallengeRequest" + } + } + } + } + } + }, + "/auth-challenges/{id}": { + "get": { + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AuthChallengeResponse" + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + }, + "tags": [ + "Auth-challenge" + ], + "parameters": [ + { + "name": "id", + "in": "path", + "description": "", + "deprecated": false, + "required": true, + "schema": { + "type": "number" + } + } + ], + "operationId": "get/auth-challenges/{id}" + }, + "put": { + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AuthChallengeResponse" + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + }, + "tags": [ + "Auth-challenge" + ], + "parameters": [ + { + "name": "id", + "in": "path", + "description": "", + "deprecated": false, + "required": true, + "schema": { + "type": "number" + } + } + ], + "operationId": "put/auth-challenges/{id}", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AuthChallengeRequest" + } + } + } + } + }, + "delete": { + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + }, + "tags": [ + "Auth-challenge" + ], + "parameters": [ + { + "name": "id", + "in": "path", + "description": "", + "deprecated": false, + "required": true, + "schema": { + "type": "number" + } + } + ], + "operationId": "delete/auth-challenges/{id}" + } + }, + "/bds": { + "get": { + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BdListResponse" + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + }, + "tags": [ + "Bd" + ], + "parameters": [ + { + "name": "sort", + "in": "query", + "description": "Sort by attributes ascending (asc) or descending (desc)", + "deprecated": false, + "required": false, + "schema": { + "type": "string" + } + }, + { + "name": "pagination[withCount]", + "in": "query", + "description": "Return page/pageSize (default: true)", + "deprecated": false, + "required": false, + "schema": { + "type": "boolean" + } + }, + { + "name": "pagination[page]", + "in": "query", + "description": "Page number (default: 0)", + "deprecated": false, + "required": false, + "schema": { + "type": "integer" + } + }, + { + "name": "pagination[pageSize]", + "in": "query", + "description": "Page size (default: 25)", + "deprecated": false, + "required": false, + "schema": { + "type": "integer" + } + }, + { + "name": "pagination[start]", + "in": "query", + "description": "Offset value (default: 0)", + "deprecated": false, + "required": false, + "schema": { + "type": "integer" + } + }, + { + "name": "pagination[limit]", + "in": "query", + "description": "Number of entities to return (default: 25)", + "deprecated": false, + "required": false, + "schema": { + "type": "integer" + } + }, + { + "name": "fields", + "in": "query", + "description": "Fields to return (ex: title,author)", + "deprecated": false, + "required": false, + "schema": { + "type": "string" + } + }, + { + "name": "populate", + "in": "query", + "description": "Relations to return", + "deprecated": false, + "required": false, + "schema": { + "type": "string" + } + }, + { + "name": "filters", + "in": "query", + "description": "Filters to apply", + "deprecated": false, + "required": false, + "schema": { + "type": "object" + }, + "style": "deepObject" + }, + { + "name": "locale", + "in": "query", + "description": "Locale to apply", + "deprecated": false, + "required": false, + "schema": { + "type": "string" + } + } + ], + "operationId": "get/bds" + }, + "post": { + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BdResponse" + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + }, + "tags": [ + "Bd" + ], + "parameters": [], + "operationId": "post/bds", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BdRequest" + } + } + } + } + } + }, + "/bds/{id}": { + "get": { + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BdResponse" + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + }, + "tags": [ + "Bd" + ], + "parameters": [ + { + "name": "id", + "in": "path", + "description": "", + "deprecated": false, + "required": true, + "schema": { + "type": "number" + } + } + ], + "operationId": "get/bds/{id}" + }, + "put": { + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BdResponse" + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + }, + "tags": [ + "Bd" + ], + "parameters": [ + { + "name": "id", + "in": "path", + "description": "", + "deprecated": false, + "required": true, + "schema": { + "type": "number" + } + } + ], + "operationId": "put/bds/{id}", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BdRequest" + } + } + } + } + }, + "delete": { + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + }, + "tags": [ + "Bd" + ], + "parameters": [ + { + "name": "id", + "in": "path", + "description": "", + "deprecated": false, + "required": true, + "schema": { + "type": "number" + } + } + ], + "operationId": "delete/bds/{id}" + } + }, + "/bd-contact-informations": { + "get": { + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BdContactInformationListResponse" + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + }, + "tags": [ + "Bd-contact-information" + ], + "parameters": [ + { + "name": "sort", + "in": "query", + "description": "Sort by attributes ascending (asc) or descending (desc)", + "deprecated": false, + "required": false, + "schema": { + "type": "string" + } + }, + { + "name": "pagination[withCount]", + "in": "query", + "description": "Return page/pageSize (default: true)", + "deprecated": false, + "required": false, + "schema": { + "type": "boolean" + } + }, + { + "name": "pagination[page]", + "in": "query", + "description": "Page number (default: 0)", + "deprecated": false, + "required": false, + "schema": { + "type": "integer" + } + }, + { + "name": "pagination[pageSize]", + "in": "query", + "description": "Page size (default: 25)", + "deprecated": false, + "required": false, + "schema": { + "type": "integer" + } + }, + { + "name": "pagination[start]", + "in": "query", + "description": "Offset value (default: 0)", + "deprecated": false, + "required": false, + "schema": { + "type": "integer" + } + }, + { + "name": "pagination[limit]", + "in": "query", + "description": "Number of entities to return (default: 25)", + "deprecated": false, + "required": false, + "schema": { + "type": "integer" + } + }, + { + "name": "fields", + "in": "query", + "description": "Fields to return (ex: title,author)", + "deprecated": false, + "required": false, + "schema": { + "type": "string" + } + }, + { + "name": "populate", + "in": "query", + "description": "Relations to return", + "deprecated": false, + "required": false, + "schema": { + "type": "string" + } + }, + { + "name": "filters", + "in": "query", + "description": "Filters to apply", + "deprecated": false, + "required": false, + "schema": { + "type": "object" + }, + "style": "deepObject" + }, + { + "name": "locale", + "in": "query", + "description": "Locale to apply", + "deprecated": false, + "required": false, + "schema": { + "type": "string" + } + } + ], + "operationId": "get/bd-contact-informations" + }, + "post": { + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BdContactInformationResponse" + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + }, + "tags": [ + "Bd-contact-information" + ], + "parameters": [], + "operationId": "post/bd-contact-informations", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BdContactInformationRequest" + } + } + } + } + } + }, + "/bd-contact-informations/{id}": { + "get": { + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BdContactInformationResponse" + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + }, + "tags": [ + "Bd-contact-information" + ], + "parameters": [ + { + "name": "id", + "in": "path", + "description": "", + "deprecated": false, + "required": true, + "schema": { + "type": "number" + } + } + ], + "operationId": "get/bd-contact-informations/{id}" + }, + "put": { + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BdContactInformationResponse" + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + }, + "tags": [ + "Bd-contact-information" + ], + "parameters": [ + { + "name": "id", + "in": "path", + "description": "", + "deprecated": false, + "required": true, + "schema": { + "type": "number" + } + } + ], + "operationId": "put/bd-contact-informations/{id}", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BdContactInformationRequest" + } + } + } + } + }, + "delete": { + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + }, + "tags": [ + "Bd-contact-information" + ], + "parameters": [ + { + "name": "id", + "in": "path", + "description": "", + "deprecated": false, + "required": true, + "schema": { + "type": "number" + } + } + ], + "operationId": "delete/bd-contact-informations/{id}" + } + }, + "/bd-contract-types": { + "get": { + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BdContractTypeListResponse" + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + }, + "tags": [ + "Bd-contract-type" + ], + "parameters": [ + { + "name": "sort", + "in": "query", + "description": "Sort by attributes ascending (asc) or descending (desc)", + "deprecated": false, + "required": false, + "schema": { + "type": "string" + } + }, + { + "name": "pagination[withCount]", + "in": "query", + "description": "Return page/pageSize (default: true)", + "deprecated": false, + "required": false, + "schema": { + "type": "boolean" + } + }, + { + "name": "pagination[page]", + "in": "query", + "description": "Page number (default: 0)", + "deprecated": false, + "required": false, + "schema": { + "type": "integer" + } + }, + { + "name": "pagination[pageSize]", + "in": "query", + "description": "Page size (default: 25)", + "deprecated": false, + "required": false, + "schema": { + "type": "integer" + } + }, + { + "name": "pagination[start]", + "in": "query", + "description": "Offset value (default: 0)", + "deprecated": false, + "required": false, + "schema": { + "type": "integer" + } + }, + { + "name": "pagination[limit]", + "in": "query", + "description": "Number of entities to return (default: 25)", + "deprecated": false, + "required": false, + "schema": { + "type": "integer" + } + }, + { + "name": "fields", + "in": "query", + "description": "Fields to return (ex: title,author)", + "deprecated": false, + "required": false, + "schema": { + "type": "string" + } + }, + { + "name": "populate", + "in": "query", + "description": "Relations to return", + "deprecated": false, + "required": false, + "schema": { + "type": "string" + } + }, + { + "name": "filters", + "in": "query", + "description": "Filters to apply", + "deprecated": false, + "required": false, + "schema": { + "type": "object" + }, + "style": "deepObject" + }, + { + "name": "locale", + "in": "query", + "description": "Locale to apply", + "deprecated": false, + "required": false, + "schema": { + "type": "string" + } + } + ], + "operationId": "get/bd-contract-types" + }, + "post": { + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BdContractTypeResponse" + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + }, + "tags": [ + "Bd-contract-type" + ], + "parameters": [], + "operationId": "post/bd-contract-types", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BdContractTypeRequest" + } + } + } + } + } + }, + "/bd-contract-types/{id}": { + "get": { + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BdContractTypeResponse" + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" } } } } - } + }, + "tags": [ + "Bd-contract-type" + ], + "parameters": [ + { + "name": "id", + "in": "path", + "description": "", + "deprecated": false, + "required": true, + "schema": { + "type": "number" + } + } + ], + "operationId": "get/bd-contract-types/{id}" }, - "WalletTypeResponseDataObject": { - "type": "object", - "properties": { - "id": { - "type": "number" + "put": { + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BdContractTypeResponse" + } + } + } }, - "attributes": { - "$ref": "#/components/schemas/WalletType" + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + }, + "tags": [ + "Bd-contract-type" + ], + "parameters": [ + { + "name": "id", + "in": "path", + "description": "", + "deprecated": false, + "required": true, + "schema": { + "type": "number" + } + } + ], + "operationId": "put/bd-contract-types/{id}", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BdContractTypeRequest" + } + } } } }, - "WalletTypeResponse": { - "type": "object", - "properties": { - "data": { - "$ref": "#/components/schemas/WalletTypeResponseDataObject" + "delete": { + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "integer", + "format": "int64" + } + } + } }, - "meta": { - "type": "object" + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } - } + }, + "tags": [ + "Bd-contract-type" + ], + "parameters": [ + { + "name": "id", + "in": "path", + "description": "", + "deprecated": false, + "required": true, + "schema": { + "type": "number" + } + } + ], + "operationId": "delete/bd-contract-types/{id}" } - } - }, - "paths": { - "/auth-challenges": { + }, + "/bd-costings": { "get": { "responses": { "200": { @@ -15809,7 +20090,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/AuthChallengeListResponse" + "$ref": "#/components/schemas/BdCostingListResponse" } } } @@ -15866,7 +20147,7 @@ } }, "tags": [ - "Auth-challenge" + "Bd-costing" ], "parameters": [ { @@ -15971,7 +20252,7 @@ } } ], - "operationId": "get/auth-challenges" + "operationId": "get/bd-costings" }, "post": { "responses": { @@ -15980,7 +20261,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/AuthChallengeResponse" + "$ref": "#/components/schemas/BdCostingResponse" } } } @@ -16037,23 +20318,23 @@ } }, "tags": [ - "Auth-challenge" + "Bd-costing" ], "parameters": [], - "operationId": "post/auth-challenges", + "operationId": "post/bd-costings", "requestBody": { "required": true, "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/AuthChallengeRequest" + "$ref": "#/components/schemas/BdCostingRequest" } } } } } }, - "/auth-challenges/{id}": { + "/bd-costings/{id}": { "get": { "responses": { "200": { @@ -16061,7 +20342,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/AuthChallengeResponse" + "$ref": "#/components/schemas/BdCostingResponse" } } } @@ -16118,7 +20399,7 @@ } }, "tags": [ - "Auth-challenge" + "Bd-costing" ], "parameters": [ { @@ -16132,7 +20413,7 @@ } } ], - "operationId": "get/auth-challenges/{id}" + "operationId": "get/bd-costings/{id}" }, "put": { "responses": { @@ -16141,7 +20422,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/AuthChallengeResponse" + "$ref": "#/components/schemas/BdCostingResponse" } } } @@ -16198,7 +20479,7 @@ } }, "tags": [ - "Auth-challenge" + "Bd-costing" ], "parameters": [ { @@ -16212,13 +20493,13 @@ } } ], - "operationId": "put/auth-challenges/{id}", + "operationId": "put/bd-costings/{id}", "requestBody": { "required": true, "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/AuthChallengeRequest" + "$ref": "#/components/schemas/BdCostingRequest" } } } @@ -16289,7 +20570,7 @@ } }, "tags": [ - "Auth-challenge" + "Bd-costing" ], "parameters": [ { @@ -16303,10 +20584,10 @@ } } ], - "operationId": "delete/auth-challenges/{id}" + "operationId": "delete/bd-costings/{id}" } }, - "/bds": { + "/bd-currency-lists": { "get": { "responses": { "200": { @@ -16314,7 +20595,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BdListResponse" + "$ref": "#/components/schemas/BdCurrencyListListResponse" } } } @@ -16371,7 +20652,7 @@ } }, "tags": [ - "Bd" + "Bd-currency-list" ], "parameters": [ { @@ -16476,7 +20757,7 @@ } } ], - "operationId": "get/bds" + "operationId": "get/bd-currency-lists" }, "post": { "responses": { @@ -16485,7 +20766,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BdResponse" + "$ref": "#/components/schemas/BdCurrencyListResponse" } } } @@ -16542,23 +20823,23 @@ } }, "tags": [ - "Bd" + "Bd-currency-list" ], "parameters": [], - "operationId": "post/bds", + "operationId": "post/bd-currency-lists", "requestBody": { "required": true, "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BdRequest" + "$ref": "#/components/schemas/BdCurrencyListRequest" } } } } } }, - "/bds/{id}": { + "/bd-currency-lists/{id}": { "get": { "responses": { "200": { @@ -16566,7 +20847,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BdResponse" + "$ref": "#/components/schemas/BdCurrencyListResponse" } } } @@ -16623,7 +20904,7 @@ } }, "tags": [ - "Bd" + "Bd-currency-list" ], "parameters": [ { @@ -16637,7 +20918,7 @@ } } ], - "operationId": "get/bds/{id}" + "operationId": "get/bd-currency-lists/{id}" }, "put": { "responses": { @@ -16646,7 +20927,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BdResponse" + "$ref": "#/components/schemas/BdCurrencyListResponse" } } } @@ -16703,7 +20984,7 @@ } }, "tags": [ - "Bd" + "Bd-currency-list" ], "parameters": [ { @@ -16717,13 +20998,13 @@ } } ], - "operationId": "put/bds/{id}", + "operationId": "put/bd-currency-lists/{id}", "requestBody": { "required": true, "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BdRequest" + "$ref": "#/components/schemas/BdCurrencyListRequest" } } } @@ -16794,7 +21075,7 @@ } }, "tags": [ - "Bd" + "Bd-currency-list" ], "parameters": [ { @@ -16808,10 +21089,10 @@ } } ], - "operationId": "delete/bds/{id}" + "operationId": "delete/bd-currency-lists/{id}" } }, - "/bd-contact-informations": { + "/bd-drafts": { "get": { "responses": { "200": { @@ -16819,7 +21100,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BdContactInformationListResponse" + "$ref": "#/components/schemas/BdDraftListResponse" } } } @@ -16876,7 +21157,7 @@ } }, "tags": [ - "Bd-contact-information" + "Bd-draft" ], "parameters": [ { @@ -16981,7 +21262,7 @@ } } ], - "operationId": "get/bd-contact-informations" + "operationId": "get/bd-drafts" }, "post": { "responses": { @@ -16990,7 +21271,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BdContactInformationResponse" + "$ref": "#/components/schemas/BdDraftResponse" } } } @@ -17047,23 +21328,23 @@ } }, "tags": [ - "Bd-contact-information" + "Bd-draft" ], "parameters": [], - "operationId": "post/bd-contact-informations", + "operationId": "post/bd-drafts", "requestBody": { "required": true, "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BdContactInformationRequest" + "$ref": "#/components/schemas/BdDraftRequest" } } } } } }, - "/bd-contact-informations/{id}": { + "/bd-drafts/{id}": { "get": { "responses": { "200": { @@ -17071,7 +21352,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BdContactInformationResponse" + "$ref": "#/components/schemas/BdDraftResponse" } } } @@ -17128,7 +21409,7 @@ } }, "tags": [ - "Bd-contact-information" + "Bd-draft" ], "parameters": [ { @@ -17142,7 +21423,7 @@ } } ], - "operationId": "get/bd-contact-informations/{id}" + "operationId": "get/bd-drafts/{id}" }, "put": { "responses": { @@ -17151,7 +21432,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BdContactInformationResponse" + "$ref": "#/components/schemas/BdDraftResponse" } } } @@ -17208,7 +21489,7 @@ } }, "tags": [ - "Bd-contact-information" + "Bd-draft" ], "parameters": [ { @@ -17222,13 +21503,13 @@ } } ], - "operationId": "put/bd-contact-informations/{id}", + "operationId": "put/bd-drafts/{id}", "requestBody": { "required": true, "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BdContactInformationRequest" + "$ref": "#/components/schemas/BdDraftRequest" } } } @@ -17299,7 +21580,7 @@ } }, "tags": [ - "Bd-contact-information" + "Bd-draft" ], "parameters": [ { @@ -17313,10 +21594,10 @@ } } ], - "operationId": "delete/bd-contact-informations/{id}" + "operationId": "delete/bd-drafts/{id}" } }, - "/bd-contract-types": { + "/bd-further-informations": { "get": { "responses": { "200": { @@ -17324,7 +21605,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BdContractTypeListResponse" + "$ref": "#/components/schemas/BdFurtherInformationListResponse" } } } @@ -17381,7 +21662,7 @@ } }, "tags": [ - "Bd-contract-type" + "Bd-further-information" ], "parameters": [ { @@ -17486,7 +21767,7 @@ } } ], - "operationId": "get/bd-contract-types" + "operationId": "get/bd-further-informations" }, "post": { "responses": { @@ -17495,7 +21776,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BdContractTypeResponse" + "$ref": "#/components/schemas/BdFurtherInformationResponse" } } } @@ -17552,23 +21833,23 @@ } }, "tags": [ - "Bd-contract-type" + "Bd-further-information" ], "parameters": [], - "operationId": "post/bd-contract-types", + "operationId": "post/bd-further-informations", "requestBody": { "required": true, "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BdContractTypeRequest" + "$ref": "#/components/schemas/BdFurtherInformationRequest" } } } } } }, - "/bd-contract-types/{id}": { + "/bd-further-informations/{id}": { "get": { "responses": { "200": { @@ -17576,7 +21857,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BdContractTypeResponse" + "$ref": "#/components/schemas/BdFurtherInformationResponse" } } } @@ -17633,7 +21914,7 @@ } }, "tags": [ - "Bd-contract-type" + "Bd-further-information" ], "parameters": [ { @@ -17647,7 +21928,7 @@ } } ], - "operationId": "get/bd-contract-types/{id}" + "operationId": "get/bd-further-informations/{id}" }, "put": { "responses": { @@ -17656,7 +21937,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BdContractTypeResponse" + "$ref": "#/components/schemas/BdFurtherInformationResponse" } } } @@ -17713,7 +21994,7 @@ } }, "tags": [ - "Bd-contract-type" + "Bd-further-information" ], "parameters": [ { @@ -17727,13 +22008,13 @@ } } ], - "operationId": "put/bd-contract-types/{id}", + "operationId": "put/bd-further-informations/{id}", "requestBody": { "required": true, "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BdContractTypeRequest" + "$ref": "#/components/schemas/BdFurtherInformationRequest" } } } @@ -17804,7 +22085,7 @@ } }, "tags": [ - "Bd-contract-type" + "Bd-further-information" ], "parameters": [ { @@ -17818,10 +22099,10 @@ } } ], - "operationId": "delete/bd-contract-types/{id}" + "operationId": "delete/bd-further-informations/{id}" } }, - "/bd-costings": { + "/bd-intersect-committees": { "get": { "responses": { "200": { @@ -17829,7 +22110,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BdCostingListResponse" + "$ref": "#/components/schemas/BdIntersectCommitteeListResponse" } } } @@ -17886,7 +22167,7 @@ } }, "tags": [ - "Bd-costing" + "Bd-intersect-committee" ], "parameters": [ { @@ -17991,7 +22272,7 @@ } } ], - "operationId": "get/bd-costings" + "operationId": "get/bd-intersect-committees" }, "post": { "responses": { @@ -18000,7 +22281,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BdCostingResponse" + "$ref": "#/components/schemas/BdIntersectCommitteeResponse" } } } @@ -18057,23 +22338,23 @@ } }, "tags": [ - "Bd-costing" + "Bd-intersect-committee" ], "parameters": [], - "operationId": "post/bd-costings", + "operationId": "post/bd-intersect-committees", "requestBody": { "required": true, "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BdCostingRequest" + "$ref": "#/components/schemas/BdIntersectCommitteeRequest" } } } } } }, - "/bd-costings/{id}": { + "/bd-intersect-committees/{id}": { "get": { "responses": { "200": { @@ -18081,7 +22362,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BdCostingResponse" + "$ref": "#/components/schemas/BdIntersectCommitteeResponse" } } } @@ -18138,7 +22419,7 @@ } }, "tags": [ - "Bd-costing" + "Bd-intersect-committee" ], "parameters": [ { @@ -18152,7 +22433,7 @@ } } ], - "operationId": "get/bd-costings/{id}" + "operationId": "get/bd-intersect-committees/{id}" }, "put": { "responses": { @@ -18161,7 +22442,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BdCostingResponse" + "$ref": "#/components/schemas/BdIntersectCommitteeResponse" } } } @@ -18218,7 +22499,7 @@ } }, "tags": [ - "Bd-costing" + "Bd-intersect-committee" ], "parameters": [ { @@ -18232,13 +22513,13 @@ } } ], - "operationId": "put/bd-costings/{id}", + "operationId": "put/bd-intersect-committees/{id}", "requestBody": { "required": true, "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BdCostingRequest" + "$ref": "#/components/schemas/BdIntersectCommitteeRequest" } } } @@ -18309,7 +22590,7 @@ } }, "tags": [ - "Bd-costing" + "Bd-intersect-committee" ], "parameters": [ { @@ -18323,10 +22604,10 @@ } } ], - "operationId": "delete/bd-costings/{id}" + "operationId": "delete/bd-intersect-committees/{id}" } }, - "/bd-currency-lists": { + "/bd-polls": { "get": { "responses": { "200": { @@ -18334,7 +22615,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BdCurrencyListListResponse" + "$ref": "#/components/schemas/BdPollListResponse" } } } @@ -18391,7 +22672,7 @@ } }, "tags": [ - "Bd-currency-list" + "Bd-poll" ], "parameters": [ { @@ -18496,7 +22777,7 @@ } } ], - "operationId": "get/bd-currency-lists" + "operationId": "get/bd-polls" }, "post": { "responses": { @@ -18505,7 +22786,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BdCurrencyListResponse" + "$ref": "#/components/schemas/BdPollResponse" } } } @@ -18562,23 +22843,23 @@ } }, "tags": [ - "Bd-currency-list" + "Bd-poll" ], "parameters": [], - "operationId": "post/bd-currency-lists", + "operationId": "post/bd-polls", "requestBody": { "required": true, "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BdCurrencyListRequest" + "$ref": "#/components/schemas/BdPollRequest" } } } } } }, - "/bd-currency-lists/{id}": { + "/bd-polls/{id}": { "get": { "responses": { "200": { @@ -18586,7 +22867,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BdCurrencyListResponse" + "$ref": "#/components/schemas/BdPollResponse" } } } @@ -18643,7 +22924,7 @@ } }, "tags": [ - "Bd-currency-list" + "Bd-poll" ], "parameters": [ { @@ -18657,7 +22938,7 @@ } } ], - "operationId": "get/bd-currency-lists/{id}" + "operationId": "get/bd-polls/{id}" }, "put": { "responses": { @@ -18666,7 +22947,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BdCurrencyListResponse" + "$ref": "#/components/schemas/BdPollResponse" } } } @@ -18723,7 +23004,7 @@ } }, "tags": [ - "Bd-currency-list" + "Bd-poll" ], "parameters": [ { @@ -18737,13 +23018,13 @@ } } ], - "operationId": "put/bd-currency-lists/{id}", + "operationId": "put/bd-polls/{id}", "requestBody": { "required": true, "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BdCurrencyListRequest" + "$ref": "#/components/schemas/BdPollRequest" } } } @@ -18814,7 +23095,7 @@ } }, "tags": [ - "Bd-currency-list" + "Bd-poll" ], "parameters": [ { @@ -18828,10 +23109,10 @@ } } ], - "operationId": "delete/bd-currency-lists/{id}" + "operationId": "delete/bd-polls/{id}" } }, - "/bd-drafts": { + "/bd-poll-votes": { "get": { "responses": { "200": { @@ -18839,7 +23120,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BdDraftListResponse" + "$ref": "#/components/schemas/BdPollVoteListResponse" } } } @@ -18896,7 +23177,7 @@ } }, "tags": [ - "Bd-draft" + "Bd-poll-vote" ], "parameters": [ { @@ -19001,7 +23282,7 @@ } } ], - "operationId": "get/bd-drafts" + "operationId": "get/bd-poll-votes" }, "post": { "responses": { @@ -19010,7 +23291,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BdDraftResponse" + "$ref": "#/components/schemas/BdPollVoteResponse" } } } @@ -19067,23 +23348,23 @@ } }, "tags": [ - "Bd-draft" + "Bd-poll-vote" ], "parameters": [], - "operationId": "post/bd-drafts", + "operationId": "post/bd-poll-votes", "requestBody": { "required": true, "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BdDraftRequest" + "$ref": "#/components/schemas/BdPollVoteRequest" } } } } } }, - "/bd-drafts/{id}": { + "/bd-poll-votes/{id}": { "get": { "responses": { "200": { @@ -19091,7 +23372,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BdDraftResponse" + "$ref": "#/components/schemas/BdPollVoteResponse" } } } @@ -19148,7 +23429,7 @@ } }, "tags": [ - "Bd-draft" + "Bd-poll-vote" ], "parameters": [ { @@ -19162,7 +23443,7 @@ } } ], - "operationId": "get/bd-drafts/{id}" + "operationId": "get/bd-poll-votes/{id}" }, "put": { "responses": { @@ -19171,7 +23452,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BdDraftResponse" + "$ref": "#/components/schemas/BdPollVoteResponse" } } } @@ -19228,7 +23509,7 @@ } }, "tags": [ - "Bd-draft" + "Bd-poll-vote" ], "parameters": [ { @@ -19242,13 +23523,13 @@ } } ], - "operationId": "put/bd-drafts/{id}", + "operationId": "put/bd-poll-votes/{id}", "requestBody": { "required": true, "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BdDraftRequest" + "$ref": "#/components/schemas/BdPollVoteRequest" } } } @@ -19319,7 +23600,7 @@ } }, "tags": [ - "Bd-draft" + "Bd-poll-vote" ], "parameters": [ { @@ -19333,10 +23614,10 @@ } } ], - "operationId": "delete/bd-drafts/{id}" + "operationId": "delete/bd-poll-votes/{id}" } }, - "/bd-further-informations": { + "/bd-proposal-details": { "get": { "responses": { "200": { @@ -19344,7 +23625,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BdFurtherInformationListResponse" + "$ref": "#/components/schemas/BdProposalDetailListResponse" } } } @@ -19401,7 +23682,7 @@ } }, "tags": [ - "Bd-further-information" + "Bd-proposal-detail" ], "parameters": [ { @@ -19506,7 +23787,7 @@ } } ], - "operationId": "get/bd-further-informations" + "operationId": "get/bd-proposal-details" }, "post": { "responses": { @@ -19515,7 +23796,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BdFurtherInformationResponse" + "$ref": "#/components/schemas/BdProposalDetailResponse" } } } @@ -19572,23 +23853,23 @@ } }, "tags": [ - "Bd-further-information" + "Bd-proposal-detail" ], "parameters": [], - "operationId": "post/bd-further-informations", + "operationId": "post/bd-proposal-details", "requestBody": { "required": true, "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BdFurtherInformationRequest" + "$ref": "#/components/schemas/BdProposalDetailRequest" } } } } } }, - "/bd-further-informations/{id}": { + "/bd-proposal-details/{id}": { "get": { "responses": { "200": { @@ -19596,7 +23877,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BdFurtherInformationResponse" + "$ref": "#/components/schemas/BdProposalDetailResponse" } } } @@ -19653,7 +23934,7 @@ } }, "tags": [ - "Bd-further-information" + "Bd-proposal-detail" ], "parameters": [ { @@ -19667,7 +23948,7 @@ } } ], - "operationId": "get/bd-further-informations/{id}" + "operationId": "get/bd-proposal-details/{id}" }, "put": { "responses": { @@ -19676,7 +23957,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BdFurtherInformationResponse" + "$ref": "#/components/schemas/BdProposalDetailResponse" } } } @@ -19733,7 +24014,7 @@ } }, "tags": [ - "Bd-further-information" + "Bd-proposal-detail" ], "parameters": [ { @@ -19747,13 +24028,13 @@ } } ], - "operationId": "put/bd-further-informations/{id}", + "operationId": "put/bd-proposal-details/{id}", "requestBody": { "required": true, "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BdFurtherInformationRequest" + "$ref": "#/components/schemas/BdProposalDetailRequest" } } } @@ -19824,7 +24105,7 @@ } }, "tags": [ - "Bd-further-information" + "Bd-proposal-detail" ], "parameters": [ { @@ -19838,10 +24119,10 @@ } } ], - "operationId": "delete/bd-further-informations/{id}" + "operationId": "delete/bd-proposal-details/{id}" } }, - "/bd-intersect-committees": { + "/bd-proposal-ownerships": { "get": { "responses": { "200": { @@ -19849,7 +24130,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BdIntersectCommitteeListResponse" + "$ref": "#/components/schemas/BdProposalOwnershipListResponse" } } } @@ -19906,7 +24187,7 @@ } }, "tags": [ - "Bd-intersect-committee" + "Bd-proposal-ownership" ], "parameters": [ { @@ -20011,7 +24292,7 @@ } } ], - "operationId": "get/bd-intersect-committees" + "operationId": "get/bd-proposal-ownerships" }, "post": { "responses": { @@ -20020,7 +24301,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BdIntersectCommitteeResponse" + "$ref": "#/components/schemas/BdProposalOwnershipResponse" } } } @@ -20077,23 +24358,23 @@ } }, "tags": [ - "Bd-intersect-committee" + "Bd-proposal-ownership" ], "parameters": [], - "operationId": "post/bd-intersect-committees", + "operationId": "post/bd-proposal-ownerships", "requestBody": { "required": true, "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BdIntersectCommitteeRequest" + "$ref": "#/components/schemas/BdProposalOwnershipRequest" } } } } } }, - "/bd-intersect-committees/{id}": { + "/bd-proposal-ownerships/{id}": { "get": { "responses": { "200": { @@ -20101,7 +24382,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BdIntersectCommitteeResponse" + "$ref": "#/components/schemas/BdProposalOwnershipResponse" } } } @@ -20158,7 +24439,7 @@ } }, "tags": [ - "Bd-intersect-committee" + "Bd-proposal-ownership" ], "parameters": [ { @@ -20172,7 +24453,7 @@ } } ], - "operationId": "get/bd-intersect-committees/{id}" + "operationId": "get/bd-proposal-ownerships/{id}" }, "put": { "responses": { @@ -20181,7 +24462,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BdIntersectCommitteeResponse" + "$ref": "#/components/schemas/BdProposalOwnershipResponse" } } } @@ -20238,7 +24519,7 @@ } }, "tags": [ - "Bd-intersect-committee" + "Bd-proposal-ownership" ], "parameters": [ { @@ -20252,13 +24533,13 @@ } } ], - "operationId": "put/bd-intersect-committees/{id}", + "operationId": "put/bd-proposal-ownerships/{id}", "requestBody": { "required": true, "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BdIntersectCommitteeRequest" + "$ref": "#/components/schemas/BdProposalOwnershipRequest" } } } @@ -20329,7 +24610,7 @@ } }, "tags": [ - "Bd-intersect-committee" + "Bd-proposal-ownership" ], "parameters": [ { @@ -20343,10 +24624,10 @@ } } ], - "operationId": "delete/bd-intersect-committees/{id}" + "operationId": "delete/bd-proposal-ownerships/{id}" } }, - "/bd-polls": { + "/bd-psapbs": { "get": { "responses": { "200": { @@ -20354,7 +24635,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BdPollListResponse" + "$ref": "#/components/schemas/BdPsapbListResponse" } } } @@ -20411,7 +24692,7 @@ } }, "tags": [ - "Bd-poll" + "Bd-psapb" ], "parameters": [ { @@ -20516,7 +24797,7 @@ } } ], - "operationId": "get/bd-polls" + "operationId": "get/bd-psapbs" }, "post": { "responses": { @@ -20525,7 +24806,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BdPollResponse" + "$ref": "#/components/schemas/BdPsapbResponse" } } } @@ -20582,23 +24863,23 @@ } }, "tags": [ - "Bd-poll" + "Bd-psapb" ], "parameters": [], - "operationId": "post/bd-polls", + "operationId": "post/bd-psapbs", "requestBody": { "required": true, "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BdPollRequest" + "$ref": "#/components/schemas/BdPsapbRequest" } } } } } }, - "/bd-polls/{id}": { + "/bd-psapbs/{id}": { "get": { "responses": { "200": { @@ -20606,7 +24887,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BdPollResponse" + "$ref": "#/components/schemas/BdPsapbResponse" } } } @@ -20663,7 +24944,7 @@ } }, "tags": [ - "Bd-poll" + "Bd-psapb" ], "parameters": [ { @@ -20677,7 +24958,7 @@ } } ], - "operationId": "get/bd-polls/{id}" + "operationId": "get/bd-psapbs/{id}" }, "put": { "responses": { @@ -20686,7 +24967,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BdPollResponse" + "$ref": "#/components/schemas/BdPsapbResponse" } } } @@ -20743,7 +25024,7 @@ } }, "tags": [ - "Bd-poll" + "Bd-psapb" ], "parameters": [ { @@ -20757,13 +25038,13 @@ } } ], - "operationId": "put/bd-polls/{id}", + "operationId": "put/bd-psapbs/{id}", "requestBody": { "required": true, "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BdPollRequest" + "$ref": "#/components/schemas/BdPsapbRequest" } } } @@ -20834,7 +25115,7 @@ } }, "tags": [ - "Bd-poll" + "Bd-psapb" ], "parameters": [ { @@ -20848,10 +25129,10 @@ } } ], - "operationId": "delete/bd-polls/{id}" + "operationId": "delete/bd-psapbs/{id}" } }, - "/bd-poll-votes": { + "/bd-road-maps": { "get": { "responses": { "200": { @@ -20859,7 +25140,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BdPollVoteListResponse" + "$ref": "#/components/schemas/BdRoadMapListResponse" } } } @@ -20916,7 +25197,7 @@ } }, "tags": [ - "Bd-poll-vote" + "Bd-road-map" ], "parameters": [ { @@ -21021,7 +25302,7 @@ } } ], - "operationId": "get/bd-poll-votes" + "operationId": "get/bd-road-maps" }, "post": { "responses": { @@ -21030,7 +25311,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BdPollVoteResponse" + "$ref": "#/components/schemas/BdRoadMapResponse" } } } @@ -21087,23 +25368,23 @@ } }, "tags": [ - "Bd-poll-vote" + "Bd-road-map" ], "parameters": [], - "operationId": "post/bd-poll-votes", + "operationId": "post/bd-road-maps", "requestBody": { "required": true, "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BdPollVoteRequest" + "$ref": "#/components/schemas/BdRoadMapRequest" } } } } } }, - "/bd-poll-votes/{id}": { + "/bd-road-maps/{id}": { "get": { "responses": { "200": { @@ -21111,7 +25392,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BdPollVoteResponse" + "$ref": "#/components/schemas/BdRoadMapResponse" } } } @@ -21168,7 +25449,7 @@ } }, "tags": [ - "Bd-poll-vote" + "Bd-road-map" ], "parameters": [ { @@ -21182,7 +25463,7 @@ } } ], - "operationId": "get/bd-poll-votes/{id}" + "operationId": "get/bd-road-maps/{id}" }, "put": { "responses": { @@ -21191,7 +25472,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BdPollVoteResponse" + "$ref": "#/components/schemas/BdRoadMapResponse" } } } @@ -21248,7 +25529,7 @@ } }, "tags": [ - "Bd-poll-vote" + "Bd-road-map" ], "parameters": [ { @@ -21262,13 +25543,13 @@ } } ], - "operationId": "put/bd-poll-votes/{id}", + "operationId": "put/bd-road-maps/{id}", "requestBody": { "required": true, "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BdPollVoteRequest" + "$ref": "#/components/schemas/BdRoadMapRequest" } } } @@ -21339,7 +25620,7 @@ } }, "tags": [ - "Bd-poll-vote" + "Bd-road-map" ], "parameters": [ { @@ -21353,10 +25634,10 @@ } } ], - "operationId": "delete/bd-poll-votes/{id}" + "operationId": "delete/bd-road-maps/{id}" } }, - "/bd-proposal-details": { + "/bd-types": { "get": { "responses": { "200": { @@ -21364,7 +25645,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BdProposalDetailListResponse" + "$ref": "#/components/schemas/BdTypeListResponse" } } } @@ -21421,7 +25702,7 @@ } }, "tags": [ - "Bd-proposal-detail" + "Bd-type" ], "parameters": [ { @@ -21526,7 +25807,7 @@ } } ], - "operationId": "get/bd-proposal-details" + "operationId": "get/bd-types" }, "post": { "responses": { @@ -21535,7 +25816,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BdProposalDetailResponse" + "$ref": "#/components/schemas/BdTypeResponse" } } } @@ -21592,23 +25873,23 @@ } }, "tags": [ - "Bd-proposal-detail" + "Bd-type" ], "parameters": [], - "operationId": "post/bd-proposal-details", + "operationId": "post/bd-types", "requestBody": { "required": true, "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BdProposalDetailRequest" + "$ref": "#/components/schemas/BdTypeRequest" } } } } } }, - "/bd-proposal-details/{id}": { + "/bd-types/{id}": { "get": { "responses": { "200": { @@ -21616,7 +25897,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BdProposalDetailResponse" + "$ref": "#/components/schemas/BdTypeResponse" } } } @@ -21673,7 +25954,7 @@ } }, "tags": [ - "Bd-proposal-detail" + "Bd-type" ], "parameters": [ { @@ -21687,7 +25968,7 @@ } } ], - "operationId": "get/bd-proposal-details/{id}" + "operationId": "get/bd-types/{id}" }, "put": { "responses": { @@ -21696,7 +25977,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BdProposalDetailResponse" + "$ref": "#/components/schemas/BdTypeResponse" } } } @@ -21753,7 +26034,7 @@ } }, "tags": [ - "Bd-proposal-detail" + "Bd-type" ], "parameters": [ { @@ -21767,13 +26048,13 @@ } } ], - "operationId": "put/bd-proposal-details/{id}", + "operationId": "put/bd-types/{id}", "requestBody": { "required": true, "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BdProposalDetailRequest" + "$ref": "#/components/schemas/BdTypeRequest" } } } @@ -21844,7 +26125,7 @@ } }, "tags": [ - "Bd-proposal-detail" + "Bd-type" ], "parameters": [ { @@ -21858,10 +26139,10 @@ } } ], - "operationId": "delete/bd-proposal-details/{id}" + "operationId": "delete/bd-types/{id}" } }, - "/bd-proposal-ownerships": { + "/comments": { "get": { "responses": { "200": { @@ -21869,7 +26150,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BdProposalOwnershipListResponse" + "$ref": "#/components/schemas/CommentListResponse" } } } @@ -21926,7 +26207,7 @@ } }, "tags": [ - "Bd-proposal-ownership" + "Comment" ], "parameters": [ { @@ -22031,7 +26312,7 @@ } } ], - "operationId": "get/bd-proposal-ownerships" + "operationId": "get/comments" }, "post": { "responses": { @@ -22040,7 +26321,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BdProposalOwnershipResponse" + "$ref": "#/components/schemas/CommentResponse" } } } @@ -22097,23 +26378,23 @@ } }, "tags": [ - "Bd-proposal-ownership" + "Comment" ], "parameters": [], - "operationId": "post/bd-proposal-ownerships", + "operationId": "post/comments", "requestBody": { "required": true, "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BdProposalOwnershipRequest" + "$ref": "#/components/schemas/CommentRequest" } } } } } }, - "/bd-proposal-ownerships/{id}": { + "/comments/{id}": { "get": { "responses": { "200": { @@ -22121,7 +26402,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BdProposalOwnershipResponse" + "$ref": "#/components/schemas/CommentResponse" } } } @@ -22178,7 +26459,7 @@ } }, "tags": [ - "Bd-proposal-ownership" + "Comment" ], "parameters": [ { @@ -22192,7 +26473,7 @@ } } ], - "operationId": "get/bd-proposal-ownerships/{id}" + "operationId": "get/comments/{id}" }, "put": { "responses": { @@ -22201,7 +26482,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BdProposalOwnershipResponse" + "$ref": "#/components/schemas/CommentResponse" } } } @@ -22258,7 +26539,7 @@ } }, "tags": [ - "Bd-proposal-ownership" + "Comment" ], "parameters": [ { @@ -22272,13 +26553,13 @@ } } ], - "operationId": "put/bd-proposal-ownerships/{id}", + "operationId": "put/comments/{id}", "requestBody": { "required": true, "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BdProposalOwnershipRequest" + "$ref": "#/components/schemas/CommentRequest" } } } @@ -22349,7 +26630,7 @@ } }, "tags": [ - "Bd-proposal-ownership" + "Comment" ], "parameters": [ { @@ -22363,10 +26644,10 @@ } } ], - "operationId": "delete/bd-proposal-ownerships/{id}" + "operationId": "delete/comments/{id}" } }, - "/bd-psapbs": { + "/comments-reports": { "get": { "responses": { "200": { @@ -22374,7 +26655,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BdPsapbListResponse" + "$ref": "#/components/schemas/CommentsReportListResponse" } } } @@ -22431,7 +26712,7 @@ } }, "tags": [ - "Bd-psapb" + "Comments-report" ], "parameters": [ { @@ -22536,7 +26817,7 @@ } } ], - "operationId": "get/bd-psapbs" + "operationId": "get/comments-reports" }, "post": { "responses": { @@ -22545,7 +26826,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BdPsapbResponse" + "$ref": "#/components/schemas/CommentsReportResponse" } } } @@ -22602,23 +26883,23 @@ } }, "tags": [ - "Bd-psapb" + "Comments-report" ], "parameters": [], - "operationId": "post/bd-psapbs", + "operationId": "post/comments-reports", "requestBody": { "required": true, "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BdPsapbRequest" + "$ref": "#/components/schemas/CommentsReportRequest" } } } } } }, - "/bd-psapbs/{id}": { + "/comments-reports/{id}": { "get": { "responses": { "200": { @@ -22626,7 +26907,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BdPsapbResponse" + "$ref": "#/components/schemas/CommentsReportResponse" } } } @@ -22683,7 +26964,7 @@ } }, "tags": [ - "Bd-psapb" + "Comments-report" ], "parameters": [ { @@ -22697,7 +26978,7 @@ } } ], - "operationId": "get/bd-psapbs/{id}" + "operationId": "get/comments-reports/{id}" }, "put": { "responses": { @@ -22706,7 +26987,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BdPsapbResponse" + "$ref": "#/components/schemas/CommentsReportResponse" } } } @@ -22763,7 +27044,7 @@ } }, "tags": [ - "Bd-psapb" + "Comments-report" ], "parameters": [ { @@ -22777,13 +27058,13 @@ } } ], - "operationId": "put/bd-psapbs/{id}", + "operationId": "put/comments-reports/{id}", "requestBody": { "required": true, "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BdPsapbRequest" + "$ref": "#/components/schemas/CommentsReportRequest" } } } @@ -22854,7 +27135,7 @@ } }, "tags": [ - "Bd-psapb" + "Comments-report" ], "parameters": [ { @@ -22868,10 +27149,10 @@ } } ], - "operationId": "delete/bd-psapbs/{id}" + "operationId": "delete/comments-reports/{id}" } }, - "/bd-road-maps": { + "/country-lists": { "get": { "responses": { "200": { @@ -22879,7 +27160,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BdRoadMapListResponse" + "$ref": "#/components/schemas/CountryListListResponse" } } } @@ -22936,7 +27217,7 @@ } }, "tags": [ - "Bd-road-map" + "Country-list" ], "parameters": [ { @@ -23041,7 +27322,7 @@ } } ], - "operationId": "get/bd-road-maps" + "operationId": "get/country-lists" }, "post": { "responses": { @@ -23050,7 +27331,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BdRoadMapResponse" + "$ref": "#/components/schemas/CountryListResponse" } } } @@ -23107,23 +27388,23 @@ } }, "tags": [ - "Bd-road-map" + "Country-list" ], "parameters": [], - "operationId": "post/bd-road-maps", + "operationId": "post/country-lists", "requestBody": { "required": true, "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BdRoadMapRequest" + "$ref": "#/components/schemas/CountryListRequest" } } } } } }, - "/bd-road-maps/{id}": { + "/country-lists/{id}": { "get": { "responses": { "200": { @@ -23131,7 +27412,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BdRoadMapResponse" + "$ref": "#/components/schemas/CountryListResponse" } } } @@ -23188,7 +27469,7 @@ } }, "tags": [ - "Bd-road-map" + "Country-list" ], "parameters": [ { @@ -23202,7 +27483,7 @@ } } ], - "operationId": "get/bd-road-maps/{id}" + "operationId": "get/country-lists/{id}" }, "put": { "responses": { @@ -23211,7 +27492,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BdRoadMapResponse" + "$ref": "#/components/schemas/CountryListResponse" } } } @@ -23268,7 +27549,7 @@ } }, "tags": [ - "Bd-road-map" + "Country-list" ], "parameters": [ { @@ -23282,13 +27563,13 @@ } } ], - "operationId": "put/bd-road-maps/{id}", + "operationId": "put/country-lists/{id}", "requestBody": { "required": true, "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BdRoadMapRequest" + "$ref": "#/components/schemas/CountryListRequest" } } } @@ -23359,7 +27640,7 @@ } }, "tags": [ - "Bd-road-map" + "Country-list" ], "parameters": [ { @@ -23373,10 +27654,10 @@ } } ], - "operationId": "delete/bd-road-maps/{id}" + "operationId": "delete/country-lists/{id}" } }, - "/bd-types": { + "/governance-action-types": { "get": { "responses": { "200": { @@ -23384,7 +27665,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BdTypeListResponse" + "$ref": "#/components/schemas/GovernanceActionTypeListResponse" } } } @@ -23441,7 +27722,7 @@ } }, "tags": [ - "Bd-type" + "Governance-action-type" ], "parameters": [ { @@ -23546,7 +27827,7 @@ } } ], - "operationId": "get/bd-types" + "operationId": "get/governance-action-types" }, "post": { "responses": { @@ -23555,7 +27836,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BdTypeResponse" + "$ref": "#/components/schemas/GovernanceActionTypeResponse" } } } @@ -23612,23 +27893,23 @@ } }, "tags": [ - "Bd-type" + "Governance-action-type" ], "parameters": [], - "operationId": "post/bd-types", + "operationId": "post/governance-action-types", "requestBody": { "required": true, "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BdTypeRequest" + "$ref": "#/components/schemas/GovernanceActionTypeRequest" } } } } } }, - "/bd-types/{id}": { + "/governance-action-types/{id}": { "get": { "responses": { "200": { @@ -23636,7 +27917,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BdTypeResponse" + "$ref": "#/components/schemas/GovernanceActionTypeResponse" } } } @@ -23693,7 +27974,7 @@ } }, "tags": [ - "Bd-type" + "Governance-action-type" ], "parameters": [ { @@ -23707,7 +27988,7 @@ } } ], - "operationId": "get/bd-types/{id}" + "operationId": "get/governance-action-types/{id}" }, "put": { "responses": { @@ -23716,7 +27997,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BdTypeResponse" + "$ref": "#/components/schemas/GovernanceActionTypeResponse" } } } @@ -23773,7 +28054,7 @@ } }, "tags": [ - "Bd-type" + "Governance-action-type" ], "parameters": [ { @@ -23787,13 +28068,13 @@ } } ], - "operationId": "put/bd-types/{id}", + "operationId": "put/governance-action-types/{id}", "requestBody": { "required": true, "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BdTypeRequest" + "$ref": "#/components/schemas/GovernanceActionTypeRequest" } } } @@ -23864,7 +28145,7 @@ } }, "tags": [ - "Bd-type" + "Governance-action-type" ], "parameters": [ { @@ -23878,10 +28159,10 @@ } } ], - "operationId": "delete/bd-types/{id}" + "operationId": "delete/governance-action-types/{id}" } }, - "/comments": { + "/polls": { "get": { "responses": { "200": { @@ -23889,7 +28170,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/CommentListResponse" + "$ref": "#/components/schemas/PollListResponse" } } } @@ -23946,7 +28227,7 @@ } }, "tags": [ - "Comment" + "Poll" ], "parameters": [ { @@ -24051,7 +28332,7 @@ } } ], - "operationId": "get/comments" + "operationId": "get/polls" }, "post": { "responses": { @@ -24060,7 +28341,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/CommentResponse" + "$ref": "#/components/schemas/PollResponse" } } } @@ -24117,23 +28398,23 @@ } }, "tags": [ - "Comment" + "Poll" ], "parameters": [], - "operationId": "post/comments", + "operationId": "post/polls", "requestBody": { "required": true, "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/CommentRequest" + "$ref": "#/components/schemas/PollRequest" } } } } } }, - "/comments/{id}": { + "/polls/{id}": { "get": { "responses": { "200": { @@ -24141,7 +28422,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/CommentResponse" + "$ref": "#/components/schemas/PollResponse" } } } @@ -24198,7 +28479,7 @@ } }, "tags": [ - "Comment" + "Poll" ], "parameters": [ { @@ -24212,7 +28493,7 @@ } } ], - "operationId": "get/comments/{id}" + "operationId": "get/polls/{id}" }, "put": { "responses": { @@ -24221,7 +28502,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/CommentResponse" + "$ref": "#/components/schemas/PollResponse" } } } @@ -24278,7 +28559,7 @@ } }, "tags": [ - "Comment" + "Poll" ], "parameters": [ { @@ -24292,13 +28573,13 @@ } } ], - "operationId": "put/comments/{id}", + "operationId": "put/polls/{id}", "requestBody": { "required": true, "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/CommentRequest" + "$ref": "#/components/schemas/PollRequest" } } } @@ -24369,7 +28650,7 @@ } }, "tags": [ - "Comment" + "Poll" ], "parameters": [ { @@ -24383,10 +28664,10 @@ } } ], - "operationId": "delete/comments/{id}" + "operationId": "delete/polls/{id}" } }, - "/comments-reports": { + "/poll-votes": { "get": { "responses": { "200": { @@ -24394,7 +28675,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/CommentsReportListResponse" + "$ref": "#/components/schemas/PollVoteListResponse" } } } @@ -24451,7 +28732,7 @@ } }, "tags": [ - "Comments-report" + "Poll-vote" ], "parameters": [ { @@ -24556,7 +28837,7 @@ } } ], - "operationId": "get/comments-reports" + "operationId": "get/poll-votes" }, "post": { "responses": { @@ -24565,7 +28846,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/CommentsReportResponse" + "$ref": "#/components/schemas/PollVoteResponse" } } } @@ -24622,23 +28903,23 @@ } }, "tags": [ - "Comments-report" + "Poll-vote" ], "parameters": [], - "operationId": "post/comments-reports", + "operationId": "post/poll-votes", "requestBody": { "required": true, "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/CommentsReportRequest" + "$ref": "#/components/schemas/PollVoteRequest" } } } } } }, - "/comments-reports/{id}": { + "/poll-votes/{id}": { "get": { "responses": { "200": { @@ -24646,7 +28927,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/CommentsReportResponse" + "$ref": "#/components/schemas/PollVoteResponse" } } } @@ -24703,7 +28984,7 @@ } }, "tags": [ - "Comments-report" + "Poll-vote" ], "parameters": [ { @@ -24717,7 +28998,7 @@ } } ], - "operationId": "get/comments-reports/{id}" + "operationId": "get/poll-votes/{id}" }, "put": { "responses": { @@ -24726,7 +29007,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/CommentsReportResponse" + "$ref": "#/components/schemas/PollVoteResponse" } } } @@ -24783,7 +29064,7 @@ } }, "tags": [ - "Comments-report" + "Poll-vote" ], "parameters": [ { @@ -24797,13 +29078,13 @@ } } ], - "operationId": "put/comments-reports/{id}", + "operationId": "put/poll-votes/{id}", "requestBody": { "required": true, "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/CommentsReportRequest" + "$ref": "#/components/schemas/PollVoteRequest" } } } @@ -24874,7 +29155,7 @@ } }, "tags": [ - "Comments-report" + "Poll-vote" ], "parameters": [ { @@ -24888,10 +29169,10 @@ } } ], - "operationId": "delete/comments-reports/{id}" + "operationId": "delete/poll-votes/{id}" } }, - "/country-lists": { + "/proposals": { "get": { "responses": { "200": { @@ -24899,7 +29180,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/CountryListListResponse" + "$ref": "#/components/schemas/ProposalListResponse" } } } @@ -24956,7 +29237,7 @@ } }, "tags": [ - "Country-list" + "Proposal" ], "parameters": [ { @@ -25061,7 +29342,7 @@ } } ], - "operationId": "get/country-lists" + "operationId": "get/proposals" }, "post": { "responses": { @@ -25070,7 +29351,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/CountryListResponse" + "$ref": "#/components/schemas/ProposalResponse" } } } @@ -25127,23 +29408,23 @@ } }, "tags": [ - "Country-list" + "Proposal" ], "parameters": [], - "operationId": "post/country-lists", + "operationId": "post/proposals", "requestBody": { "required": true, "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/CountryListRequest" + "$ref": "#/components/schemas/ProposalRequest" } } } } } }, - "/country-lists/{id}": { + "/proposals/{id}": { "get": { "responses": { "200": { @@ -25151,7 +29432,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/CountryListResponse" + "$ref": "#/components/schemas/ProposalResponse" } } } @@ -25208,7 +29489,7 @@ } }, "tags": [ - "Country-list" + "Proposal" ], "parameters": [ { @@ -25222,7 +29503,7 @@ } } ], - "operationId": "get/country-lists/{id}" + "operationId": "get/proposals/{id}" }, "put": { "responses": { @@ -25231,7 +29512,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/CountryListResponse" + "$ref": "#/components/schemas/ProposalResponse" } } } @@ -25288,7 +29569,7 @@ } }, "tags": [ - "Country-list" + "Proposal" ], "parameters": [ { @@ -25302,13 +29583,13 @@ } } ], - "operationId": "put/country-lists/{id}", + "operationId": "put/proposals/{id}", "requestBody": { "required": true, "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/CountryListRequest" + "$ref": "#/components/schemas/ProposalRequest" } } } @@ -25379,7 +29660,7 @@ } }, "tags": [ - "Country-list" + "Proposal" ], "parameters": [ { @@ -25393,10 +29674,10 @@ } } ], - "operationId": "delete/country-lists/{id}" + "operationId": "delete/proposals/{id}" } }, - "/governance-action-types": { + "/proposal-constitution-contents": { "get": { "responses": { "200": { @@ -25404,7 +29685,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GovernanceActionTypeListResponse" + "$ref": "#/components/schemas/ProposalConstitutionContentListResponse" } } } @@ -25461,7 +29742,7 @@ } }, "tags": [ - "Governance-action-type" + "Proposal-constitution-content" ], "parameters": [ { @@ -25566,7 +29847,7 @@ } } ], - "operationId": "get/governance-action-types" + "operationId": "get/proposal-constitution-contents" }, "post": { "responses": { @@ -25575,7 +29856,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GovernanceActionTypeResponse" + "$ref": "#/components/schemas/ProposalConstitutionContentResponse" } } } @@ -25632,23 +29913,23 @@ } }, "tags": [ - "Governance-action-type" + "Proposal-constitution-content" ], "parameters": [], - "operationId": "post/governance-action-types", + "operationId": "post/proposal-constitution-contents", "requestBody": { "required": true, "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GovernanceActionTypeRequest" + "$ref": "#/components/schemas/ProposalConstitutionContentRequest" } } } } } }, - "/governance-action-types/{id}": { + "/proposal-constitution-contents/{id}": { "get": { "responses": { "200": { @@ -25656,7 +29937,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GovernanceActionTypeResponse" + "$ref": "#/components/schemas/ProposalConstitutionContentResponse" } } } @@ -25713,7 +29994,7 @@ } }, "tags": [ - "Governance-action-type" + "Proposal-constitution-content" ], "parameters": [ { @@ -25727,7 +30008,7 @@ } } ], - "operationId": "get/governance-action-types/{id}" + "operationId": "get/proposal-constitution-contents/{id}" }, "put": { "responses": { @@ -25736,7 +30017,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GovernanceActionTypeResponse" + "$ref": "#/components/schemas/ProposalConstitutionContentResponse" } } } @@ -25793,7 +30074,7 @@ } }, "tags": [ - "Governance-action-type" + "Proposal-constitution-content" ], "parameters": [ { @@ -25807,13 +30088,13 @@ } } ], - "operationId": "put/governance-action-types/{id}", + "operationId": "put/proposal-constitution-contents/{id}", "requestBody": { "required": true, "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GovernanceActionTypeRequest" + "$ref": "#/components/schemas/ProposalConstitutionContentRequest" } } } @@ -25884,7 +30165,7 @@ } }, "tags": [ - "Governance-action-type" + "Proposal-constitution-content" ], "parameters": [ { @@ -25898,10 +30179,10 @@ } } ], - "operationId": "delete/governance-action-types/{id}" + "operationId": "delete/proposal-constitution-contents/{id}" } }, - "/polls": { + "/proposal-contents": { "get": { "responses": { "200": { @@ -25909,7 +30190,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/PollListResponse" + "$ref": "#/components/schemas/ProposalContentListResponse" } } } @@ -25966,7 +30247,7 @@ } }, "tags": [ - "Poll" + "Proposal-content" ], "parameters": [ { @@ -26071,7 +30352,7 @@ } } ], - "operationId": "get/polls" + "operationId": "get/proposal-contents" }, "post": { "responses": { @@ -26080,7 +30361,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/PollResponse" + "$ref": "#/components/schemas/ProposalContentResponse" } } } @@ -26137,23 +30418,23 @@ } }, "tags": [ - "Poll" + "Proposal-content" ], "parameters": [], - "operationId": "post/polls", + "operationId": "post/proposal-contents", "requestBody": { "required": true, "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/PollRequest" + "$ref": "#/components/schemas/ProposalContentRequest" } } } } } }, - "/polls/{id}": { + "/proposal-contents/{id}": { "get": { "responses": { "200": { @@ -26161,7 +30442,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/PollResponse" + "$ref": "#/components/schemas/ProposalContentResponse" } } } @@ -26218,7 +30499,7 @@ } }, "tags": [ - "Poll" + "Proposal-content" ], "parameters": [ { @@ -26232,7 +30513,7 @@ } } ], - "operationId": "get/polls/{id}" + "operationId": "get/proposal-contents/{id}" }, "put": { "responses": { @@ -26241,7 +30522,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/PollResponse" + "$ref": "#/components/schemas/ProposalContentResponse" } } } @@ -26298,7 +30579,7 @@ } }, "tags": [ - "Poll" + "Proposal-content" ], "parameters": [ { @@ -26312,13 +30593,13 @@ } } ], - "operationId": "put/polls/{id}", + "operationId": "put/proposal-contents/{id}", "requestBody": { "required": true, "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/PollRequest" + "$ref": "#/components/schemas/ProposalContentRequest" } } } @@ -26389,7 +30670,7 @@ } }, "tags": [ - "Poll" + "Proposal-content" ], "parameters": [ { @@ -26403,10 +30684,10 @@ } } ], - "operationId": "delete/polls/{id}" + "operationId": "delete/proposal-contents/{id}" } }, - "/poll-votes": { + "/proposal-hard-fork-contents": { "get": { "responses": { "200": { @@ -26414,7 +30695,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/PollVoteListResponse" + "$ref": "#/components/schemas/ProposalHardForkContentListResponse" } } } @@ -26471,7 +30752,7 @@ } }, "tags": [ - "Poll-vote" + "Proposal-hard-fork-content" ], "parameters": [ { @@ -26576,7 +30857,7 @@ } } ], - "operationId": "get/poll-votes" + "operationId": "get/proposal-hard-fork-contents" }, "post": { "responses": { @@ -26585,7 +30866,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/PollVoteResponse" + "$ref": "#/components/schemas/ProposalHardForkContentResponse" } } } @@ -26642,23 +30923,23 @@ } }, "tags": [ - "Poll-vote" + "Proposal-hard-fork-content" ], "parameters": [], - "operationId": "post/poll-votes", + "operationId": "post/proposal-hard-fork-contents", "requestBody": { "required": true, "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/PollVoteRequest" + "$ref": "#/components/schemas/ProposalHardForkContentRequest" } } } } } }, - "/poll-votes/{id}": { + "/proposal-hard-fork-contents/{id}": { "get": { "responses": { "200": { @@ -26666,7 +30947,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/PollVoteResponse" + "$ref": "#/components/schemas/ProposalHardForkContentResponse" } } } @@ -26723,7 +31004,7 @@ } }, "tags": [ - "Poll-vote" + "Proposal-hard-fork-content" ], "parameters": [ { @@ -26737,7 +31018,7 @@ } } ], - "operationId": "get/poll-votes/{id}" + "operationId": "get/proposal-hard-fork-contents/{id}" }, "put": { "responses": { @@ -26746,7 +31027,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/PollVoteResponse" + "$ref": "#/components/schemas/ProposalHardForkContentResponse" } } } @@ -26803,7 +31084,7 @@ } }, "tags": [ - "Poll-vote" + "Proposal-hard-fork-content" ], "parameters": [ { @@ -26817,13 +31098,13 @@ } } ], - "operationId": "put/poll-votes/{id}", + "operationId": "put/proposal-hard-fork-contents/{id}", "requestBody": { "required": true, "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/PollVoteRequest" + "$ref": "#/components/schemas/ProposalHardForkContentRequest" } } } @@ -26894,7 +31175,7 @@ } }, "tags": [ - "Poll-vote" + "Proposal-hard-fork-content" ], "parameters": [ { @@ -26908,10 +31189,10 @@ } } ], - "operationId": "delete/poll-votes/{id}" + "operationId": "delete/proposal-hard-fork-contents/{id}" } }, - "/proposals": { + "/proposal-submitions": { "get": { "responses": { "200": { @@ -26919,7 +31200,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ProposalListResponse" + "$ref": "#/components/schemas/ProposalSubmitionListResponse" } } } @@ -26976,7 +31257,7 @@ } }, "tags": [ - "Proposal" + "Proposal-submition" ], "parameters": [ { @@ -27081,7 +31362,7 @@ } } ], - "operationId": "get/proposals" + "operationId": "get/proposal-submitions" }, "post": { "responses": { @@ -27090,7 +31371,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ProposalResponse" + "$ref": "#/components/schemas/ProposalSubmitionResponse" } } } @@ -27147,23 +31428,23 @@ } }, "tags": [ - "Proposal" + "Proposal-submition" ], "parameters": [], - "operationId": "post/proposals", + "operationId": "post/proposal-submitions", "requestBody": { "required": true, "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ProposalRequest" + "$ref": "#/components/schemas/ProposalSubmitionRequest" } } } } } }, - "/proposals/{id}": { + "/proposal-submitions/{id}": { "get": { "responses": { "200": { @@ -27171,7 +31452,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ProposalResponse" + "$ref": "#/components/schemas/ProposalSubmitionResponse" } } } @@ -27228,7 +31509,7 @@ } }, "tags": [ - "Proposal" + "Proposal-submition" ], "parameters": [ { @@ -27242,7 +31523,7 @@ } } ], - "operationId": "get/proposals/{id}" + "operationId": "get/proposal-submitions/{id}" }, "put": { "responses": { @@ -27251,7 +31532,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ProposalResponse" + "$ref": "#/components/schemas/ProposalSubmitionResponse" } } } @@ -27308,7 +31589,7 @@ } }, "tags": [ - "Proposal" + "Proposal-submition" ], "parameters": [ { @@ -27322,13 +31603,13 @@ } } ], - "operationId": "put/proposals/{id}", + "operationId": "put/proposal-submitions/{id}", "requestBody": { "required": true, "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ProposalRequest" + "$ref": "#/components/schemas/ProposalSubmitionRequest" } } } @@ -27399,7 +31680,7 @@ } }, "tags": [ - "Proposal" + "Proposal-submition" ], "parameters": [ { @@ -27413,10 +31694,10 @@ } } ], - "operationId": "delete/proposals/{id}" + "operationId": "delete/proposal-submitions/{id}" } }, - "/proposal-constitution-contents": { + "/proposal-update-committee-contents": { "get": { "responses": { "200": { @@ -27424,7 +31705,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ProposalConstitutionContentListResponse" + "$ref": "#/components/schemas/ProposalUpdateCommitteeContentListResponse" } } } @@ -27481,7 +31762,7 @@ } }, "tags": [ - "Proposal-constitution-content" + "Proposal-update-committee-content" ], "parameters": [ { @@ -27586,7 +31867,7 @@ } } ], - "operationId": "get/proposal-constitution-contents" + "operationId": "get/proposal-update-committee-contents" }, "post": { "responses": { @@ -27595,7 +31876,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ProposalConstitutionContentResponse" + "$ref": "#/components/schemas/ProposalUpdateCommitteeContentResponse" } } } @@ -27652,23 +31933,23 @@ } }, "tags": [ - "Proposal-constitution-content" + "Proposal-update-committee-content" ], "parameters": [], - "operationId": "post/proposal-constitution-contents", + "operationId": "post/proposal-update-committee-contents", "requestBody": { "required": true, "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ProposalConstitutionContentRequest" + "$ref": "#/components/schemas/ProposalUpdateCommitteeContentRequest" } } } } } }, - "/proposal-constitution-contents/{id}": { + "/proposal-update-committee-contents/{id}": { "get": { "responses": { "200": { @@ -27676,7 +31957,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ProposalConstitutionContentResponse" + "$ref": "#/components/schemas/ProposalUpdateCommitteeContentResponse" } } } @@ -27733,7 +32014,7 @@ } }, "tags": [ - "Proposal-constitution-content" + "Proposal-update-committee-content" ], "parameters": [ { @@ -27747,7 +32028,7 @@ } } ], - "operationId": "get/proposal-constitution-contents/{id}" + "operationId": "get/proposal-update-committee-contents/{id}" }, "put": { "responses": { @@ -27756,7 +32037,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ProposalConstitutionContentResponse" + "$ref": "#/components/schemas/ProposalUpdateCommitteeContentResponse" } } } @@ -27813,7 +32094,7 @@ } }, "tags": [ - "Proposal-constitution-content" + "Proposal-update-committee-content" ], "parameters": [ { @@ -27827,13 +32108,13 @@ } } ], - "operationId": "put/proposal-constitution-contents/{id}", + "operationId": "put/proposal-update-committee-contents/{id}", "requestBody": { "required": true, "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ProposalConstitutionContentRequest" + "$ref": "#/components/schemas/ProposalUpdateCommitteeContentRequest" } } } @@ -27904,7 +32185,7 @@ } }, "tags": [ - "Proposal-constitution-content" + "Proposal-update-committee-content" ], "parameters": [ { @@ -27918,10 +32199,10 @@ } } ], - "operationId": "delete/proposal-constitution-contents/{id}" + "operationId": "delete/proposal-update-committee-contents/{id}" } }, - "/proposal-contents": { + "/proposal-votes": { "get": { "responses": { "200": { @@ -27929,7 +32210,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ProposalContentListResponse" + "$ref": "#/components/schemas/ProposalVoteListResponse" } } } @@ -27986,7 +32267,7 @@ } }, "tags": [ - "Proposal-content" + "Proposal-vote" ], "parameters": [ { @@ -28091,7 +32372,7 @@ } } ], - "operationId": "get/proposal-contents" + "operationId": "get/proposal-votes" }, "post": { "responses": { @@ -28100,7 +32381,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ProposalContentResponse" + "$ref": "#/components/schemas/ProposalVoteResponse" } } } @@ -28157,23 +32438,23 @@ } }, "tags": [ - "Proposal-content" + "Proposal-vote" ], "parameters": [], - "operationId": "post/proposal-contents", + "operationId": "post/proposal-votes", "requestBody": { "required": true, "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ProposalContentRequest" + "$ref": "#/components/schemas/ProposalVoteRequest" } } } } } }, - "/proposal-contents/{id}": { + "/proposal-votes/{id}": { "get": { "responses": { "200": { @@ -28181,7 +32462,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ProposalContentResponse" + "$ref": "#/components/schemas/ProposalVoteResponse" } } } @@ -28238,7 +32519,7 @@ } }, "tags": [ - "Proposal-content" + "Proposal-vote" ], "parameters": [ { @@ -28252,7 +32533,7 @@ } } ], - "operationId": "get/proposal-contents/{id}" + "operationId": "get/proposal-votes/{id}" }, "put": { "responses": { @@ -28261,7 +32542,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ProposalContentResponse" + "$ref": "#/components/schemas/ProposalVoteResponse" } } } @@ -28318,7 +32599,7 @@ } }, "tags": [ - "Proposal-content" + "Proposal-vote" ], "parameters": [ { @@ -28332,13 +32613,13 @@ } } ], - "operationId": "put/proposal-contents/{id}", + "operationId": "put/proposal-votes/{id}", "requestBody": { "required": true, "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ProposalContentRequest" + "$ref": "#/components/schemas/ProposalVoteRequest" } } } @@ -28409,7 +32690,7 @@ } }, "tags": [ - "Proposal-content" + "Proposal-vote" ], "parameters": [ { @@ -28423,10 +32704,10 @@ } } ], - "operationId": "delete/proposal-contents/{id}" + "operationId": "delete/proposal-votes/{id}" } }, - "/proposal-submitions": { + "/wallet-types": { "get": { "responses": { "200": { @@ -28434,7 +32715,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ProposalSubmitionListResponse" + "$ref": "#/components/schemas/WalletTypeListResponse" } } } @@ -28491,7 +32772,7 @@ } }, "tags": [ - "Proposal-submition" + "Wallet-type" ], "parameters": [ { @@ -28582,191 +32863,30 @@ "required": false, "schema": { "type": "object" - }, - "style": "deepObject" - }, - { - "name": "locale", - "in": "query", - "description": "Locale to apply", - "deprecated": false, - "required": false, - "schema": { - "type": "string" - } - } - ], - "operationId": "get/proposal-submitions" - }, - "post": { - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProposalSubmitionResponse" - } - } - } - }, - "400": { - "description": "Bad Request", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, - "401": { - "description": "Unauthorized", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, - "403": { - "description": "Forbidden", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, - "404": { - "description": "Not Found", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, - "500": { - "description": "Internal Server Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - } - }, - "tags": [ - "Proposal-submition" - ], - "parameters": [], - "operationId": "post/proposal-submitions", - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProposalSubmitionRequest" - } - } - } - } - } - }, - "/proposal-submitions/{id}": { - "get": { - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProposalSubmitionResponse" - } - } - } - }, - "400": { - "description": "Bad Request", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, - "401": { - "description": "Unauthorized", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, - "403": { - "description": "Forbidden", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, - "404": { - "description": "Not Found", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } + }, + "style": "deepObject" }, - "500": { - "description": "Internal Server Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - } - }, - "tags": [ - "Proposal-submition" - ], - "parameters": [ { - "name": "id", - "in": "path", - "description": "", + "name": "locale", + "in": "query", + "description": "Locale to apply", "deprecated": false, - "required": true, + "required": false, "schema": { - "type": "number" + "type": "string" } } ], - "operationId": "get/proposal-submitions/{id}" + "operationId": "get/wallet-types" }, - "put": { + "post": { "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ProposalSubmitionResponse" + "$ref": "#/components/schemas/WalletTypeResponse" } } } @@ -28823,41 +32943,31 @@ } }, "tags": [ - "Proposal-submition" - ], - "parameters": [ - { - "name": "id", - "in": "path", - "description": "", - "deprecated": false, - "required": true, - "schema": { - "type": "number" - } - } + "Wallet-type" ], - "operationId": "put/proposal-submitions/{id}", + "parameters": [], + "operationId": "post/wallet-types", "requestBody": { "required": true, "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ProposalSubmitionRequest" + "$ref": "#/components/schemas/WalletTypeRequest" } } } } - }, - "delete": { + } + }, + "/wallet-types/{id}": { + "get": { "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { - "type": "integer", - "format": "int64" + "$ref": "#/components/schemas/WalletTypeResponse" } } } @@ -28914,7 +33024,7 @@ } }, "tags": [ - "Proposal-submition" + "Wallet-type" ], "parameters": [ { @@ -28928,18 +33038,16 @@ } } ], - "operationId": "delete/proposal-submitions/{id}" - } - }, - "/proposal-votes": { - "get": { + "operationId": "get/wallet-types/{id}" + }, + "put": { "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ProposalVoteListResponse" + "$ref": "#/components/schemas/WalletTypeResponse" } } } @@ -28996,121 +33104,41 @@ } }, "tags": [ - "Proposal-vote" + "Wallet-type" ], "parameters": [ { - "name": "sort", - "in": "query", - "description": "Sort by attributes ascending (asc) or descending (desc)", - "deprecated": false, - "required": false, - "schema": { - "type": "string" - } - }, - { - "name": "pagination[withCount]", - "in": "query", - "description": "Return page/pageSize (default: true)", - "deprecated": false, - "required": false, - "schema": { - "type": "boolean" - } - }, - { - "name": "pagination[page]", - "in": "query", - "description": "Page number (default: 0)", - "deprecated": false, - "required": false, - "schema": { - "type": "integer" - } - }, - { - "name": "pagination[pageSize]", - "in": "query", - "description": "Page size (default: 25)", - "deprecated": false, - "required": false, - "schema": { - "type": "integer" - } - }, - { - "name": "pagination[start]", - "in": "query", - "description": "Offset value (default: 0)", - "deprecated": false, - "required": false, - "schema": { - "type": "integer" - } - }, - { - "name": "pagination[limit]", - "in": "query", - "description": "Number of entities to return (default: 25)", - "deprecated": false, - "required": false, - "schema": { - "type": "integer" - } - }, - { - "name": "fields", - "in": "query", - "description": "Fields to return (ex: title,author)", - "deprecated": false, - "required": false, - "schema": { - "type": "string" - } - }, - { - "name": "populate", - "in": "query", - "description": "Relations to return", - "deprecated": false, - "required": false, - "schema": { - "type": "string" - } - }, - { - "name": "filters", - "in": "query", - "description": "Filters to apply", - "deprecated": false, - "required": false, - "schema": { - "type": "object" - }, - "style": "deepObject" - }, - { - "name": "locale", - "in": "query", - "description": "Locale to apply", + "name": "id", + "in": "path", + "description": "", "deprecated": false, - "required": false, + "required": true, "schema": { - "type": "string" + "type": "number" } } ], - "operationId": "get/proposal-votes" + "operationId": "put/wallet-types/{id}", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WalletTypeRequest" + } + } + } + } }, - "post": { + "delete": { "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ProposalVoteResponse" + "type": "integer", + "format": "int64" } } } @@ -29167,57 +33195,101 @@ } }, "tags": [ - "Proposal-vote" + "Wallet-type" ], - "parameters": [], - "operationId": "post/proposal-votes", - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProposalVoteRequest" - } + "parameters": [ + { + "name": "id", + "in": "path", + "description": "", + "deprecated": false, + "required": true, + "schema": { + "type": "number" } } - } + ], + "operationId": "delete/wallet-types/{id}" } }, - "/proposal-votes/{id}": { + "/connect/{provider}": { "get": { + "parameters": [ + { + "name": "provider", + "in": "path", + "required": true, + "description": "Provider name", + "schema": { + "type": "string", + "pattern": ".*" + } + } + ], + "tags": [ + "Users-Permissions - Auth" + ], + "summary": "Login with a provider", + "description": "Redirects to provider login before being redirect to /auth/{provider}/callback", "responses": { - "200": { - "description": "OK", + "301": { + "description": "Redirect response" + }, + "default": { + "description": "Error", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ProposalVoteResponse" + "$ref": "#/components/schemas/Error" } } } - }, - "400": { - "description": "Bad Request", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" + } + } + } + }, + "/auth/local": { + "post": { + "tags": [ + "Users-Permissions - Auth" + ], + "summary": "Local login", + "description": "Returns a jwt token and user info", + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "identifier": { + "type": "string" + }, + "password": { + "type": "string" + } } + }, + "example": { + "identifier": "foobar", + "password": "Test1234" } } }, - "401": { - "description": "Unauthorized", + "required": true + }, + "responses": { + "200": { + "description": "Connection", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Error" + "$ref": "#/components/schemas/Users-Permissions-UserRegistration" } } } }, - "403": { - "description": "Forbidden", + "default": { + "description": "Error", "content": { "application/json": { "schema": { @@ -29225,19 +33297,56 @@ } } } + } + } + } + }, + "/auth/local/register": { + "post": { + "tags": [ + "Users-Permissions - Auth" + ], + "summary": "Register a user", + "description": "Returns a jwt token and user info", + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "username": { + "type": "string" + }, + "email": { + "type": "string" + }, + "password": { + "type": "string" + } + } + }, + "example": { + "username": "foobar", + "email": "foo.bar@strapi.io", + "password": "Test1234" + } + } }, - "404": { - "description": "Not Found", + "required": true + }, + "responses": { + "200": { + "description": "Successful registration", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Error" + "$ref": "#/components/schemas/Users-Permissions-UserRegistration" } } } }, - "500": { - "description": "Internal Server Error", + "default": { + "description": "Error", "content": { "application/json": { "schema": { @@ -29246,48 +33355,39 @@ } } } - }, + } + } + }, + "/auth/{provider}/callback": { + "get": { "tags": [ - "Proposal-vote" + "Users-Permissions - Auth" ], + "summary": "Default Callback from provider auth", "parameters": [ { - "name": "id", + "name": "provider", "in": "path", - "description": "", - "deprecated": false, "required": true, + "description": "Provider name", "schema": { - "type": "number" + "type": "string" } } ], - "operationId": "get/proposal-votes/{id}" - }, - "put": { "responses": { "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProposalVoteResponse" - } - } - } - }, - "400": { - "description": "Bad Request", + "description": "Returns a jwt token and user info", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Error" + "$ref": "#/components/schemas/Users-Permissions-UserRegistration" } } } }, - "401": { - "description": "Unauthorized", + "default": { + "description": "Error", "content": { "application/json": { "schema": { @@ -29295,29 +33395,55 @@ } } } - }, - "403": { - "description": "Forbidden", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" + } + } + } + }, + "/auth/forgot-password": { + "post": { + "tags": [ + "Users-Permissions - Auth" + ], + "summary": "Send rest password email", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "email": { + "type": "string" + } } + }, + "example": { + "email": "foo.bar@strapi.io" } } - }, - "404": { - "description": "Not Found", + } + }, + "responses": { + "200": { + "description": "Returns ok", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Error" + "type": "object", + "properties": { + "ok": { + "type": "string", + "enum": [ + true + ] + } + } } } } }, - "500": { - "description": "Internal Server Error", + "default": { + "description": "Error", "content": { "application/json": { "schema": { @@ -29326,59 +33452,54 @@ } } } - }, + } + } + }, + "/auth/reset-password": { + "post": { "tags": [ - "Proposal-vote" + "Users-Permissions - Auth" ], - "parameters": [ - { - "name": "id", - "in": "path", - "description": "", - "deprecated": false, - "required": true, - "schema": { - "type": "number" - } - } - ], - "operationId": "put/proposal-votes/{id}", + "summary": "Rest user password", "requestBody": { "required": true, "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ProposalVoteRequest" + "type": "object", + "properties": { + "password": { + "type": "string" + }, + "passwordConfirmation": { + "type": "string" + }, + "code": { + "type": "string" + } + } + }, + "example": { + "password": "Test1234", + "passwordConfirmation": "Test1234", + "code": "zertyoaizndoianzodianzdonaizdoinaozdnia" } } } - } - }, - "delete": { + }, "responses": { "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "type": "integer", - "format": "int64" - } - } - } - }, - "400": { - "description": "Bad Request", + "description": "Returns a jwt token and user info", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Error" + "$ref": "#/components/schemas/Users-Permissions-UserRegistration" } } } }, - "401": { - "description": "Unauthorized", + "default": { + "description": "Error", "content": { "application/json": { "schema": { @@ -29386,29 +33507,55 @@ } } } - }, - "403": { - "description": "Forbidden", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" + } + } + } + }, + "/auth/change-password": { + "post": { + "tags": [ + "Users-Permissions - Auth" + ], + "summary": "Update user's own password", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "password", + "currentPassword", + "passwordConfirmation" + ], + "properties": { + "password": { + "type": "string" + }, + "currentPassword": { + "type": "string" + }, + "passwordConfirmation": { + "type": "string" + } } } } - }, - "404": { - "description": "Not Found", + } + }, + "responses": { + "200": { + "description": "Returns a jwt token and user info", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Error" + "$ref": "#/components/schemas/Users-Permissions-UserRegistration" } } } }, - "500": { - "description": "Internal Server Error", + "default": { + "description": "Error", "content": { "application/json": { "schema": { @@ -29417,50 +33564,31 @@ } } } - }, + } + } + }, + "/auth/email-confirmation": { + "get": { "tags": [ - "Proposal-vote" + "Users-Permissions - Auth" ], + "summary": "Confirm user email", "parameters": [ { - "name": "id", - "in": "path", - "description": "", - "deprecated": false, - "required": true, + "in": "query", + "name": "confirmation", "schema": { - "type": "number" - } + "type": "string" + }, + "description": "confirmation token received by email" } ], - "operationId": "delete/proposal-votes/{id}" - } - }, - "/wallet-types": { - "get": { "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/WalletTypeListResponse" - } - } - } - }, - "400": { - "description": "Bad Request", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } + "301": { + "description": "Redirects to the configure email confirmation redirect url" }, - "401": { - "description": "Unauthorized", + "default": { + "description": "Error", "content": { "application/json": { "schema": { @@ -29468,29 +33596,55 @@ } } } - }, - "403": { - "description": "Forbidden", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" + } + } + } + }, + "/auth/send-email-confirmation": { + "post": { + "tags": [ + "Users-Permissions - Auth" + ], + "summary": "Send confirmation email", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "email": { + "type": "string" + } } } } - }, - "404": { - "description": "Not Found", + } + }, + "responses": { + "200": { + "description": "Returns email and boolean to confirm email was sent", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Error" + "type": "object", + "properties": { + "email": { + "type": "string" + }, + "sent": { + "type": "string", + "enum": [ + true + ] + } + } } } } }, - "500": { - "description": "Internal Server Error", + "default": { + "description": "Error", "content": { "application/json": { "schema": { @@ -29499,129 +33653,69 @@ } } } - }, + } + } + }, + "/users-permissions/permissions": { + "get": { "tags": [ - "Wallet-type" - ], - "parameters": [ - { - "name": "sort", - "in": "query", - "description": "Sort by attributes ascending (asc) or descending (desc)", - "deprecated": false, - "required": false, - "schema": { - "type": "string" - } - }, - { - "name": "pagination[withCount]", - "in": "query", - "description": "Return page/pageSize (default: true)", - "deprecated": false, - "required": false, - "schema": { - "type": "boolean" - } - }, - { - "name": "pagination[page]", - "in": "query", - "description": "Page number (default: 0)", - "deprecated": false, - "required": false, - "schema": { - "type": "integer" - } - }, - { - "name": "pagination[pageSize]", - "in": "query", - "description": "Page size (default: 25)", - "deprecated": false, - "required": false, - "schema": { - "type": "integer" - } - }, - { - "name": "pagination[start]", - "in": "query", - "description": "Offset value (default: 0)", - "deprecated": false, - "required": false, - "schema": { - "type": "integer" - } - }, - { - "name": "pagination[limit]", - "in": "query", - "description": "Number of entities to return (default: 25)", - "deprecated": false, - "required": false, - "schema": { - "type": "integer" - } - }, - { - "name": "fields", - "in": "query", - "description": "Fields to return (ex: title,author)", - "deprecated": false, - "required": false, - "schema": { - "type": "string" - } - }, - { - "name": "populate", - "in": "query", - "description": "Relations to return", - "deprecated": false, - "required": false, - "schema": { - "type": "string" - } - }, - { - "name": "filters", - "in": "query", - "description": "Filters to apply", - "deprecated": false, - "required": false, - "schema": { - "type": "object" - }, - "style": "deepObject" - }, - { - "name": "locale", - "in": "query", - "description": "Locale to apply", - "deprecated": false, - "required": false, - "schema": { - "type": "string" - } - } + "Users-Permissions - Users & Roles" ], - "operationId": "get/wallet-types" - }, - "post": { + "summary": "Get default generated permissions", "responses": { "200": { - "description": "OK", + "description": "Returns the permissions tree", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/WalletTypeResponse" + "type": "object", + "properties": { + "permissions": { + "$ref": "#/components/schemas/Users-Permissions-PermissionsTree" + } + } + }, + "example": { + "permissions": { + "api::content-type.content-type": { + "controllers": { + "controllerA": { + "find": { + "enabled": false, + "policy": "" + }, + "findOne": { + "enabled": false, + "policy": "" + }, + "create": { + "enabled": false, + "policy": "" + } + }, + "controllerB": { + "find": { + "enabled": false, + "policy": "" + }, + "findOne": { + "enabled": false, + "policy": "" + }, + "create": { + "enabled": false, + "policy": "" + } + } + } + } + } } } } }, - "400": { - "description": "Bad Request", + "default": { + "description": "Error", "content": { "application/json": { "schema": { @@ -29629,19 +33723,62 @@ } } } - }, - "401": { - "description": "Unauthorized", + } + } + } + }, + "/users-permissions/roles": { + "get": { + "tags": [ + "Users-Permissions - Users & Roles" + ], + "summary": "List roles", + "responses": { + "200": { + "description": "Returns list of roles", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Error" + "type": "object", + "properties": { + "roles": { + "type": "array", + "items": { + "allOf": [ + { + "$ref": "#/components/schemas/Users-Permissions-Role" + }, + { + "type": "object", + "properties": { + "nb_users": { + "type": "number" + } + } + } + ] + } + } + } + }, + "example": { + "roles": [ + { + "id": 1, + "name": "Public", + "description": "Default role given to unauthenticated user.", + "type": "public", + "createdAt": "2022-05-19T17:35:35.097Z", + "updatedAt": "2022-05-31T16:05:36.603Z", + "nb_users": 0 + } + ] } } } }, - "403": { - "description": "Forbidden", + "default": { + "description": "Error", "content": { "application/json": { "schema": { @@ -29649,19 +33786,38 @@ } } } - }, - "404": { - "description": "Not Found", + } + } + }, + "post": { + "tags": [ + "Users-Permissions - Users & Roles" + ], + "summary": "Create a role", + "requestBody": { + "$ref": "#/components/requestBodies/Users-Permissions-RoleRequest" + }, + "responses": { + "200": { + "description": "Returns ok if the role was create", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Error" + "type": "object", + "properties": { + "ok": { + "type": "string", + "enum": [ + true + ] + } + } } } } }, - "500": { - "description": "Internal Server Error", + "default": { + "description": "Error", "content": { "application/json": { "schema": { @@ -29670,39 +33826,65 @@ } } } - }, - "tags": [ - "Wallet-type" - ], - "parameters": [], - "operationId": "post/wallet-types", - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/WalletTypeRequest" - } - } - } } } }, - "/wallet-types/{id}": { + "/users-permissions/roles/{id}": { "get": { + "tags": [ + "Users-Permissions - Users & Roles" + ], + "summary": "Get a role", + "parameters": [ + { + "in": "path", + "name": "id", + "required": true, + "schema": { + "type": "string" + }, + "description": "role Id" + } + ], "responses": { "200": { - "description": "OK", + "description": "Returns the role", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/WalletTypeResponse" + "type": "object", + "properties": { + "role": { + "$ref": "#/components/schemas/Users-Permissions-Role" + } + } + }, + "example": { + "role": { + "id": 1, + "name": "Public", + "description": "Default role given to unauthenticated user.", + "type": "public", + "createdAt": "2022-05-19T17:35:35.097Z", + "updatedAt": "2022-05-31T16:05:36.603Z", + "permissions": { + "api::content-type.content-type": { + "controllers": { + "controllerA": { + "find": { + "enabled": true + } + } + } + } + } + } } } } }, - "400": { - "description": "Bad Request", + "default": { + "description": "Error", "content": { "application/json": { "schema": { @@ -29710,19 +33892,51 @@ } } } - }, - "401": { - "description": "Unauthorized", + } + } + } + }, + "/users-permissions/roles/{role}": { + "put": { + "tags": [ + "Users-Permissions - Users & Roles" + ], + "summary": "Update a role", + "parameters": [ + { + "in": "path", + "name": "role", + "required": true, + "schema": { + "type": "string" + }, + "description": "role Id" + } + ], + "requestBody": { + "$ref": "#/components/requestBodies/Users-Permissions-RoleRequest" + }, + "responses": { + "200": { + "description": "Returns ok if the role was udpated", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Error" + "type": "object", + "properties": { + "ok": { + "type": "string", + "enum": [ + true + ] + } + } } } } }, - "403": { - "description": "Forbidden", + "default": { + "description": "Error", "content": { "application/json": { "schema": { @@ -29730,19 +33944,46 @@ } } } - }, - "404": { - "description": "Not Found", + } + } + }, + "delete": { + "tags": [ + "Users-Permissions - Users & Roles" + ], + "summary": "Delete a role", + "parameters": [ + { + "in": "path", + "name": "role", + "required": true, + "schema": { + "type": "string" + }, + "description": "role Id" + } + ], + "responses": { + "200": { + "description": "Returns ok if the role was delete", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Error" + "type": "object", + "properties": { + "ok": { + "type": "string", + "enum": [ + true + ] + } + } } } } }, - "500": { - "description": "Internal Server Error", + "default": { + "description": "Error", "content": { "application/json": { "schema": { @@ -29751,38 +33992,43 @@ } } } - }, + } + } + }, + "/users": { + "get": { "tags": [ - "Wallet-type" - ], - "parameters": [ - { - "name": "id", - "in": "path", - "description": "", - "deprecated": false, - "required": true, - "schema": { - "type": "number" - } - } + "Users-Permissions - Users & Roles" ], - "operationId": "get/wallet-types/{id}" - }, - "put": { + "summary": "Get list of users", "responses": { "200": { - "description": "OK", + "description": "Returns an array of users", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/WalletTypeResponse" - } + "type": "array", + "items": { + "$ref": "#/components/schemas/Users-Permissions-User" + } + }, + "example": [ + { + "id": 9, + "username": "foao@strapi.io", + "email": "foao@strapi.io", + "provider": "local", + "confirmed": false, + "blocked": false, + "createdAt": "2022-06-01T18:32:35.211Z", + "updatedAt": "2022-06-01T18:32:35.217Z" + } + ] } } }, - "400": { - "description": "Bad Request", + "default": { + "description": "Error", "content": { "application/json": { "schema": { @@ -29790,19 +34036,88 @@ } } } - }, - "401": { - "description": "Unauthorized", + } + } + }, + "post": { + "tags": [ + "Users-Permissions - Users & Roles" + ], + "summary": "Create a user", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "username", + "email", + "password" + ], + "properties": { + "email": { + "type": "string" + }, + "username": { + "type": "string" + }, + "password": { + "type": "string" + } + } + }, + "example": { + "username": "foo", + "email": "foo@strapi.io", + "password": "foo-password" + } + } + } + }, + "responses": { + "201": { + "description": "Returns created user info", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Error" + "allOf": [ + { + "$ref": "#/components/schemas/Users-Permissions-User" + }, + { + "type": "object", + "properties": { + "role": { + "$ref": "#/components/schemas/Users-Permissions-Role" + } + } + } + ] + }, + "example": { + "id": 1, + "username": "foo", + "email": "foo@strapi.io", + "provider": "local", + "confirmed": false, + "blocked": false, + "createdAt": "2022-05-19T17:35:35.096Z", + "updatedAt": "2022-05-19T17:35:35.096Z", + "role": { + "id": 1, + "name": "X", + "description": "Default role given to authenticated user.", + "type": "authenticated", + "createdAt": "2022-05-19T17:35:35.096Z", + "updatedAt": "2022-06-04T07:11:59.551Z" + } } } } }, - "403": { - "description": "Forbidden", + "default": { + "description": "Error", "content": { "application/json": { "schema": { @@ -29810,19 +34125,50 @@ } } } - }, - "404": { - "description": "Not Found", + } + } + } + }, + "/users/{id}": { + "get": { + "tags": [ + "Users-Permissions - Users & Roles" + ], + "summary": "Get a user", + "parameters": [ + { + "in": "path", + "name": "id", + "required": true, + "schema": { + "type": "string" + }, + "description": "user Id" + } + ], + "responses": { + "200": { + "description": "Returns a user", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Error" + "$ref": "#/components/schemas/Users-Permissions-User" + }, + "example": { + "id": 1, + "username": "foo", + "email": "foo@strapi.io", + "provider": "local", + "confirmed": false, + "blocked": false, + "createdAt": "2022-05-19T17:35:35.096Z", + "updatedAt": "2022-05-19T17:35:35.096Z" } } } }, - "500": { - "description": "Internal Server Error", + "default": { + "description": "Error", "content": { "application/json": { "schema": { @@ -29831,49 +34177,98 @@ } } } - }, + } + }, + "put": { "tags": [ - "Wallet-type" + "Users-Permissions - Users & Roles" ], + "summary": "Update a user", "parameters": [ { - "name": "id", "in": "path", - "description": "", - "deprecated": false, + "name": "id", "required": true, "schema": { - "type": "number" - } + "type": "string" + }, + "description": "user Id" } ], - "operationId": "put/wallet-types/{id}", "requestBody": { "required": true, "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/WalletTypeRequest" + "type": "object", + "required": [ + "username", + "email", + "password" + ], + "properties": { + "email": { + "type": "string" + }, + "username": { + "type": "string" + }, + "password": { + "type": "string" + } + } + }, + "example": { + "username": "foo", + "email": "foo@strapi.io", + "password": "foo-password" } } } - } - }, - "delete": { + }, "responses": { "200": { - "description": "OK", + "description": "Returns updated user info", "content": { "application/json": { "schema": { - "type": "integer", - "format": "int64" + "allOf": [ + { + "$ref": "#/components/schemas/Users-Permissions-User" + }, + { + "type": "object", + "properties": { + "role": { + "$ref": "#/components/schemas/Users-Permissions-Role" + } + } + } + ] + }, + "example": { + "id": 1, + "username": "foo", + "email": "foo@strapi.io", + "provider": "local", + "confirmed": false, + "blocked": false, + "createdAt": "2022-05-19T17:35:35.096Z", + "updatedAt": "2022-05-19T17:35:35.096Z", + "role": { + "id": 1, + "name": "X", + "description": "Default role given to authenticated user.", + "type": "authenticated", + "createdAt": "2022-05-19T17:35:35.096Z", + "updatedAt": "2022-06-04T07:11:59.551Z" + } } } } }, - "400": { - "description": "Bad Request", + "default": { + "description": "Error", "content": { "application/json": { "schema": { @@ -29881,19 +34276,52 @@ } } } - }, - "401": { - "description": "Unauthorized", + } + } + }, + "delete": { + "tags": [ + "Users-Permissions - Users & Roles" + ], + "summary": "Delete a user", + "parameters": [ + { + "in": "path", + "name": "id", + "required": true, + "schema": { + "type": "string" + }, + "description": "user Id" + } + ], + "responses": { + "200": { + "description": "Returns deleted user info", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Error" + "allOf": [ + { + "$ref": "#/components/schemas/Users-Permissions-User" + } + ] + }, + "example": { + "id": 1, + "username": "foo", + "email": "foo@strapi.io", + "provider": "local", + "confirmed": false, + "blocked": false, + "createdAt": "2022-05-19T17:35:35.096Z", + "updatedAt": "2022-05-19T17:35:35.096Z" } } } }, - "403": { - "description": "Forbidden", + "default": { + "description": "Error", "content": { "application/json": { "schema": { @@ -29901,19 +34329,39 @@ } } } - }, - "404": { - "description": "Not Found", + } + } + } + }, + "/users/me": { + "get": { + "tags": [ + "Users-Permissions - Users & Roles" + ], + "summary": "Get authenticated user info", + "responses": { + "200": { + "description": "Returns user info", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Error" + "$ref": "#/components/schemas/Users-Permissions-User" + }, + "example": { + "id": 1, + "username": "foo", + "email": "foo@strapi.io", + "provider": "local", + "confirmed": false, + "blocked": false, + "createdAt": "2022-05-19T17:35:35.096Z", + "updatedAt": "2022-05-19T17:35:35.096Z" } } } }, - "500": { - "description": "Internal Server Error", + "default": { + "description": "Error", "content": { "application/json": { "schema": { @@ -29922,24 +34370,57 @@ } } } - }, + } + } + }, + "/users/count": { + "get": { "tags": [ - "Wallet-type" + "Users-Permissions - Users & Roles" ], - "parameters": [ - { - "name": "id", - "in": "path", - "description": "", - "deprecated": false, - "required": true, - "schema": { - "type": "number" + "summary": "Get user count", + "responses": { + "200": { + "description": "Returns a number", + "content": { + "application/json": { + "schema": { + "type": "number" + }, + "example": 1 + } + } + }, + "default": { + "description": "Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } } } - ], - "operationId": "delete/wallet-types/{id}" + } + } + } + }, + "tags": [ + { + "name": "Users-Permissions - Auth", + "description": "Authentication endpoints", + "externalDocs": { + "description": "Find out more", + "url": "https://docs.strapi.io/developer-docs/latest/plugins/users-permissions.html" + } + }, + { + "name": "Users-Permissions - Users & Roles", + "description": "Users, roles, and permissions endpoints", + "externalDocs": { + "description": "Find out more", + "url": "https://docs.strapi.io/developer-docs/latest/plugins/users-permissions.html" } } - } + ] } diff --git a/pdf-ui/src/components/BudgetDiscussionCard/index.jsx b/pdf-ui/src/components/BudgetDiscussionCard/index.jsx index ddc93d6..94e5ef4 100644 --- a/pdf-ui/src/components/BudgetDiscussionCard/index.jsx +++ b/pdf-ui/src/components/BudgetDiscussionCard/index.jsx @@ -31,6 +31,7 @@ import { correctVoteAdaFormat, formatIsoDate } from '../../lib/utils'; import EditProposalDialog from '../EditProposalDialog'; import MarkdownTextComponent from '../MarkdownTextComponent'; import CreateBudgetDiscussionDialog from '../CreateBudgetDiscussionDialog'; +import MarkdownTypography from '../../lib/markdownRenderer'; const BudgetDiscussionCard = ({ budgetDiscussion, @@ -378,9 +379,18 @@ const BudgetDiscussionCard = ({ ? `draft-proposal-benefit` : 'proposal-benefit' } + style={{ + display: '-webkit-box', + WebkitBoxOrient: 'vertical', + WebkitLineClamp: 3, + overflow: 'hidden', + textOverflow: 'ellipsis', + lineHeight: '1.5', + maxHeight: '4.5em', + }} > - + {/* */} @@ -486,10 +507,7 @@ const BudgetDiscussionCard = ({ display={'flex'} alignItems={'center'} > - + @@ -506,8 +525,9 @@ const BudgetDiscussionCard = ({ {user && user?.user?.id?.toString() === - budgetDiscussion?.attributes?.creator?.data?.id?.toString() && - budgetDiscussion?.attributes?.submitted_for_vote == null && ( + budgetDiscussion?.attributes?.creator?.data?.id?.toString() && + budgetDiscussion?.attributes + ?.submitted_for_vote == null && ( )} diff --git a/pdf-ui/src/components/BudgetDiscussionParts/BudgetDiscussionLinkManager.jsx b/pdf-ui/src/components/BudgetDiscussionParts/BudgetDiscussionLinkManager.jsx index 4bf8884..90f6d3f 100644 --- a/pdf-ui/src/components/BudgetDiscussionParts/BudgetDiscussionLinkManager.jsx +++ b/pdf-ui/src/components/BudgetDiscussionParts/BudgetDiscussionLinkManager.jsx @@ -5,14 +5,23 @@ import { useTheme } from '@mui/material/styles'; import { isValidURLFormat } from '../../lib/utils'; -const BudgetDiscussionLinkManager = ({maxLinks = 20, budgetDiscussionData, setBudgetDiscussionData, setLinksData, errors, setErrors}) => { +const BudgetDiscussionLinkManager = ({ + maxLinks = 20, + budgetDiscussionData, + setBudgetDiscussionData, + setLinksData, + errors, + setErrors, +}) => { const theme = useTheme(); const [linksErrors, setLinksErrors] = useState({}); - useEffect(() => { - if(budgetDiscussionData.bd_further_information?.proposal_links === undefined) - { - let links = [{ prop_link: '' },{ prop_link: '' }]; + useEffect(() => { + if ( + budgetDiscussionData.bd_further_information?.proposal_links === + undefined + ) { + let links = [{ prop_link: '' }, { prop_link: '' }]; setBudgetDiscussionData({ ...budgetDiscussionData, bd_further_information: { @@ -24,12 +33,11 @@ const BudgetDiscussionLinkManager = ({maxLinks = 20, budgetDiscussionData, setBu }, []); useEffect(() => { - setErrors((prev) => ({ ...prev, linkErrors:{...linksErrors }})); - }, [linksErrors]); - + setErrors((prev) => ({ ...prev, linkErrors: { ...linksErrors } })); + }, [linksErrors]); const updateProposalLinks = (newLinks) => { - setBudgetDiscussionData(prev => ({ + setBudgetDiscussionData((prev) => ({ ...prev, bd_further_information: { ...prev.bd_further_information, @@ -37,149 +45,199 @@ const BudgetDiscussionLinkManager = ({maxLinks = 20, budgetDiscussionData, setBu }, })); }; - + const handleLinkChange = (index, field, value) => { - const newLinks = budgetDiscussionData.bd_further_information?.proposal_links?.map((link, i) => - i === index ? { ...link, [field]: value } : link - ); - + const newLinks = + budgetDiscussionData.bd_further_information?.proposal_links?.map( + (link, i) => (i === index ? { ...link, [field]: value } : link) + ); + updateProposalLinks(newLinks); if (field === 'prop_link') { if (value === '') { - setLinksErrors(prev => { + setLinksErrors((prev) => { const { [index]: removed, ...rest } = prev; return rest; }); - } else { + } else if (typeof value === 'string' && value.length > 2048) { + setLinksErrors((prev) => ({ + ...prev, + [index]: { + ...prev[index], + url: 'URL must be 2048 characters or less', + }, + })); + } else if (typeof value === 'string' && value.length > 0) { const isValid = isValidURLFormat(value); - setLinksErrors(prev => ({ + setLinksErrors((prev) => ({ ...prev, [index]: { ...prev[index], url: isValid ? '' : 'Invalid URL format', }, })); + } else { + setLinksErrors((prev) => { + const { [index]: removed, ...rest } = prev; + return rest; + }); + } + } else if (field === 'prop_link_text') { + if (value.length > 255) { + setLinksErrors((prev) => ({ + ...prev, + [index]: { + ...prev[index], + text: 'Text must be 255 characters or less', + }, + })); + } else { + setLinksErrors((prev) => ({ + ...prev, + [index]: { + ...prev[index], + text: '', + }, + })); } } }; const handleAddLink = () => { - const currentLinks = budgetDiscussionData.bd_further_information?.proposal_links || []; + const currentLinks = + budgetDiscussionData.bd_further_information?.proposal_links || []; if (currentLinks.length < maxLinks) { updateProposalLinks([ ...currentLinks, - { prop_link: '', prop_link_text: '' } + { prop_link: '', prop_link_text: '' }, ]); } }; - + const handleRemoveLink = (index) => { - const newLinks = budgetDiscussionData.bd_further_information?.proposal_links?.filter( - (_, i) => i !== index - ); - + const newLinks = + budgetDiscussionData.bd_further_information?.proposal_links?.filter( + (_, i) => i !== index + ); + updateProposalLinks(newLinks); - + // Uklanjanje grešaka za uklonjeni link - setLinksErrors(prev => { + setLinksErrors((prev) => { const { [index]: removed, ...rest } = prev; return rest; }); }; return ( - - - + + (maximum of {maxLinks} entries) - {budgetDiscussionData.bd_further_information?.proposal_links?.map((link, index) => ( - theme.palette.primary.lightGray} - position='relative' - > - - - handleRemoveLink(index)} - data-testid='link-wrapper-remove-link-button' - > - - - - - - handleLinkChange( - index, - 'prop_link', - e.target.value - ) - } - placeholder='https://website.com' + {budgetDiscussionData.bd_further_information?.proposal_links?.map( + (link, index) => ( + + theme.palette.primary.lightGray + } + position='relative' + > + + + handleRemoveLink(index)} + data-testid='link-wrapper-remove-link-button' + > + + + + - - handleLinkChange( - index, - 'prop_link_text', - e.target.value - ) - } - placeholder='Text' - sx={{ - mb: 2, - '& .MuiOutlinedInput-root': { - background: '#fff', - '& fieldset': { - borderColor: `${theme.palette.border.lightGray}`, + > + + handleLinkChange( + index, + 'prop_link', + e.target.value + ) + } + placeholder='https://website.com' + sx={{ + mb: 2, + '& .MuiOutlinedInput-root': { + background: '#fff', + '& fieldset': { + borderColor: `${theme.palette.border.lightGray}`, + }, }, - }, - }} - inputProps={{ - 'data-testid': `link-${index}-text-input`, - }} - /> + }} + inputProps={{ + 'data-testid': `link-${index}-url-input`, + }} + error={!!linksErrors[index]?.url} + helperText={linksErrors[index]?.url} + FormHelperTextProps={{ + sx: { + backgroundColor: 'transparent', + }, + 'data-testid': `link-${index}-url-input-error`, + }} + /> + + handleLinkChange( + index, + 'prop_link_text', + e.target.value + ) + } + placeholder='Text' + error={!!linksErrors[index]?.text} + helperText={linksErrors[index]?.text} + sx={{ + mb: 2, + '& .MuiOutlinedInput-root': { + background: '#fff', + '& fieldset': { + borderColor: `${theme.palette.border.lightGray}`, + }, + }, + }} + inputProps={{ + 'data-testid': `link-${index}-text-input`, + }} + FormHelperTextProps={{ + sx: { + backgroundColor: 'transparent', + }, + 'data-testid': `link-text-${index}-url-input-error`, + }} + /> + - - ))} - {budgetDiscussionData.bd_further_information?.proposal_links?.length < maxLinks && ( + ) + )} + {budgetDiscussionData.bd_further_information?.proposal_links + ?.length < maxLinks && ( - {link.prop_link_text} + + {link.prop_link_text} + ) )} diff --git a/pdf-ui/src/components/BudgetDiscussionParts/ProblemStatementsAndProposalBenefits/index.jsx b/pdf-ui/src/components/BudgetDiscussionParts/ProblemStatementsAndProposalBenefits/index.jsx index 615c4bc..a00a523 100644 --- a/pdf-ui/src/components/BudgetDiscussionParts/ProblemStatementsAndProposalBenefits/index.jsx +++ b/pdf-ui/src/components/BudgetDiscussionParts/ProblemStatementsAndProposalBenefits/index.jsx @@ -335,6 +335,12 @@ const ProblemStatementsAndProposalBenefits = ({ 'explain_proposal_roadmap' ) } + InputProps={{ + inputProps: { + 'data-testid': + 'proposal-roadmap-description-input', + }, + }} sx={{ mb: 2 }} /> ) : null} diff --git a/pdf-ui/src/components/BudgetDiscussionParts/ProposalOwnership/index.jsx b/pdf-ui/src/components/BudgetDiscussionParts/ProposalOwnership/index.jsx index 2256c7c..539c996 100644 --- a/pdf-ui/src/components/BudgetDiscussionParts/ProposalOwnership/index.jsx +++ b/pdf-ui/src/components/BudgetDiscussionParts/ProposalOwnership/index.jsx @@ -150,26 +150,33 @@ const ProposalOwnership = ({ onChange={(e) => { handleSubmitedOnBehalfChange(e); }} - // SelectProps={{ - // SelectDisplayProps: { - // 'data-testid': '', - // }, - // }} - InputProps={{ - inputProps: { + SelectProps={{ + SelectDisplayProps: { 'data-testid': 'proposal-committee', }, }} helperText='If you are submitting on behalf of an Intersect Committee, please select Group. The Group Name would be the “Name of the Committee (e.g. MCC, TSC)”. The Type of Group would be “Intersect Committee”. The Key Information to Identify the Group would be the names of the Voting members of the Committee.' sx={{ mb: 2 }} > - + Individual - + Company - + Group @@ -261,15 +268,11 @@ const ProposalOwnership = ({ onChange={(e) => handleDataChange(e, 'be_country') } - // SelectProps={{ - // SelectDisplayProps: { - // 'data-testid': - // 'country-of-incorporation', - // }, - // }} - inputProps={{ - 'data-testid': - 'country-of-incorporation', + SelectProps={{ + SelectDisplayProps: { + 'data-testid': + 'country-of-incorporation', + }, }} sx={{ mb: 2 }} > diff --git a/pdf-ui/src/components/BudgetDiscussionParts/StepperActionButtons.jsx b/pdf-ui/src/components/BudgetDiscussionParts/StepperActionButtons.jsx index b12c63f..6e661d2 100644 --- a/pdf-ui/src/components/BudgetDiscussionParts/StepperActionButtons.jsx +++ b/pdf-ui/src/components/BudgetDiscussionParts/StepperActionButtons.jsx @@ -21,9 +21,12 @@ const StepperActionButtons = ({ backText = 'Back', errors, }) => { + console.log('🚀 ~ errors:', errors); // Calculate backStep if not provided const calculatedBackStep = backStep !== undefined ? backStep : nextStep - 2; const [continueDisabled, setContinueDisabled] = useState(false); + const [draftDisabled, setDraftDisabled] = useState(false); + const hasAnyNonEmptyString = (obj) => { if (typeof obj === 'string') { return obj.trim() !== ''; @@ -39,6 +42,14 @@ const StepperActionButtons = ({ useEffect(() => { setContinueDisabled(hasAnyNonEmptyString(errors)); + + setDraftDisabled( + !!( + errors && + errors.linkErrors && + (errors.linkErrors[0]?.url || errors.linkErrors[0]?.text) + ) + ); }, [errors, continueDisabled]); return ( @@ -71,6 +82,7 @@ const StepperActionButtons = ({ diff --git a/pdf-ui/src/components/BudgetDiscussionReviewVersions/index.js b/pdf-ui/src/components/BudgetDiscussionReviewVersions/index.js index 95de6a7..b426a5a 100644 --- a/pdf-ui/src/components/BudgetDiscussionReviewVersions/index.js +++ b/pdf-ui/src/components/BudgetDiscussionReviewVersions/index.js @@ -344,8 +344,6 @@ const BudgetDiscussionReviewVersions = ({ open, onClose, id }) => { > {`${formatIsoDate( selectedVersion - ?.attributes - ?.content ?.attributes ?.createdAt )}${ @@ -904,7 +902,7 @@ const BudgetDiscussionReviewVersions = ({ open, onClose, id }) => { { variant='body2' style={{ margin: 0, + textOverflow: + 'ellipsis', + overflow: + 'hidden', + maxWidth: + '600px', }} data-testid={`link-${index}-text-content`} > diff --git a/pdf-ui/src/components/BudgetDiscussionsList/index.jsx b/pdf-ui/src/components/BudgetDiscussionsList/index.jsx index 20f9f0a..fd1123b 100644 --- a/pdf-ui/src/components/BudgetDiscussionsList/index.jsx +++ b/pdf-ui/src/components/BudgetDiscussionsList/index.jsx @@ -42,6 +42,7 @@ const BudgetDiscussionsList = ({ }) => { const theme = useTheme(); const sliderRef = useRef(null); + const observer = useRef(); const [showAll, setShowAll] = useState(false); const [budgetDiscussionList, setBudgetDiscussionList] = useState([]); @@ -208,6 +209,24 @@ const BudgetDiscussionsList = ({ setIsAllProposalsListEmpty, ]); + const lastBudgetProposalRef = useCallback( + (node) => { + if (observer.current) observer.current.disconnect(); + observer.current = new window.IntersectionObserver((entries) => { + if ( + entries[0].isIntersecting && + currentPage < pageCount && + budgetDiscussionList.length > 0 + ) { + fetchBudgetDiscussions(false, currentPage + 1); + setCurrentPage((prev) => prev + 1); + } + }); + if (node) observer.current.observe(node); + }, + [currentPage, pageCount, budgetDiscussionList.length] + ); + return budgetDiscussionList?.length === 0 ? null : ( - {budgetDiscussionList?.map((bd, index) => ( - - { + const isLast = + index === budgetDiscussionList.length - 1; + return ( + - - ))} + > + + + ); + })} - {currentPage < pageCount && ( + {/* {currentPage < pageCount && ( - )} + )} */} ) : ( diff --git a/pdf-ui/src/components/CreateBudgetDiscussionDialog/index.jsx b/pdf-ui/src/components/CreateBudgetDiscussionDialog/index.jsx index 01c6578..80985b3 100644 --- a/pdf-ui/src/components/CreateBudgetDiscussionDialog/index.jsx +++ b/pdf-ui/src/components/CreateBudgetDiscussionDialog/index.jsx @@ -521,6 +521,9 @@ const CreateBudgetDiscussionDialog = ({ open={open} onClose={onClose} data-testid='create-budget-discussion-dialog' + PaperProps={{ + sx: { borderRadius: 0 }, + }} > { const [proposalData, setProposalData] = useState({ proposal_links: [], proposal_withdrawals: [], - proposal_constitution_content:{} + proposal_constitution_content: {}, }); - const [governanceActionTypes, setGovernanceActionTypes] = useState([]); const [isContinueDisabled, setIsContinueDisabled] = useState(true); - const [showDraftSuccessfulModal, setShowDraftSuccessfulModal] = useState(false); + const [showDraftSuccessfulModal, setShowDraftSuccessfulModal] = + useState(false); const [selectedDraftId, setSelectedDraftId] = useState(null); const [errors, setErrors] = useState({ name: false, @@ -52,8 +52,9 @@ const CreateGovernanceActionDialog = ({ open = false, onClose = false }) => { }); const [linksErrors, setLinksErrors] = useState({}); - const [withdrawalsErrors, setWithdrawalsErrors ] = useState({}); - const [constitutionErrors,setConstitutionErrors] = useState({}); + const [withdrawalsErrors, setWithdrawalsErrors] = useState({}); + const [constitutionErrors, setConstitutionErrors] = useState({}); + const [hardForkErrors, setHardForkErrors] = useState({}); const isSmallScreen = useMediaQuery((theme) => theme.breakpoints.down('sm') ); @@ -87,7 +88,9 @@ const CreateGovernanceActionDialog = ({ open = false, onClose = false }) => { proposalData?.proposal_links?.some( (link) => !link.prop_link || !link.prop_link_text ) || - Object.values(linksErrors).some((error) => error.url) + Object.values(linksErrors).some( + (error) => error.url || error.text + ) ) { return setIsContinueDisabled(true); } else { @@ -97,38 +100,81 @@ const CreateGovernanceActionDialog = ({ open = false, onClose = false }) => { const selectedLabel = governanceActionTypes.find( (option) => option?.value === proposalData?.gov_action_type_id )?.label; - const selectedType = governanceActionTypes.find((option) => option?.value === proposalData?.gov_action_type_id)?.value; + const selectedType = governanceActionTypes.find( + (option) => option?.value === proposalData?.gov_action_type_id + )?.value; if (proposalData?.gov_action_type_id == 2) { if (proposalData?.proposal_withdrawals) { - if ( - proposalData?.proposal_withdrawals?.some( - (proposal_withdrawal) => !proposal_withdrawal.prop_receiving_address || !proposal_withdrawal.prop_amount - ) || - Object.values(withdrawalsErrors).some( - (errors) =>!errors.prop_amount== '' || !errors.prop_receiving_address =='' - ) ){ + if ( + proposalData?.proposal_withdrawals?.some( + (proposal_withdrawal) => + !proposal_withdrawal.prop_receiving_address || + !proposal_withdrawal.prop_amount + ) || + Object.values(withdrawalsErrors).some( + (errors) => + !errors.prop_amount == '' || + !errors.prop_receiving_address == '' + ) + ) { return setIsContinueDisabled(true); } else { setIsContinueDisabled(false); } } - } + } if (proposalData?.gov_action_type_id == 3) { - if(!proposalData?.proposal_constitution_content?.prop_constitution_url || constitutionErrors?.prop_constitution_url) + if ( + !proposalData?.proposal_constitution_content + ?.prop_constitution_url || + constitutionErrors?.prop_constitution_url + ) return setIsContinueDisabled(true); - if(proposalData?.proposal_constitution_content?.prop_have_guardrails_script) - { - if(!proposalData?.proposal_constitution_content.prop_guardrails_script_url || !proposalData?.proposal_constitution_content.prop_guardrails_script_hash) - return setIsContinueDisabled(true); + if ( + proposalData?.proposal_constitution_content + ?.prop_have_guardrails_script + ) { + if ( + !proposalData?.proposal_constitution_content + .prop_guardrails_script_url || + !proposalData?.proposal_constitution_content + .prop_guardrails_script_hash + ) + return setIsContinueDisabled(true); + } else { + setIsContinueDisabled(false); } - else { + } + console.log( + '🚀 ~ handleIsContinueDisabled ~ proposalData:', + proposalData + ); + console.log( + '🚀 ~ handleIsContinueDisabled ~ hardForkErrors:', + hardForkErrors + ); + if (proposalData?.gov_action_type_id == 6) { + if ( + !proposalData?.proposal_hard_fork_content?.major || + hardForkErrors?.major || + !proposalData?.proposal_hard_fork_content?.minor || + hardForkErrors?.minor + ) { + return setIsContinueDisabled(true); + } else { setIsContinueDisabled(false); } } } else { setIsContinueDisabled(true); } - }, [proposalData, errors, linksErrors, withdrawalsErrors, constitutionErrors]); // proposalData is a dependency + }, [ + proposalData, + errors, + linksErrors, + withdrawalsErrors, + constitutionErrors, + ]); // proposalData is a dependency // useEffect(() => { // handleIsContinueDisabled() // },[proposalData]) @@ -185,6 +231,9 @@ const CreateGovernanceActionDialog = ({ open = false, onClose = false }) => { open={open} onClose={onClose} data-testid='create-governance-action-dialog' + PaperProps={{ + sx: { borderRadius: 0 }, + }} > { withdrawalsErrors={withdrawalsErrors} setWithdrawalsErrors={setWithdrawalsErrors} constitutionErrors={constitutionErrors} - setConstitutionErrors={setConstitutionErrors} + setConstitutionErrors={ + setConstitutionErrors + } + hardForkErrors={hardForkErrors} + setHardForkErrors={setHardForkErrors} /> )} diff --git a/pdf-ui/src/components/CreationGoveranceAction/HardForkManager.jsx b/pdf-ui/src/components/CreationGoveranceAction/HardForkManager.jsx new file mode 100644 index 0000000..e1483b3 --- /dev/null +++ b/pdf-ui/src/components/CreationGoveranceAction/HardForkManager.jsx @@ -0,0 +1,183 @@ +import { Box, TextField } from '@mui/material'; +import React, { useEffect } from 'react'; +import { getHardForkData } from '../../lib/api'; +import { numberValidation } from '../../lib/utils'; + +const HardForkManager = ({ + proposalData, + setProposalData, + hardForkErrors, + setHardForkErrors, +}) => { + const fetchAndSetHardForkData = async () => { + try { + const resp = await getHardForkData(); + const data = resp.data; + + if (data) { + setProposalData((prevData) => ({ + ...prevData, + proposal_hard_fork_content: { + ...prevData.proposal_hard_fork_content, + previous_ga_hash: data.hash, + previous_ga_id: data.id, + }, + })); + } + } catch (error) { + console.error('Error fetching hard fork data:', error); + } + }; + + useEffect(() => { + fetchAndSetHardForkData(); + }, []); + + const handleHardForkDataChange = (field, value) => { + setProposalData((prevData) => ({ + ...prevData, + proposal_hard_fork_content: { + ...prevData.proposal_hard_fork_content, + [field]: value, + }, + })); + const validationError = validateNumberInput(value); + if (!validationError.value) { + setHardForkErrors((prevErrors) => { + const { [field]: removed, ...rest } = prevErrors; + return rest; + }); + } else { + setHardForkErrors((prevErrors) => ({ + ...prevErrors, + [field]: validationError.text, + })); + } + }; + + const validateNumberInput = (value) => { + if (isNaN(value) || value === '') { + return { value: true, text: 'Please enter a valid number' }; + } else if (value < 0) { + return { value: true, text: 'Number cannot be negative' }; + } else { + return { value: false, text: '' }; + } + }; + return ( + <> + + {}} + // required + disabled + inputProps={{ + 'data-testid': `previous-ga-hash-input`, + }} + error={!!hardForkErrors?.previous_ga_hash} + helperText={hardForkErrors?.previous_ga_hash} + FormHelperTextProps={{ + sx: { + backgroundColor: 'transparent', + }, + 'data-testid': `previous-ga-hash-error`, + }} + /> + + + {}} + // required + inputProps={{ + 'data-testid': `previous-ga-id-input`, + }} + error={!!hardForkErrors?.previous_ga_id} + helperText={hardForkErrors?.previous_ga_id} + FormHelperTextProps={{ + sx: { + backgroundColor: 'transparent', + }, + 'data-testid': `previous-ga-id-error`, + }} + /> + + + + { + handleHardForkDataChange('major', e.target.value); + }} + required + inputProps={{ + 'data-testid': `major-input`, + }} + error={!!hardForkErrors?.major} + helperText={hardForkErrors?.major} + FormHelperTextProps={{ + sx: { + backgroundColor: 'transparent', + }, + 'data-testid': `major-error`, + }} + /> + + + + { + handleHardForkDataChange('minor', e.target.value); + }} + required + inputProps={{ + 'data-testid': `minor-input`, + }} + error={!!hardForkErrors?.minor} + helperText={hardForkErrors?.minor} + FormHelperTextProps={{ + sx: { + backgroundColor: 'transparent', + }, + 'data-testid': `minor-error`, + }} + /> + + + ); +}; + +export default HardForkManager; diff --git a/pdf-ui/src/components/CreationGoveranceAction/LinkManager.jsx b/pdf-ui/src/components/CreationGoveranceAction/LinkManager.jsx index df27944..e417d3d 100644 --- a/pdf-ui/src/components/CreationGoveranceAction/LinkManager.jsx +++ b/pdf-ui/src/components/CreationGoveranceAction/LinkManager.jsx @@ -25,26 +25,46 @@ const LinkManager = ({ ...proposalData, proposal_links: newLinks, }); - - // If the URL is empty, remove the error if (field === 'prop_link' && value === '') { return setLinksErrors((prev) => { const { [index]: removed, ...rest } = prev; return rest; }); } - - // Validate URL if (field === 'prop_link') { - const isValid = isValidURLFormat(value); + let urlError = ''; + if (value.length > 2048) { + urlError = 'URL must be 2048 characters or less'; + } else if (value && !isValidURLFormat(value)) { + urlError = 'Invalid URL format'; + } setLinksErrors((prev) => ({ ...prev, [index]: { ...prev[index], - url: isValid ? '' : 'Invalid URL format', + url: urlError, }, })); } + if (field === 'prop_link_text') { + let textError = ''; + if (value.length > 255) { + textError = 'Text must be 255 characters or less'; + } + setLinksErrors((prev) => { + if (value === '' || value < 255) { + const { [index]: removed, ...rest } = prev; + return rest; + } + return { + ...prev, + [index]: { + ...prev[index], + text: textError, + }, + }; + }); + } }; const handleAddLink = () => { @@ -125,7 +145,7 @@ const LinkManager = ({ inputProps={{ 'data-testid': `link-${index}-url-input`, //link length limited to 255 characters - maxLength: 255, + // maxLength: 255, }} error={!!linksErrors[index]?.url} helperText={linksErrors[index]?.url} @@ -161,6 +181,14 @@ const LinkManager = ({ inputProps={{ 'data-testid': `link-${index}-text-input`, }} + error={!!linksErrors[index]?.text} + helperText={linksErrors[index]?.text} + FormHelperTextProps={{ + sx: { + backgroundColor: 'transparent', + }, + 'data-testid': `link-text-${index}-url-input-error`, + }} /> diff --git a/pdf-ui/src/components/CreationGoveranceAction/Step1.jsx b/pdf-ui/src/components/CreationGoveranceAction/Step1.jsx index d5e420e..7dd7ddf 100644 --- a/pdf-ui/src/components/CreationGoveranceAction/Step1.jsx +++ b/pdf-ui/src/components/CreationGoveranceAction/Step1.jsx @@ -178,9 +178,7 @@ const Step1 = ({ setStep, setProposalData, onClose, setSelectedDraftId }) => { voted on. - { - walletAPI?.walletName.toLowerCase() == 'ledger' - || walletAPI?.walletName.toLowerCase() == 'trezor'? ( + { gutterBottom sx={{ color: "#9c2224" }} > - Our system has detected that you are using a hardware wallet which does not support the submission of governance actions. - As a result, you will not be able to submit actions to the blockchain using this wallet. + Please be aware that Ledger and Trezor hardware wallet do not support submission of governance actions, but you'll still be able to create the proposal. - ): null - } - + { const titleMaxLength = 80; const abstractMaxLength = 2500; @@ -114,7 +118,7 @@ const Step2 = ({ } setHelperText((prev) => ({ - ...prev, + ...prev, [errorField]: errorMessage === true ? '' : errorMessage, })); @@ -138,6 +142,18 @@ const Step2 = ({ }, [governanceActionTypes]); useEffect(() => { + if (linksErrors && typeof linksErrors === 'object') { + const hasLinkError = Object.values(linksErrors).some( + (err) => + (typeof err?.url === 'string' && err.url.trim() !== '') || + (typeof err?.text === 'string' && err.text.trim() !== '') + ); + if (hasLinkError) { + setIsDraftDisabled(true); + return; + } + } + setIsDraftDisabled(false); if ( proposalData?.gov_action_type_id && proposalData?.prop_name?.length !== 0 @@ -159,7 +175,7 @@ const Step2 = ({ setIsDraftDisabled(false); } else setIsDraftDisabled(true); } - }, [proposalData]); + }, [proposalData, linksErrors]); return ( @@ -442,6 +458,17 @@ const Step2 = ({ > ) : null } + { + /// 'Hard Fork' + selectedGovActionId === 6 ? ( + + ) : null + } { + return ( + + + {question} + + + + ); +}; const Step3 = ({ setStep, @@ -25,6 +41,7 @@ const Step3 = ({ const theme = useTheme(); const selectedGATypeId = proposalData?.gov_action_type_id; const pc = proposalData?.proposal_constitution_content; + return ( - {proposalData?.prop_name} - - Abstrtact - + {/* {proposalData?.prop_abstract || ''} - + */} - Motivation - + {/* {proposalData?.prop_motivation || ''} - + */} - Rationale - + {/* {proposalData?.prop_rationale || ''} - + */} {selectedGATypeId == 2 ? proposalData?.proposal_withdrawals?.map( @@ -283,6 +308,88 @@ const Step3 = ({ )} ) : null} + {selectedGATypeId == 6 ? ( + <> + + + Previous Gov Action Hash + + + { + proposalData?.proposal_hard_fork_content + ?.previous_ga_hash + } + + + + + Previous Gov Action ID + + + { + proposalData?.proposal_hard_fork_content + ?.previous_ga_id + } + + + + + + Major version + + + { + proposalData?.proposal_hard_fork_content + ?.major + } + + + + + Minor version + + + { + proposalData?.proposal_hard_fork_content + ?.minor + } + + + + ) : null} + {proposalData?.proposal_links?.length > 0 && ( Abstract +
+ +
- + /> */}
[...prev, ...proposals]); } - console.log(pgCount); setPageCount(pgCount); } catch (error) { console.error(error); } }; + // Memoize sortType and statusList dependencies to prevent infinite re-renders + const sortTypeString = useMemo(() => JSON.stringify(sortType), [sortType]); + const statusListString = useMemo( + () => JSON.stringify(statusList), + [statusList] + ); + useEffect(() => { if (!mounted) { setMounted(true); @@ -123,8 +129,8 @@ const ProposalsList = ({ }, [ mounted, debouncedSearchValue, - sortType, - isDraft ? null : statusList, + sortTypeString, + isDraft ? null : statusListString, showAllActivated, ]); diff --git a/pdf-ui/src/components/ReviewVersions/index.jsx b/pdf-ui/src/components/ReviewVersions/index.jsx index 7771b00..0e1c8d5 100644 --- a/pdf-ui/src/components/ReviewVersions/index.jsx +++ b/pdf-ui/src/components/ReviewVersions/index.jsx @@ -24,6 +24,7 @@ import { } from '@intersect.mbo/intersectmbo.org-icons-set'; import { formatIsoDate, formatIsoTime, openInNewTab } from '../../lib/utils'; import { useEffect, useState } from 'react'; +import MarkdownTypography from '../../lib/markdownRenderer'; import { getProposals } from '../../lib/api'; import ReactMarkdown from 'react-markdown'; @@ -409,7 +410,18 @@ const ReviewVersions = ({ open, onClose, id }) => { > Abstract - + {/* { ?.attributes ?.prop_abstract || ''} - + */} { > Motivation - + {/* { ?.attributes ?.prop_motivation || ''} - + */} { Rationale - + + {/* { ?.attributes ?.prop_rationale || ''} - + */} {selectedVersion?.attributes @@ -586,6 +621,15 @@ const ReviewVersions = ({ open, onClose, id }) => { variant='body2' component='span' data-testid={`link-${index}-text-content`} + style={{ + margin: 0, + textOverflow: + 'ellipsis', + overflow: + 'hidden', + maxWidth: + '400px', + }} > { link?.prop_link_text diff --git a/pdf-ui/src/components/SubmissionGovernanceAction/Steps/StoreDataStep.jsx b/pdf-ui/src/components/SubmissionGovernanceAction/Steps/StoreDataStep.jsx index 2ed26f3..90ca07b 100644 --- a/pdf-ui/src/components/SubmissionGovernanceAction/Steps/StoreDataStep.jsx +++ b/pdf-ui/src/components/SubmissionGovernanceAction/Steps/StoreDataStep.jsx @@ -104,7 +104,9 @@ const StoreDataStep = ({ setStep }) => { onChange={(e) => setChecked((prev) => !prev) } - data-testid='agree-checkbox' + inputProps={{ + 'data-testid': 'agree-checkbox', + }} /> } label={ diff --git a/pdf-ui/src/lib/api.js b/pdf-ui/src/lib/api.js index f671340..08da1df 100644 --- a/pdf-ui/src/lib/api.js +++ b/pdf-ui/src/lib/api.js @@ -588,3 +588,14 @@ export const getChallenge = async ({ query = '' }) => { throw error; } }; + +export const getHardForkData = async () => { + try { + const data = await axiosInstance.get( + '/api/proxy/govtool/proposal/enacted-details?type=HardForkInitiation' + ); + return data.data; + } catch (error) { + throw error; + } +}; diff --git a/pdf-ui/src/pages/BudgetDiscussion/SingleBudgetDiscussion/index.jsx b/pdf-ui/src/pages/BudgetDiscussion/SingleBudgetDiscussion/index.jsx index d10daeb..be5b56e 100644 --- a/pdf-ui/src/pages/BudgetDiscussion/SingleBudgetDiscussion/index.jsx +++ b/pdf-ui/src/pages/BudgetDiscussion/SingleBudgetDiscussion/index.jsx @@ -9,7 +9,7 @@ import { IconShare, IconSort, IconTrash, - IconInformationCircle, + IconInformationCircle, } from '@intersect.mbo/intersectmbo.org-icons-set'; import { Badge, @@ -233,8 +233,12 @@ const SingleBudgetDiscussion = ({ id }) => { if (!response) return; setProposal(response); - } catch (error) { - console.error(error); + }catch (error) { + if ( + error?.response?.data?.error?.message === + 'Not Found' ) { + return navigate('/budget_discussion'); + } } finally { setLoading(false); } @@ -381,34 +385,38 @@ const SingleBudgetDiscussion = ({ id }) => { - {proposal?.attributes?.submitted_for_vote !== null && ( - - - + - Submitted for vote - - {/* + Submitted for vote + + {/* { /> */} - - } - > - + + } + > + { md: 'left', }} > - - Editing and Voting options have been disabled for this proposal because it is included in the Intersect Budget info action + Editing and Voting options + have been disabled for this + proposal because it is + included in the Intersect + Budget info action - - )} - + + + )} + @@ -674,7 +686,9 @@ const SingleBudgetDiscussion = ({ id }) => { {user && user?.user?.id?.toString() === proposal?.attributes?.creator?.data?.id?.toString() && - proposal?.attributes?.submitted_for_vote == null && ( + proposal?.attributes + ?.submitted_for_vote == + null && ( { variant='body2' style={{ margin: 0, + textOverflow: + 'ellipsis', + overflow: + 'hidden', + maxWidth: + '800px', }} data-testid={`link-${index}-text-content`} > @@ -1851,22 +1871,24 @@ const SingleBudgetDiscussion = ({ id }) => { - {activePoll && - proposal?.attributes?.submitted_for_vote === null && ( - - - - )} + {activePoll && + proposal?.attributes?.submitted_for_vote === + null && ( + + + + )} {proposal?.attributes?.content?.attributes ?.prop_submitted ? null : ( diff --git a/pdf-ui/src/pages/ProposedGovernanceActions/SingleGovernanceAction/index.jsx b/pdf-ui/src/pages/ProposedGovernanceActions/SingleGovernanceAction/index.jsx index b1272ce..dabba75 100644 --- a/pdf-ui/src/pages/ProposedGovernanceActions/SingleGovernanceAction/index.jsx +++ b/pdf-ui/src/pages/ProposedGovernanceActions/SingleGovernanceAction/index.jsx @@ -60,10 +60,15 @@ import { createPoll, getPolls, } from '../../../lib/api'; -import { correctVoteAdaFormat, formatIsoDate, openInNewTab } from '../../../lib/utils'; +import { + correctVoteAdaFormat, + formatIsoDate, + openInNewTab, +} from '../../../lib/utils'; import ProposalOwnModal from '../../../components/ProposalOwnModal'; import ReactMarkdown from 'react-markdown'; import { loginUserToApp } from '../../../lib/helpers'; +import MarkdownTypography from '../../../lib/markdownRenderer'; const SingleGovernanceAction = ({ id }) => { const MAX_COMMENT_LENGTH = 15000; @@ -279,12 +284,16 @@ const SingleGovernanceAction = ({ id }) => { const fetchCurrentWalletBalance = async () => { try { const bal = await walletAPI.getBalance(); - const balance = Number('0x' + bal.match(/^1b([0-9a-fA-F]{16})$/)[1]) || 0; - setCurrentWalletBalance(balance/1000000); + const balance = + Number('0x' + bal.match(/^1b([0-9a-fA-F]{16})$/)[1]) || 0; + const normalized = balance / 1000000; + setCurrentWalletBalance(normalized); + return normalized; } catch (error) { console.error(error); + return 0; // fallback } - } + }; const handleCreateComment = async () => { setLoading(true); try { @@ -621,64 +630,48 @@ const SingleGovernanceAction = ({ id }) => { ) : user && user?.user?.id?.toString() === - proposal?.attributes?.user_id?.toString() - && walletAPI?.walletName.toLowerCase() != 'ledger' - && walletAPI?.walletName.toLowerCase() != 'trezor'? ( + proposal?.attributes?.user_id?.toString() ? ( - ) : - walletAPI?.walletName.toLowerCase() == 'ledger' - || walletAPI?.walletName.toLowerCase() == 'trezor'? - ( - - {`You hardware wallet does not support submitting governance actions`} - - ) : - ( + ) : ( - ); }; diff --git a/pdf-ui/src/pages/ProposedGovernanceActions/index.jsx b/pdf-ui/src/pages/ProposedGovernanceActions/index.jsx index 8633c2b..53ea9fd 100644 --- a/pdf-ui/src/pages/ProposedGovernanceActions/index.jsx +++ b/pdf-ui/src/pages/ProposedGovernanceActions/index.jsx @@ -32,6 +32,51 @@ import { useAppContext } from '../../context/context'; import { loginUserToApp } from '../../lib/helpers'; import { useLocation } from 'react-router-dom'; +let sortOptions = [ + { fieldId: 'createdAt', type: 'DESC', title: 'Newest' }, + { fieldId: 'createdAt', type: 'ASC', title: 'Oldest' }, + { + fieldId: 'proposal][prop_likes', + type: 'DESC', + title: 'Most likes', + }, + { + fieldId: 'proposal][prop_likes', + type: 'ASC', + title: 'Least likes', + }, + { + fieldId: 'proposal][prop_dislikes', + type: 'DESC', + title: 'Most dislikes', + }, + { + fieldId: 'proposal][prop_dislikes', + type: 'ASC', + title: 'Least dislikes', + }, + { + fieldId: 'proposal][prop_comments_number', + type: 'DESC', + title: 'Most comments', + }, + { + fieldId: 'proposal][prop_comments_number', + type: 'ASC', + title: 'Least comments', + }, + { + fieldId: 'prop_name', + type: 'ASC', + title: 'Name A-Z', + }, + { + fieldId: 'prop_name', + type: 'DESC', + title: 'Name Z-A', + }, +]; + const ProposedGovernanceActions = () => { const location = useLocation(); const theme = useTheme(); @@ -46,7 +91,7 @@ const ProposedGovernanceActions = () => { addChangesSavedAlert, } = useAppContext(); const [proposalSearchText, setProposalSearchText] = useState(''); - const [sortType, setSortType] = useState('desc'); + const [sortType, setSortType] = useState(sortOptions[0]); const [governanceActionTypeList, setGovernanceActionTypeList] = useState( [] ); @@ -74,6 +119,16 @@ const ProposedGovernanceActions = () => { setFiltersAnchorEl(null); }; + const [sortAnchorEl, setSortAnchorEl] = useState(null); + const openSort = Boolean(sortAnchorEl); + + const handleSortClick = (event) => { + setSortAnchorEl(event.currentTarget); + }; + const handleSortClose = () => { + setSortAnchorEl(null); + }; + const fetchGovernanceActionTypes = async () => { try { let response = await getGovernanceActionTypes(); @@ -484,7 +539,81 @@ const ProposedGovernanceActions = () => { - + + + {sortOptions.map((sort, index) => ( + { + setSortType(sort); + handleSortClose(); + }} + sx={{ + width: '100%', + }} + > + {sort.title} + + ))} + + + + {/* + */} From 18a8af5fef35c054a2b98c97719dcf6ed011ef88 Mon Sep 17 00:00:00 2001 From: Milos Mihajlovic Date: Mon, 2 Jun 2025 14:11:49 +0200 Subject: [PATCH 05/25] chore: Update changelog for version 0.7.0-beta-33, remove debug logs, and adjust component styles --- pdf-ui/CHANGELOG.md | 7 +++++++ pdf-ui/package.json | 2 +- .../BudgetDiscussionParts/StepperActionButtons.jsx | 1 - pdf-ui/src/components/CreationGoveranceAction/Step2.jsx | 1 - pdf-ui/src/components/ProposalSubmissionDialog/index.jsx | 3 +++ pdf-ui/src/lib/markdownRenderer.js | 3 +-- 6 files changed, 12 insertions(+), 5 deletions(-) diff --git a/pdf-ui/CHANGELOG.md b/pdf-ui/CHANGELOG.md index 6c51dea..d31e7b1 100644 --- a/pdf-ui/CHANGELOG.md +++ b/pdf-ui/CHANGELOG.md @@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 As a minor extension, we also keep a semantic version for the `UNRELEASED` changes. + +## [v0.7.0-beta-33](https://www.npmjs.com/package/@intersect.mbo/pdf-ui/v/0.7.0-beta-33) 2025-06-02 +- Remove CSS Rounded Edges on Creating Governance Action Pages on background +- Fix data-testIds + + + ## [v0.7.0-beta-32](https://www.npmjs.com/package/@intersect.mbo/pdf-ui/v/0.7.0-beta-32) 2025-05-29 - fix: Update data-testid attributes for improved accessibility in form… - Hardware Wallet warning #2575 wording updated diff --git a/pdf-ui/package.json b/pdf-ui/package.json index 25691f1..5ae0f64 100644 --- a/pdf-ui/package.json +++ b/pdf-ui/package.json @@ -1,6 +1,6 @@ { "name": "@intersect.mbo/pdf-ui", - "version": "0.7.0-beta-32", + "version": "0.7.0-beta-33", "description": "Proposal discussion ui", "main": "./src/index.js", "exports": { diff --git a/pdf-ui/src/components/BudgetDiscussionParts/StepperActionButtons.jsx b/pdf-ui/src/components/BudgetDiscussionParts/StepperActionButtons.jsx index 6e661d2..dce5f6f 100644 --- a/pdf-ui/src/components/BudgetDiscussionParts/StepperActionButtons.jsx +++ b/pdf-ui/src/components/BudgetDiscussionParts/StepperActionButtons.jsx @@ -21,7 +21,6 @@ const StepperActionButtons = ({ backText = 'Back', errors, }) => { - console.log('🚀 ~ errors:', errors); // Calculate backStep if not provided const calculatedBackStep = backStep !== undefined ? backStep : nextStep - 2; const [continueDisabled, setContinueDisabled] = useState(false); diff --git a/pdf-ui/src/components/CreationGoveranceAction/Step2.jsx b/pdf-ui/src/components/CreationGoveranceAction/Step2.jsx index 7196dff..48557c6 100644 --- a/pdf-ui/src/components/CreationGoveranceAction/Step2.jsx +++ b/pdf-ui/src/components/CreationGoveranceAction/Step2.jsx @@ -145,7 +145,6 @@ const Step2 = ({ (typeof err?.url === 'string' && err.url.trim() !== '') || (typeof err?.text === 'string' && err.text.trim() !== '') ); - console.log('🚀 ~ useEffect ~ hasLinkError:', hasLinkError); if (hasLinkError) { setIsDraftDisabled(true); return; diff --git a/pdf-ui/src/components/ProposalSubmissionDialog/index.jsx b/pdf-ui/src/components/ProposalSubmissionDialog/index.jsx index 0fc5a0c..9101506 100644 --- a/pdf-ui/src/components/ProposalSubmissionDialog/index.jsx +++ b/pdf-ui/src/components/ProposalSubmissionDialog/index.jsx @@ -24,6 +24,9 @@ const ProposalSubmissionDialog = ({ open={openEditDialog} onClose={handleCloseSubmissionDialog} data-testid='proposal-submission-dialog' + PaperProps={{ + sx: { borderRadius: 0 }, + }} > { // Change special symbols text = symbolReplacements(text); - return text; }; @@ -389,7 +388,7 @@ const MarkdownTypography = ({ content, testId, onLinkClick }) => { } }); }); - }, []); + }, [processedContent]); return (
From 2dcd5d17dad628a705d05742899bab0c54e3b059 Mon Sep 17 00:00:00 2001 From: Milos Mihajlovic Date: Tue, 3 Jun 2025 09:48:11 +0200 Subject: [PATCH 06/25] chore: Update changelog for version 0.7.0-beta-34, fix data-testIds, and adjust link validation in LinkManager --- pdf-ui/CHANGELOG.md | 5 +++++ pdf-ui/package.json | 2 +- .../CreationGoveranceAction/LinkManager.jsx | 19 ++++++++++++++++--- pdf-ui/src/components/ProposalCard/index.jsx | 2 +- 4 files changed, 23 insertions(+), 5 deletions(-) diff --git a/pdf-ui/CHANGELOG.md b/pdf-ui/CHANGELOG.md index d31e7b1..ecc9c2b 100644 --- a/pdf-ui/CHANGELOG.md +++ b/pdf-ui/CHANGELOG.md @@ -8,6 +8,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 As a minor extension, we also keep a semantic version for the `UNRELEASED` changes. +## [v0.7.0-beta-34](https://www.npmjs.com/package/@intersect.mbo/pdf-ui/v/0.7.0-beta-34) 2025-06-03 +- Fix data-testIds +- Adjust link validation in proposal + + ## [v0.7.0-beta-33](https://www.npmjs.com/package/@intersect.mbo/pdf-ui/v/0.7.0-beta-33) 2025-06-02 - Remove CSS Rounded Edges on Creating Governance Action Pages on background - Fix data-testIds diff --git a/pdf-ui/package.json b/pdf-ui/package.json index 5ae0f64..1d5158c 100644 --- a/pdf-ui/package.json +++ b/pdf-ui/package.json @@ -1,6 +1,6 @@ { "name": "@intersect.mbo/pdf-ui", - "version": "0.7.0-beta-33", + "version": "0.7.0-beta-34", "description": "Proposal discussion ui", "main": "./src/index.js", "exports": { diff --git a/pdf-ui/src/components/CreationGoveranceAction/LinkManager.jsx b/pdf-ui/src/components/CreationGoveranceAction/LinkManager.jsx index e417d3d..1caf8a8 100644 --- a/pdf-ui/src/components/CreationGoveranceAction/LinkManager.jsx +++ b/pdf-ui/src/components/CreationGoveranceAction/LinkManager.jsx @@ -25,12 +25,14 @@ const LinkManager = ({ ...proposalData, proposal_links: newLinks, }); + if (field === 'prop_link' && value === '') { return setLinksErrors((prev) => { const { [index]: removed, ...rest } = prev; return rest; }); } + if (field === 'prop_link') { let urlError = ''; if (value.length > 2048) { @@ -46,15 +48,26 @@ const LinkManager = ({ }, })); } + if (field === 'prop_link_text') { let textError = ''; if (value.length > 255) { textError = 'Text must be 255 characters or less'; } setLinksErrors((prev) => { - if (value === '' || value < 255) { - const { [index]: removed, ...rest } = prev; - return rest; + if (value === '') { + const currentErrors = prev[index] || {}; + const { text, ...otherErrors } = currentErrors; + + if (Object.keys(otherErrors).length === 0) { + const { [index]: removed, ...rest } = prev; + return rest; + } else { + return { + ...prev, + [index]: otherErrors, + }; + } } return { ...prev, diff --git a/pdf-ui/src/components/ProposalCard/index.jsx b/pdf-ui/src/components/ProposalCard/index.jsx index dbfc217..f1902e2 100644 --- a/pdf-ui/src/components/ProposalCard/index.jsx +++ b/pdf-ui/src/components/ProposalCard/index.jsx @@ -334,7 +334,7 @@ const ProposalCard = ({ proposal?.attributes?.content ?.attributes?.prop_abstract || '' } - testId={`abstract-content`} + testId={`proposal-${proposal?.id}-abstract-content`} />
From 778a5a4e19bcd1f691d71ee1593463e1597b27df Mon Sep 17 00:00:00 2001 From: Milos Mihajlovic Date: Tue, 3 Jun 2025 13:22:37 +0200 Subject: [PATCH 07/25] fix: Refactor abstract content rendering in SingleGovernanceAction component --- .../SingleGovernanceAction/index.jsx | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/pdf-ui/src/pages/ProposedGovernanceActions/SingleGovernanceAction/index.jsx b/pdf-ui/src/pages/ProposedGovernanceActions/SingleGovernanceAction/index.jsx index dabba75..ec65840 100644 --- a/pdf-ui/src/pages/ProposedGovernanceActions/SingleGovernanceAction/index.jsx +++ b/pdf-ui/src/pages/ProposedGovernanceActions/SingleGovernanceAction/index.jsx @@ -1137,21 +1137,19 @@ const SingleGovernanceAction = ({ id }) => { > Abstract -
- - {/* + + {/* {showFullText || !maxLength ? AbstractMarkdownText : truncatedText} */} -
{!showFullText && totalCharLength > maxLength && ( - - + + Edit Proposal + + + + + - - - + + - - theme.palette.text.orange - } - gutterBottom - > - REQUIRED - - - - Proposal Details - - - - - - + REQUIRED + - - - - - {`Last Edit: ${ - proposal?.attributes - ?.updatedAt - ? formatIsoDate( - proposal - ?.attributes - ?.updatedAt - ) - : '--' - }`} + Proposal Details - - - - {governanceActionTypes?.map( - (option) => ( - + + +
- - handleTextAreaChange( - e, - 'prop_name', - 'name' - ) - } - required - inputProps={{ - 'data-testid': 'title-input', - }} - error={errors?.name} - helperText={helperText?.name} - FormHelperTextProps={{ - 'data-testid': - 'title-input-error', - }} - /> + + + + + {`Last Edit: ${ + proposal?.attributes + ?.updatedAt + ? formatIsoDate( + proposal + ?.attributes + ?.updatedAt + ) + : '--' + }`} + + + - - handleTextAreaChange( - e, - 'prop_abstract', - 'abstract' - ) - } - required - helperText={ - helperText?.abstract ? ( - helperText?.abstract - ) : ( - <> - - * A short summary of - your proposal - - + {governanceActionTypes?.map( + (option) => ( + - {`${ - draft - ?.prop_abstract - ?.length || - 0 - }/${abstractMaxLength}`} - - - ) - } - InputProps={{ - inputProps: { - maxLength: - abstractMaxLength, - 'data-testid': - 'abstract-input', - }, - }} - error={errors?.abstract} - FormHelperTextProps={{ - 'data-testid': errors?.abstract - ? 'abstract-helper-error' - : 'abstract-helper', - }} - /> + {option?.label} + + ) + )} + - - handleTextAreaChange( - e, - 'prop_motivation', - 'motivation' - ) - } - required - helperText={ - helperText?.motivation ? ( - helperText?.motivation - ) : ( - <> - - * What problem is - your proposal - solving? - - - {`${ - draft - ?.prop_motivation - ?.length || - 0 - }/${motivationRationaleMaxLength}`} - - - ) - } - InputProps={{ - inputProps: { - maxLength: - motivationRationaleMaxLength, + + handleTextAreaChange( + e, + 'prop_name', + 'name' + ) + } + required + inputProps={{ 'data-testid': - 'motivation-input', - }, - }} - error={errors?.motivation} - FormHelperTextProps={{ - 'data-testid': - errors?.motivation - ? 'motivation-helper-error' - : 'motivation-helper', - }} - /> + 'title-input', + }} + error={errors?.name} + helperText={helperText?.name} + FormHelperTextProps={{ + 'data-testid': + 'title-input-error', + }} + /> - - handleTextAreaChange( - e, - 'prop_rationale', - 'rationale' - ) - } - required - helperText={ - helperText?.rationale ? ( - helperText?.rationale - ) : ( - <> - - * How does the - on-chain change - solve the problem? - - - {`${ - draft - ?.prop_rationale - ?.length || - 0 - }/${motivationRationaleMaxLength}`} - - - ) - } - InputProps={{ - inputProps: { - maxLength: - motivationRationaleMaxLength, + + handleTextAreaChange( + e, + 'prop_abstract', + 'abstract' + ) + } + required + helperText={ + helperText?.abstract ? ( + helperText?.abstract + ) : ( + <> + + * A short + summary of your + proposal + + + {`${ + draft + ?.prop_abstract + ?.length || + 0 + }/${abstractMaxLength}`} + + + ) + } + InputProps={{ + inputProps: { + maxLength: + abstractMaxLength, + 'data-testid': + 'abstract-input', + }, + }} + error={errors?.abstract} + FormHelperTextProps={{ 'data-testid': - 'rationale-input', - }, - }} - error={errors?.rationale} - FormHelperTextProps={{ - 'data-testid': errors?.rationale - ? 'rationale-helper-error' - : 'rationale-helper', - }} - /> + errors?.abstract + ? 'abstract-helper-error' + : 'abstract-helper', + }} + /> - {/// 'Treasury' - selectedGovActionId === 2 - ? ( - <> - + handleTextAreaChange( + e, + 'prop_motivation', + 'motivation' + ) + } + required + helperText={ + helperText?.motivation ? ( + helperText?.motivation + ) : ( + <> + + * What problem + is your proposal + solving? + + + {`${ + draft + ?.prop_motivation + ?.length || + 0 + }/${motivationRationaleMaxLength}`} + + + ) + } + InputProps={{ + inputProps: { + maxLength: + motivationRationaleMaxLength, + 'data-testid': + 'motivation-input', + }, + }} + error={errors?.motivation} + FormHelperTextProps={{ + 'data-testid': + errors?.motivation + ? 'motivation-helper-error' + : 'motivation-helper', + }} /> - - ) : null} - { /// 'Constitution' - selectedGovActionId === 3 ? ( - - ) : null - } - - - - - theme.palette.text.orange - } - gutterBottom - > - OPTIONAL - - - References and Supporting - Information - + + handleTextAreaChange( + e, + 'prop_rationale', + 'rationale' + ) + } + required + helperText={ + helperText?.rationale ? ( + helperText?.rationale + ) : ( + <> + + * How does the + on-chain change + solve the + problem? + + + {`${ + draft + ?.prop_rationale + ?.length || + 0 + }/${motivationRationaleMaxLength}`} + + + ) + } + InputProps={{ + inputProps: { + maxLength: + motivationRationaleMaxLength, + 'data-testid': + 'rationale-input', + }, + }} + error={errors?.rationale} + FormHelperTextProps={{ + 'data-testid': + errors?.rationale + ? 'rationale-helper-error' + : 'rationale-helper', + }} + /> - - theme.palette.text.grey + { + /// 'Treasury' + selectedGovActionId === 2 ? ( + <> + + + ) : null } - gutterBottom - > - Links to additional content or - social media contacts (up to 7 - entries) - - - - - - - + + theme.palette.text + .orange + } + gutterBottom + > + OPTIONAL + + + + References and Supporting + Information + + + + theme.palette.text.grey + } + gutterBottom + > + Links to additional content + or social media contacts (up + to 7 entries) + + + - + - + + - Publish with new edits - + + - -
-
+ + + - - - - - theme.palette.border.lightGray - } - > + + + theme.palette.border.lightGray + } > - - Proposal saved to drafts - - + + Proposal saved to drafts + + { + handleCloseSaveDraftModal(); + handleCloseEditDialog(); + + setMounted(false); + }} + > + + + + + + - - - - - - - - - theme.palette.border.lightGray - } - > + + + Please confirm applied changes + + { + handleClosePublishModal(); + }} + > + + + + - - Please confirm applied changes - - { + await handleUpdatePorposal(false); + handleCloseSaveDraftModal(); + handleCloseEditDialog(); + setMounted(false); + }} + data-testid='confirm-button' + > + Confirm + + - - - - - - - { - handleCloseEditDialog(); - navigate('/proposal_discussion'); - if (setShouldRefresh) { - setShouldRefresh(true); - } - }} - > - - - theme.palette.border.lightGray + + { + handleCloseEditDialog(); + navigate('/proposal_discussion'); + if (setShouldRefresh) { + setShouldRefresh(true); } - > + }} + > + + theme.palette.border.lightGray + } > - - Proposal Deleted + + + Proposal Deleted + + { + setOpenDeleteConfirmationModal( + false + ); + handleCloseEditDialog(); + navigate('/proposal_discussion'); + if (setShouldRefresh) { + setShouldRefresh(true); + } + }} + > + + + + theme.palette.text.grey} + > + The proposal has been deleted successfully. - + + - theme.palette.text.grey} - > - The proposal has been deleted successfully. - - - - + + setShowProposalDeleteModal(false)} + handleDeleteProposal={handleDeleteProposal} + /> + + - - setShowProposalDeleteModal(false)} - handleDeleteProposal={handleDeleteProposal} - /> - - - - + ); }; diff --git a/pdf-ui/src/pages/ProposedGovernanceActions/SingleGovernanceAction/index.jsx b/pdf-ui/src/pages/ProposedGovernanceActions/SingleGovernanceAction/index.jsx index dabba75..bd1771a 100644 --- a/pdf-ui/src/pages/ProposedGovernanceActions/SingleGovernanceAction/index.jsx +++ b/pdf-ui/src/pages/ProposedGovernanceActions/SingleGovernanceAction/index.jsx @@ -448,6 +448,7 @@ const SingleGovernanceAction = ({ id }) => { } }, [commentsSortType]); + console.log('🚀 ~ SingleGovernanceAction ~ proposal:', proposal); return !proposal ? null : proposal?.attributes?.content?.attributes ?.is_draft ? null : ( <> @@ -1295,7 +1296,10 @@ const SingleGovernanceAction = ({ id }) => { : null} {showFullText && proposal?.attributes?.content?.attributes - ?.gov_action_type_id == 3 ? ( + ?.gov_action_type_id == 3 && + proposal?.attributes?.content?.attributes + ?.proposal_constitution_content + ?.data ? (
{ ?.content ?.attributes ?.proposal_constitution_content - .data.attributes - .prop_constitution_url || + ?.data?.attributes + ?.prop_constitution_url || ''}
@@ -1323,8 +1327,8 @@ const SingleGovernanceAction = ({ id }) => { {proposal?.attributes?.content ?.attributes ?.proposal_constitution_content - .data.attributes - .prop_have_guardrails_script === + ?.data?.attributes + ?.prop_have_guardrails_script === true ? (
@@ -1350,9 +1354,9 @@ const SingleGovernanceAction = ({ id }) => { ?.content ?.attributes ?.proposal_constitution_content - .data - .attributes - .prop_guardrails_script_url || + ?.data + ?.attributes + ?.prop_guardrails_script_url || ''}
@@ -1380,9 +1384,9 @@ const SingleGovernanceAction = ({ id }) => { ?.content ?.attributes ?.proposal_constitution_content - .data - .attributes - .prop_guardrails_script_hash || + ?.data + ?.attributes + ?.prop_guardrails_script_hash || ''} @@ -1391,6 +1395,106 @@ const SingleGovernanceAction = ({ id }) => { ) : null} ) : null} + {showFullText && + proposal?.attributes?.content?.attributes + ?.gov_action_type_id == 6 ? ( + <> + + + theme?.palette?.text + ?.grey, + }} + > + Previous Gov Action Hash + + + {proposal?.attributes + ?.content?.attributes + ?.proposal_hard_fork_content + ?.data?.attributes + ?.previous_ga_hash || + ''} + + + + + theme?.palette?.text + ?.grey, + }} + > + Previous Gov Action ID + + + {proposal?.attributes + ?.content?.attributes + ?.proposal_hard_fork_content + ?.data?.attributes + ?.previous_ga_id || ''} + + + + + + theme?.palette?.text + ?.grey, + }} + > + Major version + + + {proposal?.attributes + ?.content?.attributes + ?.proposal_hard_fork_content + ?.data?.attributes + ?.major || ''} + + + + + theme?.palette?.text + ?.grey, + }} + > + Minor version + + + {proposal?.attributes + ?.content?.attributes + ?.proposal_hard_fork_content + ?.data?.attributes + ?.minor || ''} + + + + ) : null} {showFullText && totalCharLength > maxLength && ( + + + + + {showValidationMessage.map((item, index) => ( + + + {item.props.children} + + ))} + + + + + + ); + } +}; + +export default UserValidation; diff --git a/pdf-ui/src/context/context.jsx b/pdf-ui/src/context/context.jsx index 8ae3894..3d97751 100644 --- a/pdf-ui/src/context/context.jsx +++ b/pdf-ui/src/context/context.jsx @@ -12,49 +12,59 @@ export function AppContextProvider({ children }) { open: false, callBackFn: () => {}, }); -const [fetchDRepVotingPowerList, setFetchDRepVotingPowerList] = useState(null) -const [addSuccessAlert, setAddSuccessAlert] = useState(null); -const [addErrorAlert, setAddErrorAlert] = useState(null); -const [addWarningAlert, setAddWarningAlert] = useState(null); -const [addChangesSavedAlert, setAddChangesSavedAlert] = useState(null); + const [fetchDRepVotingPowerList, setFetchDRepVotingPowerList] = + useState(null); + const [addSuccessAlert, setAddSuccessAlert] = useState(null); + const [addErrorAlert, setAddErrorAlert] = useState(null); + const [addWarningAlert, setAddWarningAlert] = useState(null); + const [addChangesSavedAlert, setAddChangesSavedAlert] = useState(null); + const [showIdentificationPage, setShowIdentificationPage] = useState(false); + const [identificationType, setIdentificationType] = useState('wallet'); + const [govtoolProps, setGovtoolProps] = useState(); -const clearStates = () => { - setWalletAPI(null); - setUser(null); - setValidateMetadata(null); -}; + const clearStates = () => { + setWalletAPI(null); + setUser(null); + setValidateMetadata(null); + }; -return ( - - {children} - -); + return ( + + {children} + + ); } export function useAppContext() { diff --git a/pdf-ui/src/pages/BudgetDiscussion/SingleBudgetDiscussion/index.jsx b/pdf-ui/src/pages/BudgetDiscussion/SingleBudgetDiscussion/index.jsx index be5b56e..d242bb8 100644 --- a/pdf-ui/src/pages/BudgetDiscussion/SingleBudgetDiscussion/index.jsx +++ b/pdf-ui/src/pages/BudgetDiscussion/SingleBudgetDiscussion/index.jsx @@ -20,6 +20,7 @@ import { CardHeader, Grid, IconButton, + List, Menu, MenuItem, Stack, @@ -29,7 +30,7 @@ import { alpha, } from '@mui/material'; import { useEffect, useState, useRef } from 'react'; -import { useNavigate, useLocation } from 'react-router-dom'; +import { useNavigate, useLocation, Link } from 'react-router-dom'; import { CommentCard, BudgetDiscussionPoll, @@ -54,6 +55,7 @@ import { import ProposalOwnModal from '../../../components/ProposalOwnModal'; import BudgetDiscussionReviewVersions from '../../../components/BudgetDiscussionReviewVersions'; import { useScrollToHashSection } from '../../../lib/hooks'; +import UserValidation from '../../../components/UserValidation/UserValidation'; const SECTIONS = [ 'problem-statement', @@ -233,10 +235,8 @@ const SingleBudgetDiscussion = ({ id }) => { if (!response) return; setProposal(response); - }catch (error) { - if ( - error?.response?.data?.error?.message === - 'Not Found' ) { + } catch (error) { + if (error?.response?.data?.error?.message === 'Not Found') { return navigate('/budget_discussion'); } } finally { @@ -1889,101 +1889,113 @@ const SingleBudgetDiscussion = ({ id }) => { /> )} + {/* ovde */} + {user?.user?.govtool_username ? ( + proposal?.attributes?.content?.attributes + ?.prop_submitted ? null : ( + + + + + Submit a comment + - {proposal?.attributes?.content?.attributes - ?.prop_submitted ? null : ( - - - - - Submit a comment - - - - newCommentText?.length === - MAX_COMMENT_LENGTH && - theme?.palette - ?.error?.main, - }} - > - {`${ - newCommentText?.length || - 0 - }/${MAX_COMMENT_LENGTH}`} - - } - value={newCommentText || ''} - onChange={(e) => handleChange(e)} - inputProps={{ - maxLength: MAX_COMMENT_LENGTH, - onKeyDown: handleKeyDown, - onBlur: handleBlur, - spellCheck: 'false', - autoCorrect: 'off', - autoCapitalize: 'none', - autoComplete: 'off', - 'data-testid': 'comment-input', - }} - /> - - - - - - - + + + + + + ) + ) : ( + )} {proposal?.attributes?.prop_comments_number === 0 ? ( { width={'100%'} height={'70vh'} display={'flex'} - justifyContent={'centet'} + justifyContent={'center'} alignItems={'center'} > From 63668880a9ca1487c67d2b28edc5a10b10dc3f69 Mon Sep 17 00:00:00 2001 From: Milos Mihajlovic Date: Thu, 12 Jun 2025 14:28:22 +0200 Subject: [PATCH 16/25] feat: enhance user validation and comment functionality across components --- pdf-ui/src/components/CommentCard/index.jsx | 192 ++++++++------- .../UserValidation/UserValidation.jsx | 181 +++++++------- pdf-ui/src/lib/helpers.js | 6 +- .../SingleBudgetDiscussion/index.jsx | 40 ++- pdf-ui/src/pages/BudgetDiscussion/index.jsx | 46 +++- .../SingleGovernanceAction/index.jsx | 229 +++++++++++------- .../pages/ProposedGovernanceActions/index.jsx | 49 +++- 7 files changed, 463 insertions(+), 280 deletions(-) diff --git a/pdf-ui/src/components/CommentCard/index.jsx b/pdf-ui/src/components/CommentCard/index.jsx index 2a728a1..071a267 100644 --- a/pdf-ui/src/components/CommentCard/index.jsx +++ b/pdf-ui/src/components/CommentCard/index.jsx @@ -31,12 +31,15 @@ import Subcomponent from './Subcomponent'; import { isCommentRestricted } from '../../lib/helpers'; import UsernameSection from './UsernameSection'; import MarkdownTypography from '../../lib/markdownRenderer'; +import UserValidation from '../UserValidation/UserValidation'; const CommentCard = ({ comment, proposal, fetchComments, setRefetchProposal, + checkShowComments, + drepCheck, }) => { const { setLoading, @@ -125,7 +128,9 @@ const CommentCard = ({ loadSubComments(1); setCommentHasReplays(true); setShowReply(false); - setRefetchProposal(true); + if (!newComment?.data?.attributes?.comment_parent_id) { + setRefetchProposal(true); + } addSuccessAlert('Commented successfully'); } catch (error) { addErrorAlert('Failed to comment'); @@ -525,97 +530,108 @@ const CommentCard = ({ )} - {showReply && ( - - handleChange(e)} - onBlur={handleBlur} - inputProps={{ - maxLength: subcommentMaxLength, - spellCheck: 'false', - autoCorrect: 'off', - autoCapitalize: 'none', - autoComplete: 'off', - }} - helperText={ - - subcommentText?.length === - subcommentMaxLength && - theme?.palette?.error?.main, - }} - > - {`${ - subcommentText?.length || 0 - }/${subcommentMaxLength}`} - - } - InputProps={{ - inputProps: { + {showReply ? ( + checkShowComments() ? ( + + handleChange(e)} + onBlur={handleBlur} + inputProps={{ maxLength: subcommentMaxLength, - 'data-testid': 'reply-input', - }, - }} - /> - - - + + - - )} + ) : ( + + ) + ) : null} {showSubcomments && subcommnetsList?.map((subcomment, index) => ( diff --git a/pdf-ui/src/components/UserValidation/UserValidation.jsx b/pdf-ui/src/components/UserValidation/UserValidation.jsx index 8f5ce79..fe86f02 100644 --- a/pdf-ui/src/components/UserValidation/UserValidation.jsx +++ b/pdf-ui/src/components/UserValidation/UserValidation.jsx @@ -21,7 +21,7 @@ import { } from '../../lib/utils'; import { getRefreshToken } from '../../lib/api'; -const UserValidation = ({ type = 'budget' }) => { +const UserValidation = ({ type = 'budget', drepCheck = false }) => { const { setWalletAPI, loading, @@ -61,7 +61,7 @@ const UserValidation = ({ type = 'budget' }) => { addErrorAlert: GovToolAddErrorAlert, addWarningAlert: GovToolAddWarningAlert, addChangesSavedAlert: GovToolAddChangesSavedAlert, - } = govtoolProps; + } = govtoolProps || {}; const handleLogin = async (trigerSignData, useDRepKey = false) => { if (GovToolAssemblyWalletAPI?.address) { @@ -200,14 +200,8 @@ const UserValidation = ({ type = 'budget' }) => { const showValidationMessage = useMemo(() => { const messages = []; - const showAll = !user; - if (!walletAPI) { - messages.push( - - To connect a Cardano wallet - - ); + messages.push(To connect a Cardano wallet); } if (!user) { @@ -219,12 +213,9 @@ const UserValidation = ({ type = 'budget' }) => { if (!user?.user?.govtool_username) { messages.push(A GovTool Display Name); } - - if (showAll) { + if (drepCheck) { messages.push( - - Verify your status as a DRep if you are one. - + Verify your status as a DRep. ); } @@ -244,6 +235,9 @@ const UserValidation = ({ type = 'budget' }) => { open: true, callBackFn: () => {}, }); + } else if (drepCheck) { + console.log('DRep check'); + handleLogin(true, true); } }; @@ -254,23 +248,39 @@ const UserValidation = ({ type = 'budget' }) => { return 'Verify'; } else if (!user?.user?.govtool_username) { return 'Create Display Name'; - } else { + } else if (drepCheck) { + return 'Verify'; } }; - if (type === 'budget') { - return ( - - - - - + const checkTitleText = (type) => { + switch (type) { + case 'budget': + return 'To submit a comment, you will need:'; + case 'comment': + return 'To submit a reply, you will need:'; + case 'budget-proposal': + return 'To submit a budget proposal, you will need:'; + case 'proposal': + return 'To submit a proposal, you will need:'; + default: + return 'To submit a comment, you will need:'; + } + }; + + return ( + + + + + + {type === 'budget' && ( { > Submit a comment - - - To submit a comment, you will need: - + )} + + + {checkTitleText(type)} + - - - Learn more - - - - - - + + + Learn more + + - - {showValidationMessage.map((item, index) => ( - - - {item.props.children} - - ))} - + - - - - ); - } + + + + {showValidationMessage.map((item, index) => ( + + + {item.props.children} + + ))} + + + + + + ); }; export default UserValidation; diff --git a/pdf-ui/src/lib/helpers.js b/pdf-ui/src/lib/helpers.js index 0d55821..c708aa4 100644 --- a/pdf-ui/src/lib/helpers.js +++ b/pdf-ui/src/lib/helpers.js @@ -187,8 +187,10 @@ export const loginUserToApp = async ({ errorMessage = error?.response?.data?.error?.message; } addErrorAlert(errorMessage); - clearStates(); - clearSession(); + if (error?.code !== 3) { + clearStates(); + clearSession(); + } } }; export const cleanObject = (obj) => { diff --git a/pdf-ui/src/pages/BudgetDiscussion/SingleBudgetDiscussion/index.jsx b/pdf-ui/src/pages/BudgetDiscussion/SingleBudgetDiscussion/index.jsx index d242bb8..7ae83ef 100644 --- a/pdf-ui/src/pages/BudgetDiscussion/SingleBudgetDiscussion/index.jsx +++ b/pdf-ui/src/pages/BudgetDiscussion/SingleBudgetDiscussion/index.jsx @@ -49,6 +49,7 @@ import { } from '../../../lib/api'; import { correctVoteAdaFormat, + decodeJWT, formatIsoDate, openInNewTab, } from '../../../lib/utils'; @@ -244,6 +245,35 @@ const SingleBudgetDiscussion = ({ id }) => { } }; + const checkShowComments = () => { + let showComments = false; + if (checkIfDrepIsSignedIn()) { + showComments = false; + } else if (!user && !user?.user?.govtool_username) { + showComments = false; + } else { + showComments = true; + } + + return showComments; + }; + + let drepCheck = false; + + const checkIfDrepIsSignedIn = () => { + const jwtData = decodeJWT(); + const isDrep = + walletAPI?.voter?.isRegisteredAsDRep || + walletAPI?.voter?.isRegisteredAsSoleVoter; + const hasDrepID = !!jwtData?.dRepID; + + if (isDrep && !hasDrepID) { + drepCheck = true; + return true; + } + drepCheck = false; + return false; + }; const fetchComments = async (page = 1) => { setLoading(true); try { @@ -1889,8 +1919,7 @@ const SingleBudgetDiscussion = ({ id }) => { /> )} - {/* ovde */} - {user?.user?.govtool_username ? ( + {checkShowComments() ? ( proposal?.attributes?.content?.attributes ?.prop_submitted ? null : ( @@ -1995,7 +2024,10 @@ const SingleBudgetDiscussion = ({ id }) => { ) ) : ( - + )} {proposal?.attributes?.prop_comments_number === 0 ? ( { proposal={proposal} fetchComments={fetchComments} setRefetchProposal={setRefetchProposal} + checkShowComments={checkShowComments} + drepCheck={drepCheck} /> ))} diff --git a/pdf-ui/src/pages/BudgetDiscussion/index.jsx b/pdf-ui/src/pages/BudgetDiscussion/index.jsx index 4f3a4f0..6bb912c 100644 --- a/pdf-ui/src/pages/BudgetDiscussion/index.jsx +++ b/pdf-ui/src/pages/BudgetDiscussion/index.jsx @@ -39,6 +39,8 @@ import { useAppContext } from '../../context/context'; import { loginUserToApp } from '../../lib/helpers'; import { useLocation } from 'react-router-dom'; import { ScrollToTop, useDebounce } from '../../lib/hooks'; +import UserValidation from '../../components/UserValidation/UserValidation'; +import { decodeJWT } from '../../lib/utils'; let proposalsOwnersList = [{ id: 'all-proposals', label: 'All Proposals' }]; let sortOptions = [ @@ -240,6 +242,37 @@ const ProposedBudgetDiscussion = () => { } }, [user?.user?.id]); + const checkShowButton = () => { + let showButton = false; + if (checkIfDrepIsSignedIn()) { + showButton = false; + } else if (!user && !user?.user?.govtool_username) { + showButton = false; + } else { + showButton = true; + } + + return showButton; + }; + + let drepCheck = false; + + const checkIfDrepIsSignedIn = () => { + const jwtData = decodeJWT(); + const isDrep = + walletAPI?.voter?.isRegisteredAsDRep || + walletAPI?.voter?.isRegisteredAsSoleVoter; + const hasDrepID = !!jwtData?.dRepID; + + if (isDrep && !hasDrepID) { + drepCheck = true; + return true; + } + + drepCheck = false; + return false; + }; + return ( @@ -281,8 +314,8 @@ const ProposedBudgetDiscussion = () => { )} - {walletAPI && ( - + + {checkShowButton() ? ( - - )} + ) : ( + + )} + { const MAX_COMMENT_LENGTH = 15000; @@ -448,6 +450,36 @@ const SingleGovernanceAction = ({ id }) => { } }, [commentsSortType]); + const checkShowComments = () => { + let showComments = false; + if (checkIfDrepIsSignedIn()) { + showComments = false; + } else if (!user && !user?.user?.govtool_username) { + showComments = false; + } else { + showComments = true; + } + + return showComments; + }; + + let drepCheck = false; + + const checkIfDrepIsSignedIn = () => { + const jwtData = decodeJWT(); + const isDrep = + walletAPI?.voter?.isRegisteredAsDRep || + walletAPI?.voter?.isRegisteredAsSoleVoter; + const hasDrepID = !!jwtData?.dRepID; + + if (isDrep && !hasDrepID) { + drepCheck = true; + return true; + } + drepCheck = false; + return false; + }; + return !proposal ? null : proposal?.attributes?.content?.attributes ?.is_draft ? null : ( <> @@ -2110,100 +2142,115 @@ const SingleGovernanceAction = ({ id }) => { )} - {proposal?.attributes?.content?.attributes - ?.prop_submitted ? null : ( - - - - - Submit a comment - - - - newCommentText?.length === - MAX_COMMENT_LENGTH && - theme?.palette - ?.error?.main, - }} - > - {`${ - newCommentText?.length || - 0 - }/${MAX_COMMENT_LENGTH}`} - - } - value={newCommentText || ''} - onChange={(e) => handleChange(e)} - inputProps={{ - maxLength: MAX_COMMENT_LENGTH, - onKeyDown: handleKeyDown, - onBlur: handleBlur, - spellCheck: 'false', - autoCorrect: 'off', - autoCapitalize: 'none', - autoComplete: 'off', - 'data-testid': 'comment-input', - }} - /> + {checkShowComments() ? ( + proposal?.attributes?.content?.attributes + ?.prop_submitted ? null : ( + + + + + Submit a comment + - - - - - - + + + + + + ) + ) : ( + )} {proposal?.attributes?.prop_comments_number === 0 ? ( { comment={comment} proposal={proposal} fetchComments={fetchComments} + checkShowComments={checkShowComments} + drepCheck={drepCheck} /> ))} diff --git a/pdf-ui/src/pages/ProposedGovernanceActions/index.jsx b/pdf-ui/src/pages/ProposedGovernanceActions/index.jsx index 53ea9fd..97c4155 100644 --- a/pdf-ui/src/pages/ProposedGovernanceActions/index.jsx +++ b/pdf-ui/src/pages/ProposedGovernanceActions/index.jsx @@ -31,6 +31,8 @@ import { getGovernanceActionTypes } from '../../lib/api'; import { useAppContext } from '../../context/context'; import { loginUserToApp } from '../../lib/helpers'; import { useLocation } from 'react-router-dom'; +import { decodeJWT } from '../../lib/utils'; +import UserValidation from '../../components/UserValidation/UserValidation'; let sortOptions = [ { fieldId: 'createdAt', type: 'DESC', title: 'Newest' }, @@ -55,7 +57,7 @@ let sortOptions = [ type: 'ASC', title: 'Least dislikes', }, - { + { fieldId: 'proposal][prop_comments_number', type: 'DESC', title: 'Most comments', @@ -207,6 +209,37 @@ const ProposedGovernanceActions = () => { } }, [location.pathname]); + const checkShowButton = () => { + let showButton = false; + if (checkIfDrepIsSignedIn()) { + showButton = false; + } else if (!user && !user?.user?.govtool_username) { + showButton = false; + } else { + showButton = true; + } + + return showButton; + }; + + let drepCheck = false; + + const checkIfDrepIsSignedIn = () => { + const jwtData = decodeJWT(); + const isDrep = + walletAPI?.voter?.isRegisteredAsDRep || + walletAPI?.voter?.isRegisteredAsSoleVoter; + const hasDrepID = !!jwtData?.dRepID; + + if (isDrep && !hasDrepID) { + drepCheck = true; + return true; + } + + drepCheck = false; + return false; + }; + return ( @@ -246,9 +279,8 @@ const ProposedGovernanceActions = () => { )} - - {walletAPI?.address && ( - + + {checkShowButton() ? ( - - )} + ) : ( + + )} + Date: Thu, 12 Jun 2025 14:40:13 +0200 Subject: [PATCH 17/25] Version change 1.0.1-alfa --- pdf-ui/CHANGELOG.md | 3 +++ pdf-ui/package-lock.json | 2 +- pdf-ui/package.json | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/pdf-ui/CHANGELOG.md b/pdf-ui/CHANGELOG.md index 0cf10f4..cbcb8d2 100644 --- a/pdf-ui/CHANGELOG.md +++ b/pdf-ui/CHANGELOG.md @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 As a minor extension, we also keep a semantic version for the `UNRELEASED` changes. +## [v1.0.1-alfa](https://www.npmjs.com/package/@intersect.mbo/pdf-ui/v/1.0.1-alfa) 2025-06-12 +- Change: User verification mechanism changed to follow process + ## [v1.0.0-beta](https://www.npmjs.com/package/@intersect.mbo/pdf-ui/v/1.0.0-beta) 2025-06-11 - Fix Hard Fork Proposal type diff --git a/pdf-ui/package-lock.json b/pdf-ui/package-lock.json index f63d45a..f396baf 100644 --- a/pdf-ui/package-lock.json +++ b/pdf-ui/package-lock.json @@ -1,6 +1,6 @@ { "name": "@intersect.mbo/pdf-ui", - "version": "1.0.0-beta", + "version": "1.0.1-alfa", "lockfileVersion": 3, "requires": true, "packages": { diff --git a/pdf-ui/package.json b/pdf-ui/package.json index dfc68c6..e911f86 100644 --- a/pdf-ui/package.json +++ b/pdf-ui/package.json @@ -1,6 +1,6 @@ { "name": "@intersect.mbo/pdf-ui", - "version": "1.0.0-beta", + "version": "1.0.1-alfa", "description": "Proposal discussion ui", "main": "./src/index.js", "exports": { From 8cc1681fad0aa1fdebb8fac99103579e729b03b3 Mon Sep 17 00:00:00 2001 From: Milos Mihajlovic Date: Tue, 17 Jun 2025 15:13:31 +0200 Subject: [PATCH 18/25] feat: Refactor user validation logic and integrate DRep checks across budget discussion and governance action pages - Added new helper functions `checkShowValidation` and `checkIfDrepIsSignedIn` to streamline user validation and DRep status checks. - Updated `SingleBudgetDiscussion`, `SingleGovernanceAction`, and `ProposedGovernanceActions` components to utilize the new validation logic. - Removed redundant validation functions from components to improve code clarity and maintainability. - Enhanced user experience by conditionally rendering validation prompts based on user state and DRep status. --- pdf-ui/src/components/CommentCard/index.jsx | 259 +++-- pdf-ui/src/components/GlobalWrapper.jsx | 10 +- .../UserValidation/UserValidation.jsx | 204 ++-- pdf-ui/src/context/context.jsx | 2 + pdf-ui/src/lib/helpers.js | 38 + .../SingleBudgetDiscussion/index.jsx | 274 ++--- pdf-ui/src/pages/BudgetDiscussion/index.jsx | 68 +- .../SingleGovernanceAction/index.jsx | 1001 +++++++++-------- .../pages/ProposedGovernanceActions/index.jsx | 69 +- 9 files changed, 1005 insertions(+), 920 deletions(-) diff --git a/pdf-ui/src/components/CommentCard/index.jsx b/pdf-ui/src/components/CommentCard/index.jsx index 071a267..d428997 100644 --- a/pdf-ui/src/components/CommentCard/index.jsx +++ b/pdf-ui/src/components/CommentCard/index.jsx @@ -28,7 +28,11 @@ import { Chip, } from '@mui/material'; import Subcomponent from './Subcomponent'; -import { isCommentRestricted } from '../../lib/helpers'; +import { + checkIfDrepIsSignedIn, + checkShowValidation, + isCommentRestricted, +} from '../../lib/helpers'; import UsernameSection from './UsernameSection'; import MarkdownTypography from '../../lib/markdownRenderer'; import UserValidation from '../UserValidation/UserValidation'; @@ -503,134 +507,147 @@ const CommentCard = ({ {proposal?.attributes?.content?.attributes ?.prop_submitted ? null : ( - + + {checkShowValidation( + true, + walletAPI, + user + ) && ( + + )} + + )} {showReply ? ( - checkShowComments() ? ( - - handleChange(e)} - onBlur={handleBlur} - inputProps={{ + + handleChange(e)} + onBlur={handleBlur} + inputProps={{ + maxLength: subcommentMaxLength, + spellCheck: 'false', + autoCorrect: 'off', + autoCapitalize: 'none', + autoComplete: 'off', + }} + helperText={ + + subcommentText?.length === + subcommentMaxLength && + theme?.palette?.error?.main, + }} + > + {`${ + subcommentText?.length || 0 + }/${subcommentMaxLength}`} + + } + InputProps={{ + inputProps: { maxLength: subcommentMaxLength, - spellCheck: 'false', - autoCorrect: 'off', - autoCapitalize: 'none', - autoComplete: 'off', - }} - helperText={ - - subcommentText?.length === - subcommentMaxLength && - theme?.palette?.error - ?.main, - }} - > - {`${ - subcommentText?.length || 0 - }/${subcommentMaxLength}`} - - } - InputProps={{ - inputProps: { - maxLength: subcommentMaxLength, - 'data-testid': 'reply-input', - }, - }} - /> + 'data-testid': 'reply-input', + }, + }} + /> - + - + Comment + - ) : ( - - ) + ) : null} {showSubcomments && diff --git a/pdf-ui/src/components/GlobalWrapper.jsx b/pdf-ui/src/components/GlobalWrapper.jsx index f9d24ee..b7e5099 100644 --- a/pdf-ui/src/components/GlobalWrapper.jsx +++ b/pdf-ui/src/components/GlobalWrapper.jsx @@ -92,7 +92,9 @@ const GlobalWrapper = ({ ...props }) => { const handleLogin = async (trigerSignData, useDRepKey = false) => { if (GovToolAssemblyWalletAPI?.address) { - setWalletAPI(GovToolAssemblyWalletAPI); + setWalletAPI((prevWalletAPI) => { + return GovToolAssemblyWalletAPI; + }); if (GovToolAssemblyValidateMetadata) { setValidateMetadata(() => GovToolAssemblyValidateMetadata); } @@ -177,7 +179,11 @@ const GlobalWrapper = ({ ...props }) => { } else { handleLogin(false); } - }, [GovToolAssemblyWalletAPI?.address, mounted]); + }, [ + GovToolAssemblyWalletAPI?.address, + mounted, + props?.walletAPI + ]); useEffect(() => { if (GovToolAssemblyLocale) { diff --git a/pdf-ui/src/components/UserValidation/UserValidation.jsx b/pdf-ui/src/components/UserValidation/UserValidation.jsx index fe86f02..d13a3bd 100644 --- a/pdf-ui/src/components/UserValidation/UserValidation.jsx +++ b/pdf-ui/src/components/UserValidation/UserValidation.jsx @@ -21,7 +21,11 @@ import { } from '../../lib/utils'; import { getRefreshToken } from '../../lib/api'; -const UserValidation = ({ type = 'budget', drepCheck = false }) => { +const UserValidation = ({ + type = 'budget', + drepCheck = false, + drepRequired = false, +}) => { const { setWalletAPI, loading, @@ -62,7 +66,6 @@ const UserValidation = ({ type = 'budget', drepCheck = false }) => { addWarningAlert: GovToolAddWarningAlert, addChangesSavedAlert: GovToolAddChangesSavedAlert, } = govtoolProps || {}; - const handleLogin = async (trigerSignData, useDRepKey = false) => { if (GovToolAssemblyWalletAPI?.address) { setWalletAPI(GovToolAssemblyWalletAPI); @@ -144,14 +147,6 @@ const UserValidation = ({ type = 'budget', drepCheck = false }) => { } }, [GovToolAddChangesSavedAlert]); - useEffect(() => { - if (!mounted) { - setMounted(true); - } else { - handleLogin(false); - } - }, [GovToolAssemblyWalletAPI?.address, mounted]); - useEffect(() => { if (GovToolAssemblyLocale) { setLocale(GovToolAssemblyLocale); @@ -187,7 +182,6 @@ const UserValidation = ({ type = 'budget', drepCheck = false }) => { } } } else { - console.log('No token found'); setUser(null); clearInterval(interval); // Clear interval if there is no token } @@ -197,31 +191,6 @@ const UserValidation = ({ type = 'budget', drepCheck = false }) => { } }, [user]); - const showValidationMessage = useMemo(() => { - const messages = []; - - if (!walletAPI) { - messages.push(To connect a Cardano wallet); - } - - if (!user) { - messages.push( - Verify yourself with your wallet - ); - } - - if (!user?.user?.govtool_username) { - messages.push(A GovTool Display Name); - } - if (drepCheck) { - messages.push( - Verify your status as a DRep. - ); - } - - return messages; - }, [user, walletAPI]); - const checkFunctionCall = () => { if (!walletAPI?.address) { const button = document.querySelector( @@ -236,120 +205,85 @@ const UserValidation = ({ type = 'budget', drepCheck = false }) => { callBackFn: () => {}, }); } else if (drepCheck) { - console.log('DRep check'); handleLogin(true, true); } }; - const checkButtonText = () => { - if (!walletAPI?.address) { - return 'Get started'; - } else if (!user) { - return 'Verify'; - } else if (!user?.user?.govtool_username) { - return 'Create Display Name'; - } else if (drepCheck) { - return 'Verify'; - } - }; - const checkTitleText = (type) => { switch (type) { case 'budget': - return 'To submit a comment, you will need:'; + return 'To submit a comment, you need to'; case 'comment': - return 'To submit a reply, you will need:'; + return 'To submit a reply, you need to'; case 'budget-proposal': - return 'To submit a budget proposal, you will need:'; + return 'To submit a budget proposal, you need to'; case 'proposal': - return 'To submit a proposal, you will need:'; + return 'To submit a proposal, you need to'; + case 'governance': + return 'If this is your Proposal, to submit it, you need to'; + case 'sentiment': + 'To show sentiment, you need to'; default: - return 'To submit a comment, you will need:'; + return 'To submit a comment, you need to'; } }; - return ( - - - - - - {type === 'budget' && ( - - theme.palette.text.grey, - }} - mt={2} - > - Submit a comment - - )} - - - {checkTitleText(type)} - + const showValidationMessage = useMemo(() => { + if (!walletAPI) { + return ( + + connect a Cardano wallet + + ); + } + + if (!user) { + return ( + + verify yourself by signing a transaction + + ); + } - - - Learn more - - - - - - - - - - - {showValidationMessage.map((item, index) => ( - - - {item.props.children} - - ))} - - - - + if (!user?.user?.govtool_username) { + return ( + + create a GovTool Display Name + + ); + } + if (drepRequired && drepCheck) { + return ( + + verify your status as a DRep. + + ); + } + }, [user, walletAPI]); + + return ( + + + + {checkTitleText(type)} + + {showValidationMessage} + ); }; diff --git a/pdf-ui/src/context/context.jsx b/pdf-ui/src/context/context.jsx index 3d97751..da11292 100644 --- a/pdf-ui/src/context/context.jsx +++ b/pdf-ui/src/context/context.jsx @@ -6,6 +6,7 @@ export function AppContextProvider({ children }) { const [user, setUser] = useState(); const [loading, setLoading] = useState(false); const [walletAPI, setWalletAPI] = useState(null); + const [validateMetadata, setValidateMetadata] = useState(null); const [locale, setLocale] = useState('en'); const [openUsernameModal, setOpenUsernameModal] = useState({ @@ -22,6 +23,7 @@ export function AppContextProvider({ children }) { const [identificationType, setIdentificationType] = useState('wallet'); const [govtoolProps, setGovtoolProps] = useState(); + const clearStates = () => { setWalletAPI(null); setUser(null); diff --git a/pdf-ui/src/lib/helpers.js b/pdf-ui/src/lib/helpers.js index c708aa4..a11eb42 100644 --- a/pdf-ui/src/lib/helpers.js +++ b/pdf-ui/src/lib/helpers.js @@ -91,9 +91,11 @@ export const loginUserToApp = async ({ } else { if (trigerSignData) { const keyToSign = wallet?.stakeKey; + const challengeRes = await getChallenge({ query: `?identifier=${keyToSign}`, }); + const { message } = challengeRes; const messageHex = utf8ToHex(message); @@ -240,3 +242,39 @@ export const isCommentRestricted = (curComment) => { } return false; }; + +export const checkShowValidation = (drepRequired = false, walletAPI, user) => { + let showButton = false; + + if (!walletAPI) { + showButton = true; + } else if (!user) { + showButton = true; + } else if (!user?.user?.govtool_username) { + showButton = true; + } else if (drepRequired) { + if (checkIfDrepIsSignedIn(walletAPI)) { + showButton = true; + } else { + showButton = false; + } + } else { + showButton = false; + } + + return showButton; +}; + +export const checkIfDrepIsSignedIn = (walletAPI) => { + const jwtData = decodeJWT(); + const isDrep = + walletAPI?.voter?.isRegisteredAsDRep || + walletAPI?.voter?.isRegisteredAsSoleVoter; + const hasDrepID = !!jwtData?.dRepID; + + if (isDrep && !hasDrepID) { + return true; + } + + return false; +}; diff --git a/pdf-ui/src/pages/BudgetDiscussion/SingleBudgetDiscussion/index.jsx b/pdf-ui/src/pages/BudgetDiscussion/SingleBudgetDiscussion/index.jsx index 7ae83ef..992d2a3 100644 --- a/pdf-ui/src/pages/BudgetDiscussion/SingleBudgetDiscussion/index.jsx +++ b/pdf-ui/src/pages/BudgetDiscussion/SingleBudgetDiscussion/index.jsx @@ -57,6 +57,10 @@ import ProposalOwnModal from '../../../components/ProposalOwnModal'; import BudgetDiscussionReviewVersions from '../../../components/BudgetDiscussionReviewVersions'; import { useScrollToHashSection } from '../../../lib/hooks'; import UserValidation from '../../../components/UserValidation/UserValidation'; +import { + checkIfDrepIsSignedIn, + checkShowValidation, +} from '../../../lib/helpers'; const SECTIONS = [ 'problem-statement', @@ -245,35 +249,6 @@ const SingleBudgetDiscussion = ({ id }) => { } }; - const checkShowComments = () => { - let showComments = false; - if (checkIfDrepIsSignedIn()) { - showComments = false; - } else if (!user && !user?.user?.govtool_username) { - showComments = false; - } else { - showComments = true; - } - - return showComments; - }; - - let drepCheck = false; - - const checkIfDrepIsSignedIn = () => { - const jwtData = decodeJWT(); - const isDrep = - walletAPI?.voter?.isRegisteredAsDRep || - walletAPI?.voter?.isRegisteredAsSoleVoter; - const hasDrepID = !!jwtData?.dRepID; - - if (isDrep && !hasDrepID) { - drepCheck = true; - return true; - } - drepCheck = false; - return false; - }; const fetchComments = async (page = 1) => { setLoading(true); try { @@ -1875,7 +1850,7 @@ const SingleBudgetDiscussion = ({ id }) => { justifyContent='space-between' > - Comments + Polls { /> )} - {checkShowComments() ? ( - proposal?.attributes?.content?.attributes - ?.prop_submitted ? null : ( - - - - - Submit a comment - + + + Comments + + + {proposal?.attributes?.content?.attributes + ?.prop_submitted ? null : ( + + + + + Submit a comment + - - newCommentText?.length === - MAX_COMMENT_LENGTH && - theme?.palette - ?.error - ?.main, - }} - > - {`${ - newCommentText?.length || - 0 - }/${MAX_COMMENT_LENGTH}`} - + + newCommentText?.length === + MAX_COMMENT_LENGTH && + theme?.palette + ?.error?.main, + }} + > + {`${ + newCommentText?.length || + 0 + }/${MAX_COMMENT_LENGTH}`} + + } + value={newCommentText || ''} + onChange={(e) => handleChange(e)} + inputProps={{ + maxLength: MAX_COMMENT_LENGTH, + onKeyDown: handleKeyDown, + onBlur: handleBlur, + spellCheck: 'false', + autoCorrect: 'off', + autoCapitalize: 'none', + autoComplete: 'off', + 'data-testid': 'comment-input', + }} + /> + + + {checkShowValidation( + true, + walletAPI, + user + ) && ( + + )} + - - - - - ) - ) : ( - + Comment + + + + + )} {proposal?.attributes?.prop_comments_number === 0 ? ( { proposal={proposal} fetchComments={fetchComments} setRefetchProposal={setRefetchProposal} - checkShowComments={checkShowComments} - drepCheck={drepCheck} + checkShowComments={checkShowValidation( + false, + walletAPI, + user + )} + drepCheck={checkIfDrepIsSignedIn(walletAPI)} + user={user} /> ))} diff --git a/pdf-ui/src/pages/BudgetDiscussion/index.jsx b/pdf-ui/src/pages/BudgetDiscussion/index.jsx index 6bb912c..890b0c8 100644 --- a/pdf-ui/src/pages/BudgetDiscussion/index.jsx +++ b/pdf-ui/src/pages/BudgetDiscussion/index.jsx @@ -36,11 +36,14 @@ import { SearchInput, } from '../../components'; import { useAppContext } from '../../context/context'; -import { loginUserToApp } from '../../lib/helpers'; +import { + checkIfDrepIsSignedIn, + checkShowValidation, + loginUserToApp, +} from '../../lib/helpers'; import { useLocation } from 'react-router-dom'; import { ScrollToTop, useDebounce } from '../../lib/hooks'; import UserValidation from '../../components/UserValidation/UserValidation'; -import { decodeJWT } from '../../lib/utils'; let proposalsOwnersList = [{ id: 'all-proposals', label: 'All Proposals' }]; let sortOptions = [ @@ -242,37 +245,6 @@ const ProposedBudgetDiscussion = () => { } }, [user?.user?.id]); - const checkShowButton = () => { - let showButton = false; - if (checkIfDrepIsSignedIn()) { - showButton = false; - } else if (!user && !user?.user?.govtool_username) { - showButton = false; - } else { - showButton = true; - } - - return showButton; - }; - - let drepCheck = false; - - const checkIfDrepIsSignedIn = () => { - const jwtData = decodeJWT(); - const isDrep = - walletAPI?.voter?.isRegisteredAsDRep || - walletAPI?.voter?.isRegisteredAsSoleVoter; - const hasDrepID = !!jwtData?.dRepID; - - if (isDrep && !hasDrepID) { - drepCheck = true; - return true; - } - - drepCheck = false; - return false; - }; - return ( @@ -315,9 +287,21 @@ const ProposedBudgetDiscussion = () => { )} - {checkShowButton() ? ( + - ) : ( - - )} + {checkShowValidation(false, walletAPI, user) && ( + + )} + diff --git a/pdf-ui/src/pages/ProposedGovernanceActions/SingleGovernanceAction/index.jsx b/pdf-ui/src/pages/ProposedGovernanceActions/SingleGovernanceAction/index.jsx index 0e086ea..ad62ac7 100644 --- a/pdf-ui/src/pages/ProposedGovernanceActions/SingleGovernanceAction/index.jsx +++ b/pdf-ui/src/pages/ProposedGovernanceActions/SingleGovernanceAction/index.jsx @@ -37,6 +37,7 @@ import { DialogContent, DialogContentText, badgeClasses, + Link, } from '@mui/material'; import { useEffect, useState, useRef } from 'react'; import { useNavigate } from 'react-router-dom'; @@ -68,7 +69,11 @@ import { } from '../../../lib/utils'; import ProposalOwnModal from '../../../components/ProposalOwnModal'; import ReactMarkdown from 'react-markdown'; -import { loginUserToApp } from '../../../lib/helpers'; +import { + checkIfDrepIsSignedIn, + checkShowValidation, + loginUserToApp, +} from '../../../lib/helpers'; import MarkdownTypography from '../../../lib/markdownRenderer'; import UserValidation from '../../../components/UserValidation/UserValidation'; @@ -450,36 +455,6 @@ const SingleGovernanceAction = ({ id }) => { } }, [commentsSortType]); - const checkShowComments = () => { - let showComments = false; - if (checkIfDrepIsSignedIn()) { - showComments = false; - } else if (!user && !user?.user?.govtool_username) { - showComments = false; - } else { - showComments = true; - } - - return showComments; - }; - - let drepCheck = false; - - const checkIfDrepIsSignedIn = () => { - const jwtData = decodeJWT(); - const isDrep = - walletAPI?.voter?.isRegisteredAsDRep || - walletAPI?.voter?.isRegisteredAsSoleVoter; - const hasDrepID = !!jwtData?.dRepID; - - if (isDrep && !hasDrepID) { - drepCheck = true; - return true; - } - drepCheck = false; - return false; - }; - return !proposal ? null : proposal?.attributes?.content?.attributes ?.is_draft ? null : ( <> @@ -504,11 +479,11 @@ const SingleGovernanceAction = ({ id }) => { } onClick={() => navigate(`/proposal_discussion`)} > - Show all + Back - + {/* { } + */} + + {checkShowValidation(false, walletAPI, user) && ( + + )} @@ -757,14 +741,60 @@ const SingleGovernanceAction = ({ id }) => { } - - {/* SHARE BUTTON */} + + {user && + user?.user?.id?.toString() === + proposal?.attributes?.user_id?.toString() ? ( + + ) : null} + + {/* SHARE BUTTON */} + { - + { theme?.palette?.text?.grey, }} > - {`Last Edit: ${formatIsoDate( - proposal?.attributes?.content - ?.attributes?.createdAt - )}`} + {proposal?.attributes?.content + ?.attributes?.prop_submitted + ? `Submitted for vote on:` + : `Proposed on:`} + + {proposal?.attributes?.content + ?.attributes?.prop_submitted + ? `${formatIsoDate(proposal?.attributes?.content?.attributes?.prop_submission_date)}` + : `${formatIsoDate( + proposal?.attributes + ?.createdAt + )}`} + + + + + + {' '} + + theme?.palette?.text + ?.grey, + }} + > + Last Edit: + + + {formatIsoDate( + proposal?.attributes + ?.content?.attributes + ?.createdAt + )} + + - + { - - {/* LIKE BUTTON */} - - {proposal?.attributes - ?.content - ?.attributes - ?.prop_submitted - ? `Proposal Submitted\n\nYou can't like this proposal` - : walletAPI?.address - ? user - ? user?.user?.id?.toString() === - proposal?.attributes?.user_id?.toString() - ? `You can't like your proposal` - : userProposalVote - ? userProposalVote - ?.attributes - ?.vote_result === - true - ? `You already liked this proposal` - : 'Like this proposal\n\nClick to like this proposal' - : 'Like this proposal\n\nClick to like this proposal' - : 'Like this proposal\n\nClick to like this proposal' - : 'Connect wallet to like this proposal'} - - } - > - - - `1px solid ${theme.palette.iconButton.outlineLightColor}`, - }} - data-testid='like-button' - disabled={ - walletAPI?.address - ? proposal - ?.attributes - ?.content - ?.attributes - ?.prop_submitted - ? true - : user + {/* OVDE */} + + {checkShowValidation( + false, + walletAPI, + user + ) && ( + + )} + + {/* LIKE BUTTON */} + + {proposal + ?.attributes + ?.content + ?.attributes + ?.prop_submitted + ? `Proposal Submitted\n\nYou can't like this proposal` + : walletAPI?.address + ? user ? user?.user?.id?.toString() === proposal?.attributes?.user_id?.toString() - ? true + ? `You can't like your proposal` : userProposalVote ? userProposalVote ?.attributes ?.vote_result === true - ? true + ? `You already liked this proposal` + : 'Like this proposal\n\nClick to like this proposal' + : 'Like this proposal\n\nClick to like this proposal' + : 'Like this proposal\n\nClick to like this proposal' + : 'Connect wallet to like this proposal'} + + } + > + + + `1px solid ${theme.palette.iconButton.outlineLightColor}`, + }} + data-testid='like-button' + disabled={ + walletAPI?.address + ? proposal + ?.attributes + ?.content + ?.attributes + ?.prop_submitted + ? true + : user + ? user?.user?.id?.toString() === + proposal?.attributes?.user_id?.toString() + ? true + : userProposalVote + ? userProposalVote + ?.attributes + ?.vote_result === + true + ? true + : false : false - : false - : false - : true - } - onClick={ - proposal?.attributes - ?.content - ?.attributes - ?.prop_submitted - ? null - : user - ? !user?.user - ?.govtool_username - ? () => - setOpenUsernameModal( - { - open: true, - callBackFn: - () => {}, - } - ) - : user?.user?.id?.toString() === - proposal?.attributes?.user_id?.toString() - ? null - : userProposalVote - ? userProposalVote - ?.attributes - ?.vote_result === - null - ? null + : false + : true + } + onClick={ + proposal + ?.attributes + ?.content + ?.attributes + ?.prop_submitted + ? null + : user + ? !user + ?.user + ?.govtool_username + ? () => + setOpenUsernameModal( + { + open: true, + callBackFn: + () => {}, + } + ) + : user?.user?.id?.toString() === + proposal?.attributes?.user_id?.toString() + ? null + : userProposalVote + ? userProposalVote + ?.attributes + ?.vote_result === + null + ? null + : () => + updateLikesOrDislikes( + { + like: true, + loggedInUser: + user, + } + ) : () => updateLikesOrDislikes( { @@ -1765,63 +1861,60 @@ const SingleGovernanceAction = ({ id }) => { user, } ) - : () => - updateLikesOrDislikes( - { - like: true, - loggedInUser: - user, - } - ) - : () => - updateLikesOrDislikes( - { - like: true, - loggedInUser: - user, - } - ) - } - > - + updateLikesOrDislikes( + { + like: true, + loggedInUser: + user, + } + ) } - data-testid='like-count' - showZero - aria-label='proposal likes' - sx={{ - transform: - 'translate(30px, -20px)', - '& .MuiBadge-badge': - { - color: 'white', - backgroundColor: - ( - theme - ) => - theme - .palette - .badgeColors - .secondary, - }, - }} - > - + + theme + .palette + .badgeColors + .secondary, + }, + }} + > + { ?.primary ?.icons ?.black - : theme - ?.palette - ?.primary - ?.icons - ?.black - } - /> - - - - {/* DISLIKE BUTTON */} - - {proposal?.attributes - ?.content - ?.attributes - ?.prop_submitted - ? `Proposal Submitted\n\nYou can't dislike this proposal` - : walletAPI?.address - ? user - ? user?.user?.id?.toString() === - proposal?.attributes?.user_id?.toString() - ? `You can't dislike your proposal` - : userProposalVote - ? userProposalVote - ?.attributes - ?.vote_result === - false - ? `You already disliked this proposal` - : 'Dislike this proposal\n\nClick to dislike this proposal' - : 'Dislike this proposal\n\nClick to dislike this proposal' - : 'Dislike this proposal\n\nClick to dislike this proposal' - : 'Connect wallet to dislike this proposal'} + } + /> + - } - > - - - `1px solid ${theme.palette.iconButton.outlineLightColor}`, - }} - data-testid='dislike-button' - disabled={ - walletAPI?.address - ? proposal - ?.attributes - ?.content - ?.attributes - ?.prop_submitted - ? true - : user + + {/* DISLIKE BUTTON */} + + {proposal + ?.attributes + ?.content + ?.attributes + ?.prop_submitted + ? `Proposal Submitted\n\nYou can't dislike this proposal` + : walletAPI?.address + ? user ? user?.user?.id?.toString() === proposal?.attributes?.user_id?.toString() - ? true + ? `You can't dislike your proposal` : userProposalVote ? userProposalVote ?.attributes ?.vote_result === false - ? true + ? `You already disliked this proposal` + : 'Dislike this proposal\n\nClick to dislike this proposal' + : 'Dislike this proposal\n\nClick to dislike this proposal' + : 'Dislike this proposal\n\nClick to dislike this proposal' + : 'Connect wallet to dislike this proposal'} + + } + > + + + `1px solid ${theme.palette.iconButton.outlineLightColor}`, + }} + data-testid='dislike-button' + disabled={ + walletAPI?.address + ? proposal + ?.attributes + ?.content + ?.attributes + ?.prop_submitted + ? true + : user + ? user?.user?.id?.toString() === + proposal?.attributes?.user_id?.toString() + ? true + : userProposalVote + ? userProposalVote + ?.attributes + ?.vote_result === + false + ? true + : false : false - : false - : false - : true - } - onClick={ - proposal?.attributes - ?.content - ?.attributes - ?.prop_submitted - ? null - : user - ? !user?.user - ?.govtool_username - ? () => - setOpenUsernameModal( - { - open: true, - callBackFn: - () => {}, - } - ) - : user?.user?.id?.toString() === - proposal?.attributes?.user_id?.toString() - ? null - : userProposalVote - ? userProposalVote - ?.attributes - ?.vote_result === - null - ? null + : false + : true + } + onClick={ + proposal + ?.attributes + ?.content + ?.attributes + ?.prop_submitted + ? null + : user + ? !user + ?.user + ?.govtool_username + ? () => + setOpenUsernameModal( + { + open: true, + callBackFn: + () => {}, + } + ) + : user?.user?.id?.toString() === + proposal?.attributes?.user_id?.toString() + ? null + : userProposalVote + ? userProposalVote + ?.attributes + ?.vote_result === + null + ? null + : () => + updateLikesOrDislikes( + { + like: false, + loggedInUser: + user, + } + ) : () => updateLikesOrDislikes( { @@ -1938,63 +2039,60 @@ const SingleGovernanceAction = ({ id }) => { user, } ) - : () => - updateLikesOrDislikes( - { - like: false, - loggedInUser: - user, - } - ) - : () => - updateLikesOrDislikes( - { - like: false, - loggedInUser: - user, - } - ) - } - > - + updateLikesOrDislikes( + { + like: false, + loggedInUser: + user, + } + ) } - data-testid='dislike-count' - showZero - aria-label='proposal dislikes' - sx={{ - transform: - 'translate(30px, -20px)', - '& .MuiBadge-badge': - { - color: 'white', - backgroundColor: - ( - theme - ) => - theme - .palette - .badgeColors - .errorLight, - }, - }} - > - + + theme + .palette + .badgeColors + .errorLight, + }, + }} + > + { ?.primary ?.icons ?.black - : theme - ?.palette - ?.primary - ?.icons - ?.black - } - /> - - - + } + /> + + + + @@ -2028,7 +2122,7 @@ const SingleGovernanceAction = ({ id }) => { justifyContent='space-between' > - Comments + Polls { /> - {proposal?.attributes?.content?.attributes ?.prop_submitted ? null : user && +user?.user?.id === +proposal?.attributes?.user_id && @@ -2141,116 +2234,127 @@ const SingleGovernanceAction = ({ id }) => { ))} )} + + + Comments + + + {proposal?.attributes?.content?.attributes + ?.prop_submitted ? null : ( + + + + + Submit a comment + - {checkShowComments() ? ( - proposal?.attributes?.content?.attributes - ?.prop_submitted ? null : ( - - - - - Submit a comment - + + newCommentText?.length === + MAX_COMMENT_LENGTH && + theme?.palette + ?.error?.main, + }} + > + {`${ + newCommentText?.length || + 0 + }/${MAX_COMMENT_LENGTH}`} + + } + value={newCommentText || ''} + onChange={(e) => handleChange(e)} + inputProps={{ + maxLength: MAX_COMMENT_LENGTH, + onKeyDown: handleKeyDown, + onBlur: handleBlur, + spellCheck: 'false', + autoCorrect: 'off', + autoCapitalize: 'none', + autoComplete: 'off', + 'data-testid': 'comment-input', + }} + /> - - newCommentText?.length === - MAX_COMMENT_LENGTH && - theme?.palette - ?.error - ?.main, - }} - > - {`${ - newCommentText?.length || - 0 - }/${MAX_COMMENT_LENGTH}`} - + + {checkShowValidation( + true, + walletAPI, + user + ) && ( + + )} + - - - - - ) - ) : ( - + Comment + + + + + )} {proposal?.attributes?.prop_comments_number === 0 ? ( { comment={comment} proposal={proposal} fetchComments={fetchComments} - checkShowComments={checkShowComments} - drepCheck={drepCheck} + checkShowComments={checkShowValidation( + false, + walletAPI, + user + )} + drepCheck={checkIfDrepIsSignedIn(walletAPI)} + user={user} /> ))} diff --git a/pdf-ui/src/pages/ProposedGovernanceActions/index.jsx b/pdf-ui/src/pages/ProposedGovernanceActions/index.jsx index 97c4155..4524000 100644 --- a/pdf-ui/src/pages/ProposedGovernanceActions/index.jsx +++ b/pdf-ui/src/pages/ProposedGovernanceActions/index.jsx @@ -29,7 +29,7 @@ import { useEffect, useState } from 'react'; import { ProposalsList, CreateGovernanceActionDialog } from '../../components'; import { getGovernanceActionTypes } from '../../lib/api'; import { useAppContext } from '../../context/context'; -import { loginUserToApp } from '../../lib/helpers'; +import { checkIfDrepIsSignedIn, checkShowValidation, loginUserToApp } from '../../lib/helpers'; import { useLocation } from 'react-router-dom'; import { decodeJWT } from '../../lib/utils'; import UserValidation from '../../components/UserValidation/UserValidation'; @@ -209,37 +209,6 @@ const ProposedGovernanceActions = () => { } }, [location.pathname]); - const checkShowButton = () => { - let showButton = false; - if (checkIfDrepIsSignedIn()) { - showButton = false; - } else if (!user && !user?.user?.govtool_username) { - showButton = false; - } else { - showButton = true; - } - - return showButton; - }; - - let drepCheck = false; - - const checkIfDrepIsSignedIn = () => { - const jwtData = decodeJWT(); - const isDrep = - walletAPI?.voter?.isRegisteredAsDRep || - walletAPI?.voter?.isRegisteredAsSoleVoter; - const hasDrepID = !!jwtData?.dRepID; - - if (isDrep && !hasDrepID) { - drepCheck = true; - return true; - } - - drepCheck = false; - return false; - }; - return ( @@ -280,9 +249,23 @@ const ProposedGovernanceActions = () => { )} - {checkShowButton() ? ( + - ) : ( - - )} + {checkShowValidation( + false, + walletAPI, + user + ) && ( + + )} + From 3629bd4ee38b1c54a3bec1b79a90a15e498c142a Mon Sep 17 00:00:00 2001 From: Milos Mihajlovic Date: Wed, 18 Jun 2025 11:42:37 +0200 Subject: [PATCH 19/25] feat: Update changelog for version 1.0.1-beta and enhance user validation in budget discussion and governance actions --- pdf-ui/CHANGELOG.md | 4 + pdf-ui/package.json | 2 +- .../components/BudgetDiscussionPoll/index.jsx | 78 +++++++++++++++++-- .../CreationGoveranceAction/LinkManager.jsx | 12 +-- .../UserValidation/UserValidation.jsx | 13 +++- .../SingleBudgetDiscussion/index.jsx | 8 +- pdf-ui/src/pages/BudgetDiscussion/index.jsx | 44 ++++++++--- .../SingleGovernanceAction/index.jsx | 21 ++++- .../pages/ProposedGovernanceActions/index.jsx | 2 +- 9 files changed, 148 insertions(+), 36 deletions(-) diff --git a/pdf-ui/CHANGELOG.md b/pdf-ui/CHANGELOG.md index 0cf10f4..3a96725 100644 --- a/pdf-ui/CHANGELOG.md +++ b/pdf-ui/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 As a minor extension, we also keep a semantic version for the `UNRELEASED` changes. +## [v1.0.0-beta](https://www.npmjs.com/package/@intersect.mbo/pdf-ui/v/1.0.1-beta) 2025-06-18 +- Change login +- Fix Invalid Link Validation Bypassed in Proposal Creation via UI and API #3715 + ## [v1.0.0-beta](https://www.npmjs.com/package/@intersect.mbo/pdf-ui/v/1.0.0-beta) 2025-06-11 - Fix Hard Fork Proposal type diff --git a/pdf-ui/package.json b/pdf-ui/package.json index dfc68c6..b34961e 100644 --- a/pdf-ui/package.json +++ b/pdf-ui/package.json @@ -1,6 +1,6 @@ { "name": "@intersect.mbo/pdf-ui", - "version": "1.0.0-beta", + "version": "1.0.1-beta", "description": "Proposal discussion ui", "main": "./src/index.js", "exports": { diff --git a/pdf-ui/src/components/BudgetDiscussionPoll/index.jsx b/pdf-ui/src/components/BudgetDiscussionPoll/index.jsx index e3cb2f6..0f84dd3 100644 --- a/pdf-ui/src/components/BudgetDiscussionPoll/index.jsx +++ b/pdf-ui/src/components/BudgetDiscussionPoll/index.jsx @@ -19,7 +19,9 @@ import { } from '../../lib/api'; import { decodeJWT, formatDateWithOffset } from '../../lib/utils'; import DrepVotersDialog from '../DrepVotersDialog'; -import { add } from 'date-fns'; +import { add, max } from 'date-fns'; +import { checkIfDrepIsSignedIn, checkShowValidation } from '../../lib/helpers'; +import UserValidation from '../UserValidation/UserValidation'; const BudgetDiscussionPoll = ({ fetchActivePoll = false, @@ -156,7 +158,7 @@ const BudgetDiscussionPoll = ({ if (poll) { return ( <> - {user && + {/* {user && !userPollVote && (walletAPI?.voter?.isRegisteredAsDRep || walletAPI?.voter?.isRegisteredAsSoleVoter) && @@ -209,18 +211,18 @@ const BudgetDiscussionPoll = ({ - ) : null} + ) : null} */} - {proposalAuthorUsername ? ( + {/* {proposalAuthorUsername ? ( @{proposalAuthorUsername} - ) : null} - theme.palette.text.grey, @@ -240,7 +242,69 @@ const BudgetDiscussionPoll = ({ Do you support this proposal to be included in the next Cardano Budget? - + */} + + + Should this proposal be included in the next + Cardano Budget? + + {checkShowValidation(true, walletAPI, user) ? ( + + ) : ( + + + + + )} + 255) { textError = 'Text must be 255 characters or less'; } + if (value.trim() === '') { + textError = 'Text cannot be empty'; + } setLinksErrors((prev) => { - - if (value === '' || value < 255) { - const { [index]: removed, ...rest } = prev; - return rest; - } - if (value === '') { + if (textError === '') { const currentErrors = prev[index] || {}; const { text, ...otherErrors } = currentErrors; @@ -110,6 +108,8 @@ const LinkManager = ({ }); }; + console.log('linksErrors', linksErrors); + return ( {proposalData?.proposal_links?.map((link, index) => ( diff --git a/pdf-ui/src/components/UserValidation/UserValidation.jsx b/pdf-ui/src/components/UserValidation/UserValidation.jsx index d13a3bd..aef244a 100644 --- a/pdf-ui/src/components/UserValidation/UserValidation.jsx +++ b/pdf-ui/src/components/UserValidation/UserValidation.jsx @@ -222,9 +222,11 @@ const UserValidation = ({ case 'governance': return 'If this is your Proposal, to submit it, you need to'; case 'sentiment': - 'To show sentiment, you need to'; + return 'To show sentiment, you need to'; + case "drep-poll": + return "If you are a Drep, you need to" default: - return 'To submit a comment, you need to'; + return ''; } }; @@ -275,7 +277,7 @@ const UserValidation = ({ display: 'flex', flexDirection: 'row', flexWrap: 'wrap', - gap: 1, + gap: 0.5, marginTop: 0.3, }} > @@ -283,6 +285,11 @@ const UserValidation = ({ {checkTitleText(type)} {showValidationMessage} + {type === "drep-poll" && !user && ( + + and Drep key to vote. This is a two step process for security. + + )} ); diff --git a/pdf-ui/src/pages/BudgetDiscussion/SingleBudgetDiscussion/index.jsx b/pdf-ui/src/pages/BudgetDiscussion/SingleBudgetDiscussion/index.jsx index 992d2a3..993d375 100644 --- a/pdf-ui/src/pages/BudgetDiscussion/SingleBudgetDiscussion/index.jsx +++ b/pdf-ui/src/pages/BudgetDiscussion/SingleBudgetDiscussion/index.jsx @@ -875,7 +875,7 @@ const SingleBudgetDiscussion = ({ id }) => { mt={2} display='flex' alignItems='center' - justifyContent='space-between' + gap={2} > { )}`} - + { justifyContent='space-between' > - Polls + Drep Poll { const showNoProposals = allEmptyMatchBudget || allFilteredAreEmpty; useEffect(() => { + console.log(proposalsOwnersList); if (user?.user?.id) { - if (proposalsOwnersList?.find((f) => f?.id === 'my-proposals')) + const myProposals = proposalsOwnersList?.find( + (f) => f?.id === 'my-proposals' + ); + if (myProposals) { + myProposals.disabled = false; return; + } proposalsOwnersList?.push({ id: 'my-proposals', label: 'My Proposals', + disabled: false, }); - } else { - if (proposalsOwnersList?.find((f) => f?.id === 'my-proposals')) { - proposalsOwnersList = proposalsOwnersList.filter( - (f) => f?.id === 'my-proposals' - ); - } } + // else { + // if (proposalsOwnersList?.find((f) => f?.id === 'my-proposals')) { + // proposalsOwnersList = proposalsOwnersList.filter( + // (f) => f?.id === 'my-proposals' + // ); + // } + // } }, [user?.user?.id]); return ( @@ -301,7 +312,11 @@ const ProposedBudgetDiscussion = () => { maxHeight: '40px', maxWidth: '350px', }} - disabled={checkShowValidation(false, walletAPI, user)} + disabled={checkShowValidation( + false, + walletAPI, + user + )} onClick={async () => await loginUserToApp({ wallet: walletAPI, @@ -317,12 +332,16 @@ const ProposedBudgetDiscussion = () => { addChangesSavedAlert, }) } - startIcon={} + // startIcon={} data-testid='propose-a-budget-discussion-button' > Submit proposal for Cardano budget - {checkShowValidation(false, walletAPI, user) && ( + {checkShowValidation( + false, + walletAPI, + user + ) && ( { proposalsOwnerFilter?.id === ga?.id } + disabled={ + ga?.disabled + } /> } id={`${ga?.label}-radio`} diff --git a/pdf-ui/src/pages/ProposedGovernanceActions/SingleGovernanceAction/index.jsx b/pdf-ui/src/pages/ProposedGovernanceActions/SingleGovernanceAction/index.jsx index ad62ac7..095c9ed 100644 --- a/pdf-ui/src/pages/ProposedGovernanceActions/SingleGovernanceAction/index.jsx +++ b/pdf-ui/src/pages/ProposedGovernanceActions/SingleGovernanceAction/index.jsx @@ -1730,7 +1730,6 @@ const SingleGovernanceAction = ({ id }) => { - {/* OVDE */} { ? `You already liked this proposal` : 'Like this proposal\n\nClick to like this proposal' : 'Like this proposal\n\nClick to like this proposal' - : 'Like this proposal\n\nClick to like this proposal' + : 'Verify yourself to like this proposal' : 'Connect wallet to like this proposal'} } @@ -1792,6 +1791,14 @@ const SingleGovernanceAction = ({ id }) => { theme ) => `1px solid ${theme.palette.iconButton.outlineLightColor}`, + opacity: + checkShowValidation( + false, + walletAPI, + user + ) + ? 0.5 + : 1, }} data-testid='like-button' disabled={ @@ -1958,7 +1965,7 @@ const SingleGovernanceAction = ({ id }) => { ? `You already disliked this proposal` : 'Dislike this proposal\n\nClick to dislike this proposal' : 'Dislike this proposal\n\nClick to dislike this proposal' - : 'Dislike this proposal\n\nClick to dislike this proposal' + : 'Verify yourself to dislike this proposal' : 'Connect wallet to dislike this proposal'} } @@ -1970,6 +1977,14 @@ const SingleGovernanceAction = ({ id }) => { theme ) => `1px solid ${theme.palette.iconButton.outlineLightColor}`, + opacity: + checkShowValidation( + false, + walletAPI, + user + ) + ? 0.5 + : 1, }} data-testid='dislike-button' disabled={ diff --git a/pdf-ui/src/pages/ProposedGovernanceActions/index.jsx b/pdf-ui/src/pages/ProposedGovernanceActions/index.jsx index 4524000..dfc46f8 100644 --- a/pdf-ui/src/pages/ProposedGovernanceActions/index.jsx +++ b/pdf-ui/src/pages/ProposedGovernanceActions/index.jsx @@ -281,7 +281,7 @@ const ProposedGovernanceActions = () => { addChangesSavedAlert, }) } - startIcon={} + // startIcon={} data-testid='propose-a-governance-action-button' > Propose a Governance Action From 3b8aa7a1baad6a979f29fd92e8ad8fe484c4efdf Mon Sep 17 00:00:00 2001 From: Milos Mihajlovic Date: Wed, 18 Jun 2025 11:53:20 +0200 Subject: [PATCH 20/25] feat: Add data-testId attributes to wallet and user verification links for improved testing --- pdf-ui/src/components/UserValidation/UserValidation.jsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pdf-ui/src/components/UserValidation/UserValidation.jsx b/pdf-ui/src/components/UserValidation/UserValidation.jsx index aef244a..9a11af7 100644 --- a/pdf-ui/src/components/UserValidation/UserValidation.jsx +++ b/pdf-ui/src/components/UserValidation/UserValidation.jsx @@ -233,7 +233,7 @@ const UserValidation = ({ const showValidationMessage = useMemo(() => { if (!walletAPI) { return ( - + connect a Cardano wallet ); @@ -241,7 +241,7 @@ const UserValidation = ({ if (!user) { return ( - + verify yourself by signing a transaction ); @@ -249,14 +249,14 @@ const UserValidation = ({ if (!user?.user?.govtool_username) { return ( - + create a GovTool Display Name ); } if (drepRequired && drepCheck) { return ( - + verify your status as a DRep. ); From 102b5c4e6d124ec6ef28179c1eb04fbfd269073c Mon Sep 17 00:00:00 2001 From: Milos Mihajlovic Date: Wed, 18 Jun 2025 11:57:34 +0200 Subject: [PATCH 21/25] fix conflict --- pdf-ui/package.json | 4 ---- 1 file changed, 4 deletions(-) diff --git a/pdf-ui/package.json b/pdf-ui/package.json index 3d34f3f..b34961e 100644 --- a/pdf-ui/package.json +++ b/pdf-ui/package.json @@ -1,10 +1,6 @@ { "name": "@intersect.mbo/pdf-ui", -<<<<<<< fix/-Move-verification-modal-in-Proposals-to-better-places-(#3549) "version": "1.0.1-beta", -======= - "version": "1.0.1-alfa", ->>>>>>> dev "description": "Proposal discussion ui", "main": "./src/index.js", "exports": { From 86c0674560c25fa362c75f45ae836f13b789e72f Mon Sep 17 00:00:00 2001 From: Milos Mihajlovic Date: Wed, 18 Jun 2025 14:29:45 +0200 Subject: [PATCH 22/25] feat: Update changelog for version 1.0.2-alfa and enhance user validation in Budget Discussion components --- pdf-ui/CHANGELOG.md | 7 +- pdf-ui/package.json | 6 +- .../components/BudgetDiscussionPoll/index.jsx | 191 ++++++++++-------- pdf-ui/src/components/GlobalWrapper.jsx | 16 +- .../UserValidation/UserValidation.jsx | 58 ++++-- .../SingleBudgetDiscussion/index.jsx | 49 ++--- .../SingleGovernanceAction/index.jsx | 55 ++--- 7 files changed, 214 insertions(+), 168 deletions(-) diff --git a/pdf-ui/CHANGELOG.md b/pdf-ui/CHANGELOG.md index 607be5c..fee6bc2 100644 --- a/pdf-ui/CHANGELOG.md +++ b/pdf-ui/CHANGELOG.md @@ -7,14 +7,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 As a minor extension, we also keep a semantic version for the `UNRELEASED` changes. -<<<<<<< fix/-Move-verification-modal-in-Proposals-to-better-places-(#3549) +## [v1.0.2-alfa](https://www.npmjs.com/package/@intersect.mbo/pdf-ui/v/1.0.2-alfa) 2025-06-18 +- Change login + ## [v1.0.0-beta](https://www.npmjs.com/package/@intersect.mbo/pdf-ui/v/1.0.1-beta) 2025-06-18 - Change login - Fix Invalid Link Validation Bypassed in Proposal Creation via UI and API #3715 -======= + ## [v1.0.1-alfa](https://www.npmjs.com/package/@intersect.mbo/pdf-ui/v/1.0.1-alfa) 2025-06-12 - Change: User verification mechanism changed to follow process ->>>>>>> dev ## [v1.0.0-beta](https://www.npmjs.com/package/@intersect.mbo/pdf-ui/v/1.0.0-beta) 2025-06-11 - Fix Hard Fork Proposal type diff --git a/pdf-ui/package.json b/pdf-ui/package.json index 3d34f3f..f37f98a 100644 --- a/pdf-ui/package.json +++ b/pdf-ui/package.json @@ -1,10 +1,6 @@ { "name": "@intersect.mbo/pdf-ui", -<<<<<<< fix/-Move-verification-modal-in-Proposals-to-better-places-(#3549) - "version": "1.0.1-beta", -======= - "version": "1.0.1-alfa", ->>>>>>> dev + "version": "1.0.2-alfa", "description": "Proposal discussion ui", "main": "./src/index.js", "exports": { diff --git a/pdf-ui/src/components/BudgetDiscussionPoll/index.jsx b/pdf-ui/src/components/BudgetDiscussionPoll/index.jsx index 0f84dd3..ed76c88 100644 --- a/pdf-ui/src/components/BudgetDiscussionPoll/index.jsx +++ b/pdf-ui/src/components/BudgetDiscussionPoll/index.jsx @@ -155,6 +155,31 @@ const BudgetDiscussionPoll = ({ } }, [user, poll]); + user && + userPollVote && + poll?.attributes?.is_poll_active && + (walletAPI?.voter?.isRegisteredAsDRep || + walletAPI?.voter?.isRegisteredAsSoleVoter) && + jwtData?.dRepID; + + console.log('user', user); + console.log('userPollVote', userPollVote); + console.log('poll', poll?.attributes?.is_poll_active); + console.log('walletAPI', walletAPI?.voter?.isRegisteredAsDRep); + console.log('walletAPI', walletAPI?.voter?.isRegisteredAsSoleVoter); + console.log('jwtData', jwtData); + console.log('jwtData.dRepID', jwtData?.dRepID); + + console.log( + 'log', + user && + userPollVote && + poll?.attributes?.is_poll_active && + (walletAPI?.voter?.isRegisteredAsDRep || + walletAPI?.voter?.isRegisteredAsSoleVoter) && + jwtData?.dRepID + ); + if (poll) { return ( <> @@ -217,93 +242,95 @@ const BudgetDiscussionPoll = ({ - {/* {proposalAuthorUsername ? ( - - @{proposalAuthorUsername} - - ) : null} */} - {/* theme.palette.text.grey, - }} - mt={2} - > - {formatDateWithOffset( - new Date(poll?.attributes?.createdAt), - 0, - 'dd/MM/yyyy - p', - 'UTC' - )} - - - Poll Results - - - Do you support this proposal to be included in the - next Cardano Budget? - */} Should this proposal be included in the next Cardano Budget? - {checkShowValidation(true, walletAPI, user) ? ( - - ) : ( - - - - - )} + {!(user && + userPollVote && + poll?.attributes?.is_poll_active && + (walletAPI?.voter?.isRegisteredAsDRep || + walletAPI?.voter + ?.isRegisteredAsSoleVoter) && + jwtData?.dRepID) && ( + + {checkShowValidation( + true, + walletAPI, + user + ) ? ( + + ) : ( + + + + + )} + + )} { }, [GovToolAddChangesSavedAlert]); useEffect(() => { - if (!mounted) { - setMounted(true); - } else { - handleLogin(false); + if (!user) { + if (!mounted) { + setMounted(true); + } else { + handleLogin(false); + } } - }, [ - GovToolAssemblyWalletAPI?.address, - mounted, - props?.walletAPI - ]); + }, [GovToolAssemblyWalletAPI?.address, mounted, props?.walletAPI]); useEffect(() => { if (GovToolAssemblyLocale) { diff --git a/pdf-ui/src/components/UserValidation/UserValidation.jsx b/pdf-ui/src/components/UserValidation/UserValidation.jsx index 9a11af7..267b3c1 100644 --- a/pdf-ui/src/components/UserValidation/UserValidation.jsx +++ b/pdf-ui/src/components/UserValidation/UserValidation.jsx @@ -8,11 +8,10 @@ import { Typography, } from '@mui/material'; import React, { useMemo, useEffect, useState } from 'react'; -import { Link } from 'react-router-dom'; +import { Link } from '@mui/material'; import { IdentificationPage } from '../../pages'; import { useAppContext } from '../../context/context'; import { loginUserToApp } from '../../lib/helpers'; -import { use } from 'react'; import { clearSession, decodeJWT, @@ -100,6 +99,7 @@ const UserValidation = ({ addErrorAlert: GovToolAddErrorAlert, addSuccessAlert: GovToolAddSuccessAlert, addChangesSavedAlert: GovToolAddChangesSavedAlert, + // callBackFn: () => {}, }); } else { if ( @@ -223,8 +223,8 @@ const UserValidation = ({ return 'If this is your Proposal, to submit it, you need to'; case 'sentiment': return 'To show sentiment, you need to'; - case "drep-poll": - return "If you are a Drep, you need to" + case 'drep-poll': + return 'If you are a Drep, you need to'; default: return ''; } @@ -233,31 +233,53 @@ const UserValidation = ({ const showValidationMessage = useMemo(() => { if (!walletAPI) { return ( - - connect a Cardano wallet + + + connect a Cardano wallet + ); } if (!user) { return ( - - verify yourself by signing a transaction + + + verify yourself by signing a transaction + ); } if (!user?.user?.govtool_username) { return ( - - create a GovTool Display Name + + + create a GovTool Display Name + ); } if (drepRequired && drepCheck) { return ( - - verify your status as a DRep. + + + verify your status as a DRep. + ); } @@ -279,15 +301,15 @@ const UserValidation = ({ flexWrap: 'wrap', gap: 0.5, marginTop: 0.3, + alignItems: 'center', }} > - - {checkTitleText(type)} - + {checkTitleText(type)} {showValidationMessage} - {type === "drep-poll" && !user && ( - - and Drep key to vote. This is a two step process for security. + {type === 'drep-poll' && !user && ( + + and Drep key to vote. This is a two step process for + security. )} diff --git a/pdf-ui/src/pages/BudgetDiscussion/SingleBudgetDiscussion/index.jsx b/pdf-ui/src/pages/BudgetDiscussion/SingleBudgetDiscussion/index.jsx index 993d375..663df7f 100644 --- a/pdf-ui/src/pages/BudgetDiscussion/SingleBudgetDiscussion/index.jsx +++ b/pdf-ui/src/pages/BudgetDiscussion/SingleBudgetDiscussion/index.jsx @@ -28,9 +28,10 @@ import { Tooltip, Typography, alpha, + Link, } from '@mui/material'; import { useEffect, useState, useRef } from 'react'; -import { useNavigate, useLocation, Link } from 'react-router-dom'; +import { useNavigate, useLocation } from 'react-router-dom'; import { CommentCard, BudgetDiscussionPoll, @@ -1850,30 +1851,8 @@ const SingleBudgetDiscussion = ({ id }) => { justifyContent='space-between' > - Drep Poll + Poll of DRep sentiment - - - proposal?.attributes - ?.prop_comments_number === 0 - ? null - : setCommentsSortType((prev) => - prev === 'desc' ? 'asc' : 'desc' - ) - } - data-testid='sort-comments' - > - - {activePoll && @@ -1903,6 +1882,28 @@ const SingleBudgetDiscussion = ({ id }) => { Comments + + + proposal?.attributes + ?.prop_comments_number === 0 + ? null + : setCommentsSortType((prev) => + prev === 'desc' ? 'asc' : 'desc' + ) + } + data-testid='sort-comments' + > + + {proposal?.attributes?.content?.attributes ?.prop_submitted ? null : ( diff --git a/pdf-ui/src/pages/ProposedGovernanceActions/SingleGovernanceAction/index.jsx b/pdf-ui/src/pages/ProposedGovernanceActions/SingleGovernanceAction/index.jsx index 095c9ed..4328ad1 100644 --- a/pdf-ui/src/pages/ProposedGovernanceActions/SingleGovernanceAction/index.jsx +++ b/pdf-ui/src/pages/ProposedGovernanceActions/SingleGovernanceAction/index.jsx @@ -761,8 +761,7 @@ const SingleGovernanceAction = ({ id }) => { const balance = await fetchCurrentWalletBalance(); if ( - balance >= - 100000.18 + balance >= 10.18 ) { await loginUserToApp( { @@ -2136,31 +2135,11 @@ const SingleGovernanceAction = ({ id }) => { alignItems='center' justifyContent='space-between' > - - Polls - - - - proposal?.attributes - ?.prop_comments_number === 0 - ? null - : setCommentsSortType((prev) => - prev === 'desc' ? 'asc' : 'desc' - ) - } - data-testid='sort-comments' - > - - + {activePoll && ( + + Polls + + )} {proposal?.attributes?.content?.attributes ?.prop_submitted ? null : user && @@ -2258,6 +2237,28 @@ const SingleGovernanceAction = ({ id }) => { Comments + + + proposal?.attributes + ?.prop_comments_number === 0 + ? null + : setCommentsSortType((prev) => + prev === 'desc' ? 'asc' : 'desc' + ) + } + data-testid='sort-comments' + > + + {proposal?.attributes?.content?.attributes ?.prop_submitted ? null : ( From 583215e82d8d239c7f5d1391a8e2e512b29382cb Mon Sep 17 00:00:00 2001 From: nebojsajsimic <6024893+nebojsajsimic@users.noreply.github.com> Date: Thu, 19 Jun 2025 00:25:35 +0200 Subject: [PATCH 23/25] Fix submit to ga button Added pointer to links --- pdf-ui/CHANGELOG.md | 4 + pdf-ui/package-lock.json | 2 +- pdf-ui/package.json | 2 +- .../UserValidation/UserValidation.jsx | 4 + .../SingleBudgetDiscussion/index.jsx | 1 + .../SingleGovernanceAction/index.jsx | 74 ++++++++++++------- 6 files changed, 58 insertions(+), 29 deletions(-) diff --git a/pdf-ui/CHANGELOG.md b/pdf-ui/CHANGELOG.md index fee6bc2..b2bd466 100644 --- a/pdf-ui/CHANGELOG.md +++ b/pdf-ui/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 As a minor extension, we also keep a semantic version for the `UNRELEASED` changes. +## [v1.0.2-beta](https://www.npmjs.com/package/@intersect.mbo/pdf-ui/v/1.0.2-beta) 2025-06-19 +- Fix submit to ga button +- Added pointer to links + ## [v1.0.2-alfa](https://www.npmjs.com/package/@intersect.mbo/pdf-ui/v/1.0.2-alfa) 2025-06-18 - Change login diff --git a/pdf-ui/package-lock.json b/pdf-ui/package-lock.json index f396baf..effa204 100644 --- a/pdf-ui/package-lock.json +++ b/pdf-ui/package-lock.json @@ -1,6 +1,6 @@ { "name": "@intersect.mbo/pdf-ui", - "version": "1.0.1-alfa", + "version": "1.0.2-beta", "lockfileVersion": 3, "requires": true, "packages": { diff --git a/pdf-ui/package.json b/pdf-ui/package.json index f37f98a..a5709fa 100644 --- a/pdf-ui/package.json +++ b/pdf-ui/package.json @@ -1,6 +1,6 @@ { "name": "@intersect.mbo/pdf-ui", - "version": "1.0.2-alfa", + "version": "1.0.2-beta", "description": "Proposal discussion ui", "main": "./src/index.js", "exports": { diff --git a/pdf-ui/src/components/UserValidation/UserValidation.jsx b/pdf-ui/src/components/UserValidation/UserValidation.jsx index 267b3c1..fd88658 100644 --- a/pdf-ui/src/components/UserValidation/UserValidation.jsx +++ b/pdf-ui/src/components/UserValidation/UserValidation.jsx @@ -236,6 +236,7 @@ const UserValidation = ({ connect a Cardano wallet @@ -250,6 +251,7 @@ const UserValidation = ({ variant='caption' onClick={checkFunctionCall} data-testId='verify-user-link' + sx={{ cursor: 'pointer' }} > verify yourself by signing a transaction @@ -264,6 +266,7 @@ const UserValidation = ({ variant='caption' onClick={checkFunctionCall} data-testId='create-govtool-display-name-link' + sx={{ cursor: 'pointer' }} > create a GovTool Display Name @@ -276,6 +279,7 @@ const UserValidation = ({ verify your status as a DRep. diff --git a/pdf-ui/src/pages/BudgetDiscussion/SingleBudgetDiscussion/index.jsx b/pdf-ui/src/pages/BudgetDiscussion/SingleBudgetDiscussion/index.jsx index 663df7f..5378ac5 100644 --- a/pdf-ui/src/pages/BudgetDiscussion/SingleBudgetDiscussion/index.jsx +++ b/pdf-ui/src/pages/BudgetDiscussion/SingleBudgetDiscussion/index.jsx @@ -906,6 +906,7 @@ const SingleBudgetDiscussion = ({ id }) => { handleOpenReviewVersions() } data-testid='review-version' + sx={{ cursor: 'pointer' }} > Review Versions diff --git a/pdf-ui/src/pages/ProposedGovernanceActions/SingleGovernanceAction/index.jsx b/pdf-ui/src/pages/ProposedGovernanceActions/SingleGovernanceAction/index.jsx index 4328ad1..c37d9ba 100644 --- a/pdf-ui/src/pages/ProposedGovernanceActions/SingleGovernanceAction/index.jsx +++ b/pdf-ui/src/pages/ProposedGovernanceActions/SingleGovernanceAction/index.jsx @@ -127,7 +127,6 @@ const SingleGovernanceAction = ({ id }) => { }); } }; - useEffect(() => { let domain = new URL(window.location.href); let origin = domain.origin; @@ -746,16 +745,18 @@ const SingleGovernanceAction = ({ id }) => { xs={2} display='flex' justifyContent='flex-end' - > + > {user && + proposal?.attributes?.content?.attributes?.prop_submitted === false && + //proposal?.attributes?.prop_submitted && user?.user?.id?.toString() === proposal?.attributes?.user_id?.toString() ? (