summaryrefslogtreecommitdiffstats
path: root/frontend/notes.md
diff options
context:
space:
mode:
authorWes Bos <wesbos@gmail.com>2018-01-30 12:41:01 -0500
committerWes Bos <wesbos@gmail.com>2018-01-30 12:41:01 -0500
commitcd0b07b3adb36fb5ec098f9e511ab45d774fee7b (patch)
treea203e5010219ccea1acc6bbd2c0a4bcfa0a78615 /frontend/notes.md
parent0a1648bf47490b312169c531aeb51ef4725e8d2e (diff)
Move to Prisma Backend
Diffstat (limited to 'frontend/notes.md')
-rw-r--r--frontend/notes.md68
1 files changed, 68 insertions, 0 deletions
diff --git a/frontend/notes.md b/frontend/notes.md
new file mode 100644
index 0000000..3b8c1da
--- /dev/null
+++ b/frontend/notes.md
@@ -0,0 +1,68 @@
+## Link
+
+Before we use next-routes, our links look like this:
+
+```js
+ <Link
+ href={{
+ pathname: 'item',
+ query: {
+ slug: slugify(item.title),
+ itemId: item.id,
+ },
+ }}
+ >
+```
+
+Once we switch to next routes, our links look like this:
+
+```js
+import { Link } from '../routes';
+
+<Link
+ route="item"
+ params={{
+ slug: slugify(item.title),
+ itemId: item.id,
+ }}
+>
+```
+
+## Commonly Used Terms
+
+Enhancer - These are just high order components that "infuse" the data we want into our components via props
+
+Mutation
+
+Query
+
+Scalar - this means that it's an acutal value and not a relationship. A scalar type of ID might be ABC123, a scalar type of String might be "Wes Bos". These are the default scalar types:
+
+Int: A signed 32‐bit integer.
+Float: A signed double-precision floating-point value.
+String: A UTF‐8 character sequence.
+Boolean: true or false.
+ID
+
+## The process for adding a new field:
+
+1. First we need to add the field to our type in datamodel.graphql
+2. Then, we need to add it to our schema.graphql file, which is how we define our GraphQL API. Here we will only include the fields that we want to be query-able
+3. Now the database needs to know about the new field, so we run `prisma deploy`
+
+## The process for adding a new type
+
+1. First we need to add it to the database. Edit datamodel.graphql:
+
+```js
+type Item {
+ id: ID! @unique
+ title: String!
+ description: String!
+ price: Int!
+}
+```
+
+2. Now we need to either re-define it in our client-side schema, or import it carte blanche
+
+## The process for adding new queries or mutations