This file contains hidden or 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
| const bookFragment = gql` | |
| fragment book on Book { | |
| id | |
| title | |
| liked | |
| } | |
| `; | |
| const LIBRARY = gql` | |
| query library { |
This file contains hidden or 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 React from 'react'; | |
| import { Mutation } from '@loona/react'; | |
| export default props => ( | |
| <Mutation mutation={ADD_BOOK}> | |
| {addBook => ( | |
| <button onClick={() => addBook({ | |
| variables: { | |
| title: props.title | |
| }, |
This file contains hidden or 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 { state, mutation, update, effect } from '@loona/react'; | |
| const defaults = { | |
| books: [ | |
| { | |
| id: generateID(), | |
| title: 'Book A', | |
| __typename: 'Book', | |
| }, | |
| ], |
This file contains hidden or 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
| type User @entity(additionalFields: [ | |
| { path: "services.login.token", type: "string" } | |
| ]) { | |
| id: String @id | |
| email: @column | |
| } |
This file contains hidden or 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 { ObjectID } from 'mongodb'; | |
| export interface UserDbObject { | |
| _id: ObjectID; | |
| profile: ProfileDbObject; | |
| photos: [ObjectID]; | |
| email?: string | null; | |
| } | |
| export interface ProfileDbObject { |
This file contains hidden or 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
| type User @entity { | |
| id: String @id | |
| profile: Profile! @embedded | |
| email: @column | |
| photos: [Photo] @link | |
| } | |
| type Profile @embedded { | |
| fullName: String | |
| } |
This file contains hidden or 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 { ObjectID } from 'mongodb'; | |
| export interface UserDbObject { | |
| _id: ObjectID; | |
| profile { | |
| credentials: { | |
| username: string; | |
| }; | |
| }; | |
| email?: string | null; |
This file contains hidden or 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 { QueryResolvers } from ‘./generated/graphql’; | |
| import { getPosts } from ‘./posts’; | |
| const Query: QueryResolvers.Resolvers = { | |
| posts() { | |
| return getPosts(); | |
| } | |
| } |
This file contains hidden or 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 { ObjectID } from 'mongodb'; | |
| export interface UserDbObject { | |
| _id: ObjectID; | |
| profile { | |
| credentials: { | |
| username: string; | |
| }; | |
| }; | |
| email?: string | null; |
This file contains hidden or 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
| type User @entity { | |
| id: String @id | |
| username: String! @column @map(path: "profile.credentials.username") | |
| email: @column | |
| } |