Last active
November 5, 2020 19:13
-
-
Save waspeer/f831dbb06ea59f8f8ca04575e1962cf3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { defineDocument } from 'sanity-typed-queries'; | |
const { section } = defineDocument( | |
'section', | |
{ | |
name: { | |
type: 'string', | |
title: 'Name', | |
validation: (Rule) => Rule.required(), | |
}, | |
pages: { | |
title: 'Pages', | |
type: 'array', | |
of: [{ type: 'reference', to: [{ type: 'page' }] }], | |
}, | |
}, | |
[page], | |
); | |
const { page } = defineDocument( | |
'page', | |
{ | |
name: { | |
type: 'string', | |
title: 'Name', | |
validation: (Rule) => Rule.required(), | |
}, | |
pages: { | |
title: 'Section', | |
type: 'reference', | |
to: [{ type: 'section' }], | |
}, | |
}, | |
[section], | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment