Data Relationship
Subject: Try to create data relationships in Sanity
Ship Ahoy Skill Builder!
One of my tiny tasks this week was:
– Try to create data relationships in Sanity
What did I do?
I was working on my personal website. I will be showing photos of Lillian’s projects and drawings. And I will be showing photos of my own projects and drawings
I tried to make a way to show what animals, minerals or vegetables are in Lillian’s projects and drawings. By creating data relationships in Sanity.
Why did I do it?
Why is adding Lillian’s projects and drawings to my website making my skill building better?
First, let’s look for some facts.
Fact searching questions
- Is making Lillian smile important to me?
- Does Lillian (6 🏴☠️👸 ) draw many drawings and do many projects?
- Will getting Lillian’s projects and drawings onto my live website make Lillian smile?
- Do I need to build my Sanity skill to get Lillian’s projects and drawings onto my website?
Factual answers
- Yes.
- Yes.
- Yes.
- Yes.
Conclusion
So, what’s your opinion? Will I be less or more mindfull while building my Sanity skill if I need that skill to get Lillian’s projects and drawings onto my website?
How did I do it?
The Steps
- I opened my Master Gatsby notebook and found the page 13 called “data”
- I opened my Sanity code in VS Code
- I opened schemas / pizza.js
- I deleted the code I guessed was the code from “Creating data relationships”, video 13 of Master Gatsby by The Great and Powerful Wes Bos.
- I set my timer for 1 hour and 36 minutes and 33 seconds.
- I re-coded the code while looking in my notebook.
- I ran the code and looked at http://localhost:3333/desk/topping
- I changed the code to make it show what animals, minerals or vegetables are in Lillian’s projects and drawings.
//sanity / schemas / pizza.js
export default {
// Computer Name
name: 'project',
// visible title
title: 'Project',
type: 'document',
icon,
fields: [
{
name: 'name',
title: 'Project Name',
type: 'string',
description: 'Name of the project',
},
{
name: 'toppings',
title: 'Animal, mineral or vegetable',
type: 'array',
of: [{ type: 'reference', to: [{ type: 'topping' }] }],
},
- I ran the code and looked at http://localhost:3333/desk/topping
- I repeated 8.
- I repeated 8.
- I repeated 8.
- I repeated 8.
- I repeated 8.
- I was done.
My useful beliefs are useful to my skill building.
Try creating a useful skill building belief for yourself. 🔧😺👍
Keep your skill-building-submarine afloat this week! 🔧⛵🏴☠️
Ola Vea Gatsby Piraty Captain
P.S.