Skip to content

Commit

Permalink
ref #23586 - update jamstack recipes complex data structures
Browse files Browse the repository at this point in the history
  • Loading branch information
MaciejLabedzkiCodewave committed Jan 4, 2024
1 parent 29cdc1b commit bbe8d30
Show file tree
Hide file tree
Showing 16 changed files with 9 additions and 9 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Once you start building data models that are a little more complex you'll find t

In this article we'll discuss a couple of particular problems you might encounter in designing a data model and later - working with it. Accidentally - we'll also build a stunning website with your favorite culinary recipes (scrambled eggs, of course).

![Recipes website built using Gatsby and Flotiq](images/jamstack-recipes-complex-data-structures/flotiq-starter-gatsby-recipe-1.png){: .center .width75 .border}
![Recipes website built using Gatsby and Flotiq](images/jamstack-recipes-complex-data-structures/flotiq-starter-gatsby-recipe.png){: .center .width75 .border}

A simple `Recipe` model you might find useful for a recipe website could look like this:

Expand All @@ -24,11 +24,11 @@ A simple `Recipe` model you might find useful for a recipe website could look li

For such a model - Flotiq would generate a form looking like this:

![Flotiq form for a simple data model](images/jamstack-recipes-complex-data-structures/upload_5466699a3bcd1bdc5e419f2d17240c37.png){: .center .width75 .border}
![Flotiq form for a simple data model](images/jamstack-recipes-complex-data-structures/flotiq-form-simple-data-model.png){: .center .width75 .border}

and your API docs would describe that model this way:

![Flotiq API docs for a simple data model](images/jamstack-recipes-complex-data-structures/upload_0158c43f8d5cc1154fddd8ae68a15ae9.png){: .center .width75 .border}
![Flotiq API docs for a simple data model](images/jamstack-recipes-complex-data-structures/flotiq-api-docs-simple-model.png){: .center .width75 .border}

This model might be acceptable for very simple websites, but having the `Ingredients` and `Steps` entered as unstructured text (even if using HTML `<li>`) will soon become an issue.

Expand Down Expand Up @@ -69,7 +69,7 @@ The problem of unstructured data can be solved using repeatable content fragment

Here's how you would go about it with Flotiq's `list` data type:

![Flotiq's list data type](images/jamstack-recipes-complex-data-structures/upload_9ecd3721c970774c2735a195ff55643f.png){: .center .width75 .border}
![Flotiq's list data type](images/jamstack-recipes-complex-data-structures/flotiq-list-data-type.png){: .center .width75 .border}


Benefits:
Expand Down Expand Up @@ -102,21 +102,21 @@ We can now extend the example mentioned above:

Your Content Type definition in Flotiq would then look like this:

![Recipe content type definition using lists](images/jamstack-recipes-complex-data-structures/upload_7d565cfe5f5df4287c3d7e0d7004fc94.png){: .center .width75 .border}
![Recipe content type definition using lists](images/jamstack-recipes-complex-data-structures/recipe-content-type-definition-list.png){: .center .width75 .border}

and you would expect this in the API docs:

![Recipe API docs showing lists](images/jamstack-recipes-complex-data-structures/upload_769871eca6460389041c8c52c381826f.png){: .center .width75 .border}
![Recipe API docs showing lists](images/jamstack-recipes-complex-data-structures/recipe-api-doc-showing-lists.png){: .center .width75 .border}

> Yup, we know, we're drooling over Flotiq's API docs every time, too. And you know what? You don't need to write a line of code - the docs, just as your entire RESTful API are generated every time you change your model definitions!
And this is how the form for that Content Type would render:

![Flotiq form for a content object using lists](images/jamstack-recipes-complex-data-structures/upload_a99534a9bf1aee346e58aec39037bfd5.png){: .center .width75 .border}
![Flotiq form for a content object using lists](images/jamstack-recipes-complex-data-structures/recipe-object-scrambled-eggs-list.png){: .center .width75 }

We used the `list` datatype in this [Gatsby & Flotiq recipes starter](https://github.com/flotiq/gatsby-starter-recipes) and you can see the results [here](https://flotiq-starter-recipes.herokuapp.com/). With this data model it's now really simple for a frontend developer to interpret that content on the website.

![Full example of a recipe using Flotiq lists](images/jamstack-recipes-complex-data-structures/upload_7dd4947f6433fabfaf9c94170b445dc4.png){: .center .width75 .border}
![Full example of a recipe using Flotiq lists](images/jamstack-recipes-complex-data-structures/full-example-recipe-scrambled-eggs.png){: .center .width75 .border}

## Experiment with the Gatsby starter

Expand All @@ -137,7 +137,7 @@ If you'd like to dig a little deeper into this recipe website, here's your quick

Create your [Flotiq.com](https://flotiq.com) account. Next, create the `Recipe` Content Type:

![Recipe content type in flotiq](images/create-definition-recipe.png){: .center .width75 .border}
![Recipe content type in flotiq](images/jamstack-recipes-complex-data-structures/add-definition-type-recipe.png){: .center .width75 .border}

_Note: You can also create `Recipe` using [Flotiq REST API](https://flotiq.com/docs/API/)._

Expand Down

0 comments on commit bbe8d30

Please sign in to comment.