From 87acbcfdf4c0d115c42ad04e950669c28c7c66a5 Mon Sep 17 00:00:00 2001 From: Marcus Aurelius Date: Fri, 27 Dec 2024 17:50:50 -0500 Subject: [PATCH 1/7] Add hosted file type for projects --- carbon-projects/schemas/index.ts | 2 ++ carbon-projects/schemas/objects/hostedFile.ts | 35 +++++++++++++++++++ carbon-projects/schemas/project.ts | 7 ++++ 3 files changed, 44 insertions(+) create mode 100644 carbon-projects/schemas/objects/hostedFile.ts diff --git a/carbon-projects/schemas/index.ts b/carbon-projects/schemas/index.ts index 2d9e074d8c..d5bd05d104 100644 --- a/carbon-projects/schemas/index.ts +++ b/carbon-projects/schemas/index.ts @@ -3,6 +3,7 @@ import indexContent from "./indexContent"; import methodology from "./methodology"; import captionImage from "./objects/captionImage"; import externalFile from "./objects/externalFile"; +import hostedFile from "./objects/hostedFile"; import project from "./project"; import projectContent from "./projectContent"; export const schemaTypes = [ @@ -10,6 +11,7 @@ export const schemaTypes = [ methodology, projectContent, externalFile, + hostedFile, captionImage, country, indexContent, diff --git a/carbon-projects/schemas/objects/hostedFile.ts b/carbon-projects/schemas/objects/hostedFile.ts new file mode 100644 index 0000000000..797e1844bb --- /dev/null +++ b/carbon-projects/schemas/objects/hostedFile.ts @@ -0,0 +1,35 @@ +import { defineType } from "sanity"; + +export default defineType({ + name: "hostedFile", + type: "file", + title: "Hosted file", + description: "A file whose content is hosted directly in the Sanity CMS, with associated metadata", + fields: [ + { + type: "string", + title: "File name", + name: "filename", + }, + { + type: "string", + title: "Description or Caption", + name: "description", + }, + { + type: "string", + title: "MIME Type", + name: "mimetype", + }, + { + type: "string", + title: "File category", + name: "category" + }, + { + type: "number", + title: "File size", + name: "size" + } + ], +}); diff --git a/carbon-projects/schemas/project.ts b/carbon-projects/schemas/project.ts index 7a142ca1e1..b798ac4ec8 100644 --- a/carbon-projects/schemas/project.ts +++ b/carbon-projects/schemas/project.ts @@ -250,5 +250,12 @@ export default defineType({ type: "array", of: [{ type: "externalFile" }], }), + defineField({ + name: "hostedDocuments", + description: "PDF documents hosted in this CMS associated with this project", + group: "media", + type: "array", + of: [{ type: "hostedFile" }], + }), ], }); From 98055c2cae534e62ee4e6a67a18555df6df1bb14 Mon Sep 17 00:00:00 2001 From: Marcus Aurelius Date: Mon, 13 Jan 2025 13:54:20 -0500 Subject: [PATCH 2/7] Additional fields for DCI --- carbon-projects/lib/sectors.ts | 3 + carbon-projects/schemas/assessor.ts | 47 ++++++++++ carbon-projects/schemas/developer.ts | 44 +++++++++ carbon-projects/schemas/index.ts | 6 ++ carbon-projects/schemas/methodology.ts | 9 +- carbon-projects/schemas/objects/hostedFile.ts | 9 +- carbon-projects/schemas/project.ts | 89 +++++++++++++++++-- carbon-projects/schemas/standard.ts | 36 ++++++++ 8 files changed, 229 insertions(+), 14 deletions(-) create mode 100644 carbon-projects/lib/sectors.ts create mode 100644 carbon-projects/schemas/assessor.ts create mode 100644 carbon-projects/schemas/developer.ts create mode 100644 carbon-projects/schemas/standard.ts diff --git a/carbon-projects/lib/sectors.ts b/carbon-projects/lib/sectors.ts new file mode 100644 index 0000000000..9f3c1c52c2 --- /dev/null +++ b/carbon-projects/lib/sectors.ts @@ -0,0 +1,3 @@ +export const sectors = [ + { title: "Waste handling and disposal", value: "waste-h-d" } +]; diff --git a/carbon-projects/schemas/assessor.ts b/carbon-projects/schemas/assessor.ts new file mode 100644 index 0000000000..f5c78ba5e3 --- /dev/null +++ b/carbon-projects/schemas/assessor.ts @@ -0,0 +1,47 @@ +import { defineType } from "sanity"; + +export default defineType({ + name: "assessor", + title: "Assessor", + description: "Information about an organization that assesses projects", + description: + "A profile containing information about an entity including name, avatar, and link", + type: "document", + preview: { + select: { + name: "name", + }, + prepare(selection) { + return { + title: selection.name || "", + }; + }, + }, + fields: [ + { + type: "string", + title: "Name", + name: "name", + validation: (r) => r.required(), + }, + { + type: "string", + title: "Link", + name: "link", + }, + { + type: "image", + title: "Avatar", + name: "avatar", + }, + { + type: "array", + title: "Accreditations", + name: "accreditations", + of: [ + { type: "string", name: "name" }, + { type: "string", name: "link" }, + ], + }, + ], +}); diff --git a/carbon-projects/schemas/developer.ts b/carbon-projects/schemas/developer.ts new file mode 100644 index 0000000000..055efe1603 --- /dev/null +++ b/carbon-projects/schemas/developer.ts @@ -0,0 +1,44 @@ +import { defineType } from "sanity"; + +export default defineType({ + name: "developer", + title: "Developer", + description: "Information about an organization that develops projects", + description: + "A profile containing information about an entity including name, avatar, and link", + type: "document", + preview: { + select: { + name: "name", + }, + prepare(selection) { + return { + title: selection.name || "", + }; + }, + }, + fields: [ + { + type: "string", + title: "Name", + name: "name", + validation: (r) => r.required(), + }, + { + type: "string", + title: "Link", + name: "link", + }, + { + type: "image", + title: "Avatar", + name: "avatar", + }, + { + type: "array", + title: "Carbonmark Handles", + name: "handles", + of: [{ type: "string" }], + }, + ], +}); diff --git a/carbon-projects/schemas/index.ts b/carbon-projects/schemas/index.ts index d5bd05d104..88c2294fde 100644 --- a/carbon-projects/schemas/index.ts +++ b/carbon-projects/schemas/index.ts @@ -1,4 +1,6 @@ +import assessor from "./assessor"; import country from "./country"; +import developer from "./developer"; import indexContent from "./indexContent"; import methodology from "./methodology"; import captionImage from "./objects/captionImage"; @@ -6,6 +8,7 @@ import externalFile from "./objects/externalFile"; import hostedFile from "./objects/hostedFile"; import project from "./project"; import projectContent from "./projectContent"; +import standard from "./standard"; export const schemaTypes = [ project, methodology, @@ -15,4 +18,7 @@ export const schemaTypes = [ captionImage, country, indexContent, + assessor, + developer, + standard, ]; diff --git a/carbon-projects/schemas/methodology.ts b/carbon-projects/schemas/methodology.ts index 8783dcea3b..4ba78a9a1d 100644 --- a/carbon-projects/schemas/methodology.ts +++ b/carbon-projects/schemas/methodology.ts @@ -1,12 +1,12 @@ import { defineField, defineType } from "sanity"; import { categories } from "../lib/categories"; +import { sectors } from "../lib/sectors"; export default defineType({ name: "methodology", title: "Methodology", description: "Methodology definition", type: "document", - groups: [{ name: "location" }], preview: { select: { slug: "id", @@ -43,6 +43,13 @@ export default defineType({ }, validation: (r) => r.required(), }), + defineField({ + name: "sector", + type: "string", + options: { + list: sectors, + }, + }), defineField({ name: "link", type: "string", diff --git a/carbon-projects/schemas/objects/hostedFile.ts b/carbon-projects/schemas/objects/hostedFile.ts index 797e1844bb..3c25ec15df 100644 --- a/carbon-projects/schemas/objects/hostedFile.ts +++ b/carbon-projects/schemas/objects/hostedFile.ts @@ -4,7 +4,8 @@ export default defineType({ name: "hostedFile", type: "file", title: "Hosted file", - description: "A file whose content is hosted directly in the Sanity CMS, with associated metadata", + description: + "A file whose content is hosted directly in the Sanity CMS, with associated metadata", fields: [ { type: "string", @@ -24,12 +25,12 @@ export default defineType({ { type: "string", title: "File category", - name: "category" + name: "category", }, { type: "number", title: "File size", - name: "size" - } + name: "size", + }, ], }); diff --git a/carbon-projects/schemas/project.ts b/carbon-projects/schemas/project.ts index b798ac4ec8..935b737a2d 100644 --- a/carbon-projects/schemas/project.ts +++ b/carbon-projects/schemas/project.ts @@ -11,6 +11,16 @@ const ccbs = [ { title: "CCB Community Gold", value: "CCB-Community Gold" }, ]; +const registries = [ + { title: "Verra", value: "VCS" }, + { title: "Gold Standard", value: "GS" }, + { title: "EcoRegistry", value: "ECO" }, + { title: "International Carbon Registry", value: "ICR" }, + { title: "Puro", value: "PUR" }, + { title: "J-Credit", value: "JCS" }, + { title: "Carbonmark Direct Issuance", value: "CMARK" }, +]; + const subcategories = [ { title: "Solar Energy", value: "solar" }, { title: "Wind Energy", value: "wind" }, @@ -21,6 +31,20 @@ const subcategories = [ { title: "Mangrove Restoration", value: "mangroves" }, ]; +const statuses = [ + { title: "Registered", value: "registered" }, + { title: "Validated", value: "validated" }, + { title: "Verified", value: "verified" }, + { title: "Withdrawn", value: "withdrawn" }, +]; + +const types = [ + { title: "Avoidance", value: "avoidance" }, + { title: "Reduction", value: "reduction" }, + { title: "Removal", value: "removal" }, + { title: "Hybrid", value: "hybrid" }, +]; + export default defineType({ name: "project", title: "Project", @@ -71,14 +95,7 @@ export default defineType({ placeholder: "VCS", type: "string", options: { - list: [ - { title: "Verra", value: "VCS" }, - { title: "Gold Standard", value: "GS" }, - { title: "EcoRegistry", value: "ECO" }, - { title: "International Carbon Registry", value: "ICR" }, - { title: "Puro", value: "PUR" }, - { title: "J-Credit", value: "JCS" }, - ], + list: registries, }, validation: (r) => r.required(), }, @@ -117,6 +134,52 @@ export default defineType({ return true; }), }), + defineField({ + type: "reference", + name: "developer", + to: [{ type: "developer" }], + description: "The developer of this project", + group: "info", + }), + defineField({ + type: "reference", + name: "assessor", + to: [{ type: "assessor" }], + description: "The assessor of this project", + group: "info", + }), + defineField({ + type: "array", + name: "standards", + of: [ + { + type: "reference", + to: [{ type: "standard" }], + }, + ], + description: "Standards with which the project conforms", + group: "info", + }), + { + name: "status", + description: + "Project status. Indicates where a project is in its lifecycle from registration to verification and issuance", + group: "info", + type: "string", + options: { + list: statuses, + }, + }, + { + name: "type", + description: + "Project type. Indicates whether a project avoids or removes emissions, or both.", + group: "info", + type: "string", + options: { + list: types, + }, + }, defineField({ type: "array", name: "methodologies", @@ -146,11 +209,18 @@ export default defineType({ defineField({ name: "subcategory", description: "From our predefined ontology of subcategories", + group: "info", type: "string", options: { list: subcategories, }, }), + defineField({ + name: "estAnnualMitigations", + description: "Estimated tonnes of carbon emissions mitigated per annum", + group: "info", + type: "number", + }), { name: "region", description: "Region where the project was implemented", @@ -252,7 +322,8 @@ export default defineType({ }), defineField({ name: "hostedDocuments", - description: "PDF documents hosted in this CMS associated with this project", + description: + "PDF documents hosted in this CMS associated with this project", group: "media", type: "array", of: [{ type: "hostedFile" }], diff --git a/carbon-projects/schemas/standard.ts b/carbon-projects/schemas/standard.ts new file mode 100644 index 0000000000..9a9692e6d4 --- /dev/null +++ b/carbon-projects/schemas/standard.ts @@ -0,0 +1,36 @@ +import { defineType } from "sanity"; + +export default defineType({ + name: "standard", + title: "Standard", + description: "Information about a standard that applies to projects", + type: "document", + preview: { + select: { + name: "name", + }, + prepare(selection) { + return { + title: selection.name || "", + }; + }, + }, + fields: [ + { + type: "string", + title: "Name", + name: "name", + validation: (r) => r.required(), + }, + { + type: "string", + title: "Link", + name: "link", + }, + { + type: "image", + title: "Logo", + name: "logo", + }, + ], +}); From 6d0fec9e09f2c980b4a00c8cacd5504fe31f8ec6 Mon Sep 17 00:00:00 2001 From: Marcus Aurelius Date: Mon, 13 Jan 2025 16:07:02 -0500 Subject: [PATCH 3/7] Add CI step to build CMS --- .github/workflows/build_cms.yml | 53 +++++++++++++++++++++++++++++++++ carbon-projects/lib/sectors.ts | 2 +- 2 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/build_cms.yml diff --git a/.github/workflows/build_cms.yml b/.github/workflows/build_cms.yml new file mode 100644 index 0000000000..4a77a076ad --- /dev/null +++ b/.github/workflows/build_cms.yml @@ -0,0 +1,53 @@ +name: Build Sanity CMS + +on: + push: + paths: + - "carbon-projects/**" + branches: "*" + pull_request: + paths: + - "carbon-projects/**" + branches: "*" +jobs: + build: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [18.x] + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + + # Explicit caching instead of using setup-node's built-in cache + - name: Cache node modules + uses: actions/cache@v3 + with: + path: carbon-projects/node_modules + key: ${{ runner.os }}-node-${{ hashFiles('carbon-projects/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- + + - name: Install dependencies + working-directory: ./carbon-projects + run: npm ci + + - name: Build Sanity studio + working-directory: ./carbon-projects + run: npm run build + env: + CI: true + + - name: Upload build artifacts + uses: actions/upload-artifact@v4 + with: + name: sanity-build + path: carbon-projects/dist + retention-days: 7 diff --git a/carbon-projects/lib/sectors.ts b/carbon-projects/lib/sectors.ts index 9f3c1c52c2..c523cdcbf3 100644 --- a/carbon-projects/lib/sectors.ts +++ b/carbon-projects/lib/sectors.ts @@ -1,3 +1,3 @@ export const sectors = [ - { title: "Waste handling and disposal", value: "waste-h-d" } + { title: "Waste handling and disposal", value: "waste-h-d" }, ]; From 7f47a479db3ab4180ccf57bb5a27f586d7732001 Mon Sep 17 00:00:00 2001 From: Marcus Aurelius Date: Tue, 14 Jan 2025 15:26:19 -0500 Subject: [PATCH 4/7] Add hosted media field --- carbon-projects/schemas/objects/hostedFile.ts | 5 +++-- carbon-projects/schemas/project.ts | 9 ++++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/carbon-projects/schemas/objects/hostedFile.ts b/carbon-projects/schemas/objects/hostedFile.ts index 3c25ec15df..997a368cd8 100644 --- a/carbon-projects/schemas/objects/hostedFile.ts +++ b/carbon-projects/schemas/objects/hostedFile.ts @@ -19,7 +19,8 @@ export default defineType({ }, { type: "string", - title: "MIME Type", + title: "MIME Type (e.g. application/pdf)", + description: "Reference: https://developer.mozilla.org/en-US/docs/Web/HTTP/MIME_types/Common_types", name: "mimetype", }, { @@ -29,7 +30,7 @@ export default defineType({ }, { type: "number", - title: "File size", + title: "File size (in bytes)", name: "size", }, ], diff --git a/carbon-projects/schemas/project.ts b/carbon-projects/schemas/project.ts index 935b737a2d..b21e49a67a 100644 --- a/carbon-projects/schemas/project.ts +++ b/carbon-projects/schemas/project.ts @@ -315,11 +315,18 @@ export default defineType({ }), defineField({ name: "externalDocuments", - description: "External PDF documents associated with this project", + description: "External documents (e.g. PDFs, Word documents) associated with this project", group: "media", type: "array", of: [{ type: "externalFile" }], }), + defineField({ + name: "hostedMedia", + description: "Media hosted in this CMS and associated captions", + group: "media", + type: "array", + of: [{ type: "captionImage" }], + }), defineField({ name: "hostedDocuments", description: From 2a40e9f9e305d5f9efd30cf01dbbb480700ca957 Mon Sep 17 00:00:00 2001 From: Marcus Aurelius Date: Wed, 15 Jan 2025 08:07:11 -0500 Subject: [PATCH 5/7] Fix formatting --- carbon-projects/schemas/objects/hostedFile.ts | 3 ++- carbon-projects/schemas/project.ts | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/carbon-projects/schemas/objects/hostedFile.ts b/carbon-projects/schemas/objects/hostedFile.ts index 997a368cd8..ab4e87fccd 100644 --- a/carbon-projects/schemas/objects/hostedFile.ts +++ b/carbon-projects/schemas/objects/hostedFile.ts @@ -20,7 +20,8 @@ export default defineType({ { type: "string", title: "MIME Type (e.g. application/pdf)", - description: "Reference: https://developer.mozilla.org/en-US/docs/Web/HTTP/MIME_types/Common_types", + description: + "Reference: https://developer.mozilla.org/en-US/docs/Web/HTTP/MIME_types/Common_types", name: "mimetype", }, { diff --git a/carbon-projects/schemas/project.ts b/carbon-projects/schemas/project.ts index b21e49a67a..9af649716a 100644 --- a/carbon-projects/schemas/project.ts +++ b/carbon-projects/schemas/project.ts @@ -315,7 +315,8 @@ export default defineType({ }), defineField({ name: "externalDocuments", - description: "External documents (e.g. PDFs, Word documents) associated with this project", + description: + "External documents (e.g. PDFs, Word documents) associated with this project", group: "media", type: "array", of: [{ type: "externalFile" }], From 4dd16482ba72f8c6bf052347f33d14288db6ec8b Mon Sep 17 00:00:00 2001 From: Marcus Aurelius Date: Wed, 15 Jan 2025 08:07:23 -0500 Subject: [PATCH 6/7] Pin NPM version in update translations action --- .github/workflows/update_translations.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/update_translations.yml b/.github/workflows/update_translations.yml index ffbec917a7..4d57e6095f 100644 --- a/.github/workflows/update_translations.yml +++ b/.github/workflows/update_translations.yml @@ -34,7 +34,10 @@ jobs: - name: Setup node uses: actions/setup-node@v4 with: - node-version-file: ".nvmrc" + # hard-coded to fix issue with this workflow + node-version: 20 + # caches until package-lock.json in the root is changed + cache: "npm" - name: Cache node_modules uses: actions/cache@v4 From 0b27e4d8e3cf8c35bbaa522227e4336add6ac190 Mon Sep 17 00:00:00 2001 From: Marcus Aurelius Date: Wed, 15 Jan 2025 12:47:24 -0500 Subject: [PATCH 7/7] Add full sector list, update accreditation and file category options --- carbon-projects/lib/fileCategories.ts | 6 ++ carbon-projects/lib/sectors.ts | 64 ++++++++++++++++++- carbon-projects/schemas/accreditation.ts | 36 +++++++++++ carbon-projects/schemas/assessor.ts | 8 +-- carbon-projects/schemas/developer.ts | 2 - carbon-projects/schemas/index.ts | 2 + carbon-projects/schemas/objects/hostedFile.ts | 4 ++ 7 files changed, 115 insertions(+), 7 deletions(-) create mode 100644 carbon-projects/lib/fileCategories.ts create mode 100644 carbon-projects/schemas/accreditation.ts diff --git a/carbon-projects/lib/fileCategories.ts b/carbon-projects/lib/fileCategories.ts new file mode 100644 index 0000000000..eb850e262a --- /dev/null +++ b/carbon-projects/lib/fileCategories.ts @@ -0,0 +1,6 @@ +export const fileCategories = [ + { title: "Methodology", value: "methodology" }, + { title: "Project Description Document (PDD)", value: "pdd" }, + { title: "Verifications", value: "verifications" }, + { title: "Supporting Documentation", value: "supporting-documentation" }, +]; diff --git a/carbon-projects/lib/sectors.ts b/carbon-projects/lib/sectors.ts index c523cdcbf3..4857c218a1 100644 --- a/carbon-projects/lib/sectors.ts +++ b/carbon-projects/lib/sectors.ts @@ -1,3 +1,65 @@ export const sectors = [ - { title: "Waste handling and disposal", value: "waste-h-d" }, + { + title: "Afforestation and reforestation", + value: "afforestation-and-reforestation", + }, + { + title: "Energy industries (renewable/non-renewable sources)", + value: "energy-industries-renewable-non-renewable-sources", + }, + { title: "Energy demand", value: "energy-demand" }, + { + title: "Agriculture; forestry and fishing", + value: "agriculture-forestry-and-fishing", + }, + { + title: "Waste handling and disposal", + value: "waste-handling-and-disposal", + }, + { + title: "Livestock, enteric fermentation, and manure management", + value: "livestock-enteric-fermentation-and-manure-management", + }, + { title: "Technical Removal", value: "technical-removal" }, + { title: "Afforestation", value: "afforestation" }, + { title: "Transport", value: "transport" }, + { + title: "Landfill Gas Capture/Combustion", + value: "landfill-gas-capture-combustion", + }, + { title: "Forestry", value: "forestry" }, + { title: "Energy Distribution", value: "energy-distribution" }, + { + title: + "Water supply; sewerage, waste management and remediation activities", + value: "water-supply-sewerage-waste-management-and-remediation-activities", + }, + { + title: "Electricity; gas, steam and air conditioning supply", + value: "electricity-gas-steam-and-air-conditioning-supply", + }, + { title: "Manufacturing", value: "manufacturing" }, + { title: "Transportation and storage", value: "transportation-and-storage" }, + { + title: "Fugitive emissions from fuel (solid, oil and gas)", + value: "fugitive-emissions-from-fuel-solid-oil-and-gas", + }, + { title: "Manufacturing industries", value: "manufacturing-industries" }, + { title: "Chemical industries", value: "chemical-industries" }, + { title: "Energy distribution", value: "energy-distribution" }, + { + title: + "Fugitive emissions from production and consumption of halocarbons and sulphur hexafluoride", + value: + "fugitive-emissions-from-production-and-consumption-of-halocarbons-and-sulphur-hexafluoride", + }, + { title: "Metal production", value: "metal-production" }, + { title: "Agriculture", value: "agriculture" }, + { title: "Mining/mineral production", value: "mining-mineral-production" }, + { title: "Construction", value: "construction" }, + { title: "Mining and quarrying", value: "mining-and-quarrying" }, + { + title: "Metal production (metallurgy)", + value: "metal-production-metallurgy", + }, ]; diff --git a/carbon-projects/schemas/accreditation.ts b/carbon-projects/schemas/accreditation.ts new file mode 100644 index 0000000000..3f0cf08180 --- /dev/null +++ b/carbon-projects/schemas/accreditation.ts @@ -0,0 +1,36 @@ +import { defineType } from "sanity"; + +export default defineType({ + name: "accreditation", + title: "Accreditation", + description: "Information about an accreditation that applies to assessors", + type: "document", + preview: { + select: { + name: "name", + }, + prepare(selection) { + return { + title: selection.name || "", + }; + }, + }, + fields: [ + { + type: "string", + title: "Name", + name: "name", + validation: (r) => r.required(), + }, + { + type: "string", + title: "Link", + name: "link", + }, + { + type: "image", + title: "Logo", + name: "logo", + }, + ], +}); diff --git a/carbon-projects/schemas/assessor.ts b/carbon-projects/schemas/assessor.ts index f5c78ba5e3..b29d897419 100644 --- a/carbon-projects/schemas/assessor.ts +++ b/carbon-projects/schemas/assessor.ts @@ -4,8 +4,6 @@ export default defineType({ name: "assessor", title: "Assessor", description: "Information about an organization that assesses projects", - description: - "A profile containing information about an entity including name, avatar, and link", type: "document", preview: { select: { @@ -39,8 +37,10 @@ export default defineType({ title: "Accreditations", name: "accreditations", of: [ - { type: "string", name: "name" }, - { type: "string", name: "link" }, + { + type: "reference", + to: [{ type: "accreditation" }], + }, ], }, ], diff --git a/carbon-projects/schemas/developer.ts b/carbon-projects/schemas/developer.ts index 055efe1603..9180ad3554 100644 --- a/carbon-projects/schemas/developer.ts +++ b/carbon-projects/schemas/developer.ts @@ -4,8 +4,6 @@ export default defineType({ name: "developer", title: "Developer", description: "Information about an organization that develops projects", - description: - "A profile containing information about an entity including name, avatar, and link", type: "document", preview: { select: { diff --git a/carbon-projects/schemas/index.ts b/carbon-projects/schemas/index.ts index 88c2294fde..3258e00efc 100644 --- a/carbon-projects/schemas/index.ts +++ b/carbon-projects/schemas/index.ts @@ -1,3 +1,4 @@ +import accreditation from "./accreditation"; import assessor from "./assessor"; import country from "./country"; import developer from "./developer"; @@ -18,6 +19,7 @@ export const schemaTypes = [ captionImage, country, indexContent, + accreditation, assessor, developer, standard, diff --git a/carbon-projects/schemas/objects/hostedFile.ts b/carbon-projects/schemas/objects/hostedFile.ts index ab4e87fccd..32bc602541 100644 --- a/carbon-projects/schemas/objects/hostedFile.ts +++ b/carbon-projects/schemas/objects/hostedFile.ts @@ -1,4 +1,5 @@ import { defineType } from "sanity"; +import { fileCategories } from "../../lib/fileCategories"; export default defineType({ name: "hostedFile", @@ -28,6 +29,9 @@ export default defineType({ type: "string", title: "File category", name: "category", + options: { + list: fileCategories, + }, }, { type: "number",