Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add hosted file type for projects #2410

Draft
wants to merge 1 commit into
base: staging
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions carbon-projects/schemas/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ 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 = [
project,
methodology,
projectContent,
externalFile,
hostedFile,
captionImage,
country,
indexContent,
Expand Down
35 changes: 35 additions & 0 deletions carbon-projects/schemas/objects/hostedFile.ts
Original file line number Diff line number Diff line change
@@ -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"
}
],
});
7 changes: 7 additions & 0 deletions carbon-projects/schemas/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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" }],
}),
],
});
Loading