From 4e933e2ae5eae5c6aaeee5e1c42a340eccc1e605 Mon Sep 17 00:00:00 2001 From: Florent Lagrede Date: Thu, 31 Oct 2024 17:01:43 +0100 Subject: [PATCH] feat: add compliance credits to project object (#68) * feat: add compliance credits to project object * feat: add complianceCredits and terrasos project types * fix: structure --- deskStructure.js | 4 +++ schemas/documents/shared/project.js | 3 ++- schemas/documents/terrasos/terrasosProject.js | 15 +++++++++++ schemas/objects/complianceCredits.js | 25 +++++++++++++++++++ schemas/schema.js | 4 +++ 5 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 schemas/documents/terrasos/terrasosProject.js create mode 100644 schemas/objects/complianceCredits.js diff --git a/deskStructure.js b/deskStructure.js index 523ac90..f71f314 100644 --- a/deskStructure.js +++ b/deskStructure.js @@ -344,6 +344,10 @@ export default S => .title('Tebu Banner') .schemaType('tebuBanner') .child(S.document().schemaType('tebuBanner')), + S.listItem() + .title('Terrasos Project') + .schemaType('terrasosProject') + .child(S.documentTypeList('terrasosProject').title('Terrasos Project')), ]), ), ]); diff --git a/schemas/documents/shared/project.js b/schemas/documents/shared/project.js index 90b0474..2526e3d 100644 --- a/schemas/documents/shared/project.js +++ b/schemas/documents/shared/project.js @@ -7,7 +7,8 @@ export default { title: 'Project slug, on-chain id or off-chain uuid', name: 'projectId', type: 'string', - description: 'Slug should be the prefered option if the project has a slug, otherwise it might result in the data below not being displayed on the project page.', + description: + 'Slug should be the prefered option if the project has a slug, otherwise it might result in the data below not being displayed on the project page.', validation: Rule => Rule.required(), }, { diff --git a/schemas/documents/terrasos/terrasosProject.js b/schemas/documents/terrasos/terrasosProject.js new file mode 100644 index 0000000..ffe83f5 --- /dev/null +++ b/schemas/documents/terrasos/terrasosProject.js @@ -0,0 +1,15 @@ +import sharedProject from '../shared/project'; + +export default { + name: 'terrasosProject', + title: 'Terrasos Project', + type: 'document', + fields: [ + ...sharedProject.fields, + { + title: 'Compliance credits', + name: 'complianceCredits', + type: 'complianceCredits', + }, + ], +}; diff --git a/schemas/objects/complianceCredits.js b/schemas/objects/complianceCredits.js new file mode 100644 index 0000000..5e582cf --- /dev/null +++ b/schemas/objects/complianceCredits.js @@ -0,0 +1,25 @@ +export default { + type: 'object', + name: 'complianceCredits', + title: 'Compliance Credits', + fields: [ + { + title: 'Credits Registered', + name: 'creditsRegistered', + type: 'number', + validation: Rule => Rule.required(), + }, + { + title: 'Credits Available', + name: 'creditsAvailable', + type: 'number', + validation: Rule => Rule.required(), + }, + { + title: 'Credits Retired', + name: 'creditsRetired', + type: 'number', + validation: Rule => Rule.required(), + }, + ], +}; diff --git a/schemas/schema.js b/schemas/schema.js index 336e774..2b10dba 100644 --- a/schemas/schema.js +++ b/schemas/schema.js @@ -65,6 +65,7 @@ import walletAddressRegistrationPage from './documents/www/walletAddressRegistra import nctPage from './documents/www/nctPage'; import creditCategory from './documents/shared/creditCategory'; import tebuBanner from './documents/terrasos/tebuBanner'; +import terrasosProject from './documents/terrasos/terrasosProject'; export const documentsSchemas = [ homePage, @@ -131,6 +132,7 @@ export const documentsSchemas = [ nctPage, creditCategory, tebuBanner, + terrasosProject, ]; // Object types @@ -271,6 +273,7 @@ import prefinanceProjects from './objects/prefinanceProjects'; import createProjectPagePopup from './objects/createProjectPagePopup'; import sellOrderPrice from './objects/sellOrderPrice'; import linkItem from './objects/linkItem'; +import complianceCredits from './objects/complianceCredits'; export const objectSchemas = [ heroSection, @@ -410,6 +413,7 @@ export const objectSchemas = [ createProjectPagePopup, sellOrderPrice, linkItem, + complianceCredits, ]; export default [