From d6f37ee365d60dea655f68b3b16a5ca87dd84f7a Mon Sep 17 00:00:00 2001 From: joel Date: Mon, 2 Dec 2024 12:10:34 -0600 Subject: [PATCH] chore: sanity lesson fields read only in Studio --- package.json | 1 + studio/schemas/documents/lesson.ts | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/package.json b/package.json index 43b930f1dd..1b23c2a53e 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,7 @@ "dev:inngest": "pnpx inngest-cli@latest dev --no-discovery -u http://egghead.af:3000/api/inngest", "dev-build": "NODE_ENV=production next build", "sanity": "cd studio && sanity dev", + "sanity:deploy": "cd studio && sanity deploy", "prebuild": "pnpm make-tags-sitemap", "build": "pnpm dev-build", "postbuild": "NODE_ENV=production next-sitemap", diff --git a/studio/schemas/documents/lesson.ts b/studio/schemas/documents/lesson.ts index a1ed09fb16..065264ec33 100644 --- a/studio/schemas/documents/lesson.ts +++ b/studio/schemas/documents/lesson.ts @@ -13,6 +13,7 @@ export default defineType({ type: 'string', title: 'Title', description: 'Titles should be catchy, descriptive, and not too long', + readOnly: true, validation: (Rule) => Rule.custom((field, context) => context?.document?.status && @@ -26,6 +27,7 @@ export default defineType({ name: 'slug', type: 'slug', title: 'Slug', + readOnly: true, validation: (Rule) => Rule.required(), description: 'Some frontends will require a slug to be set to be able to show the post', @@ -37,6 +39,7 @@ export default defineType({ defineField({ title: 'Rails Lesson ID', description: 'Rails lesson id', + readOnly: true, name: 'railsLessonId', type: 'number', }), @@ -100,6 +103,7 @@ export default defineType({ title: 'Status', name: 'status', type: 'string', + readOnly: true, options: { list: [ {title: 'Needs Review', value: 'needs-review'}, @@ -113,6 +117,7 @@ export default defineType({ title: 'Access Level', name: 'accessLevel', type: 'string', + readOnly: true, options: { list: [ {title: 'Free', value: 'free'},