Skip to content

Commit

Permalink
chore: sanity lesson fields read only in Studio
Browse files Browse the repository at this point in the history
  • Loading branch information
joelhooks committed Dec 2, 2024
1 parent 952bd04 commit d6f37ee
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
5 changes: 5 additions & 0 deletions studio/schemas/documents/lesson.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 &&
Expand All @@ -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',
Expand All @@ -37,6 +39,7 @@ export default defineType({
defineField({
title: 'Rails Lesson ID',
description: 'Rails lesson id',
readOnly: true,
name: 'railsLessonId',
type: 'number',
}),
Expand Down Expand Up @@ -100,6 +103,7 @@ export default defineType({
title: 'Status',
name: 'status',
type: 'string',
readOnly: true,
options: {
list: [
{title: 'Needs Review', value: 'needs-review'},
Expand All @@ -113,6 +117,7 @@ export default defineType({
title: 'Access Level',
name: 'accessLevel',
type: 'string',
readOnly: true,
options: {
list: [
{title: 'Free', value: 'free'},
Expand Down

0 comments on commit d6f37ee

Please sign in to comment.