Coder Social home page Coder Social logo

graphql-server's Introduction

graphql-server

Build Status

Data

Static data

imported from @groceristar/groceristar-fetch plugin and partially from Food-static-data: https://github.com/GroceriStar/sd More about this plugin here:

Database schema

schema Details about current DB scheme: https://medium.com/groceristar/database-schema-of-groceristar-current-release-20dc1b4be7b9

This is a strucuture that we have in our models: https://github.com/ChickenKyiv/database-visuals/tree/master/groceristar/models same structure we use at groceristar-fetch, so we can easy grab data, that we need. database(we'll use it later):

"url": "mongodb://heroku_p3w65n77:[email protected]:35065/heroku_p3w65n77",
"name": "groceryDS",

Rest API methods

This is a list of methods, that we have in our Frontend Version. I can be like a checklist for us. In order to fully migrate from REST API server to graphQL we'll need to cover all of this cases: https://medium.com/groceristar/groceristar-website-methods-list-75b57e1414ae

GroceryStar Documentation

This is our main documentation space, related to Groceristar project: https://groceristar.github.io/documentation/

Running the development server

npm install

Graphql server will be running in http://localhost:3000/

You can explore all schema types

GraphQL Resources

I have some collection of tutorials, websites, related to GraphQL topic, storing it here: https://github.com/ChickenKyiv/awesome-graphql-beginner-links

as default webpack config didn't support babel 7 yet, we have both versions at package.json

install?? looks like it's old version // "babel-plugin-syntax-async-functions": "^6.13.0", // "babel-plugin-transform-regenerator": "^6.26.0", // // "plugins": [ // "syntax-async-functions", // "transform-regenerator" // ] // https://itnext.io/building-a-graphql-api-using-graphql-yoga-lambda-and-mongodb-c0c195621f47 https://medium.com/@xoor/coding-a-graphql-api-with-node-js-c02d617f49f4

  1. relations. i think we should debate each relation. because I think our schema(picture that we have) have more old-fashion logic. For example - UserGrocery table - it can be just part of User type. I saw a lot of big projects, that just put everything in one place and then parse it.
  2. for me its hard to keep in mind that we have Items. I mean I have in my head structure of groceristar without items, and all documentation, methods related to it. maybe it will be more easy for me - when I finish dealing with our old servers. So I propose to have our development in two ways: a) just recreating/replacing our current GS server - so when we create for example a query or method - we just open my old code - see how it works and does the same logic

b) we can work with items in parallel, but we need to be aware that this part of schema doesn't have our documentation coverage, so we'll need to create everything from scratch. it's not a problem for me, but I'll be more supportive to items version when I'll know that we did basic important methods for ingredients, grocery, departments. these 3 types have some complex things and I want to address them first.

btw, if you have questions - ask them more specifically. and I think at another task.

graphql-server's People

Stargazers

 avatar

Watchers

 avatar

graphql-server's Issues

create relations between types

when i was reading the specification - i tried to create some sort of schema at paper. i just find it, and decide to move it here, for discussion. I'm 100% sure that my schema wrong, because i didn't finished my learning of graphQL yet. but maybe it will give us a topic to discuss and will help you. listing it below.

type UserGrocery {
user: User!
groceries: [Grocery]!
id: ID!
}
type Department {
name: String!
desc:String!
ingredients: [Ingredients]!
id: ID!
}
type Favorites {
user:User!
favorites: [Ingredient]!
id: ID!
}
type Ingredient {
name
description
custom: Boolean!
department: Department!
}
type User {
tokens: [Token]!
identities:[]!
credentials:[]!
groceries:[Grocery]!
favorites:[Favorite]!
id: ID!
}
type Grocery {
name: String!
image: Binary!
description: String!
slug: String!
departments: [Department]! {Show/Hide}
purchased: [Ingredient]!
ingredients:[Ingredient]!
id: ID!
}
type Item {
name: String!
description: String!
quantity: Number!
purchase: Boolean!
id: ID!
}

creating types

we need to create tables(types) for our database schema

  • User Grocery
  • Favorites
  • Ingredient
  • Grocery
  • Item
  • User
  • Department
  • Grocery

import data to mongodb via graphql

i'm curious to know if we have some way to 'migrate' data(different from graphQL migration) from js arrays into database. i'm pretty sure that gql eco-system have some cool plugin that can save us time

install our `fetch` plugin

  • read an article about plugin
  • sync latest changes from main repo
  • create/finish examples of static data for each of types that we have. Vadim will use it in order to compare results.
  • reply to our comments, advice at our questions
  • confirm that method from fetch, related to department works well

  • get some data, related to Grocery, Department, Ingredient (separately)
  • show me, how, by changing query - we'll get a different set of data from our static data as result

table userFav

The table has ingredient_id as PM and FK, I don't understand how it's possible?

install sd-wrapper, connect it to resolvers and see if everything will work or not

  1. setup project locally Done
  2. install sd-wrapper. our module https://github.com/GroceriStar/sd#quick-start Done
  3. comment previous versions and use a new version here: https://github.com/GroceriStar/graphql-server/blob/master/src/data/selector.js
    as we make it in smart way previously, all methods located in one file, instead of checking all files
  4. run this server, run tests - does it work? nothing crashing? it's strange :)

Create new methods at fetch plugin, that will fit to current server requirements (prev. static data)

#6 (comment)

and we need to have that data for all types, that we specified here: https://github.com/GroceriStar/graphql-server/tree/master/src/typeDefs


create new methods

Departments

  • Moved data to selector.js here?
  • Completed and tested here with approval from Nada

Grocery

Schema
Static Data that was tested at graphql server

  • Was Grocery Methods published at fetch plugin?
  • Did we update package at this repo?
  • Moved data to selector.js here?
  • Completed and tested here with approval from Nada

Ingredients

Schema
don't have file Static Data that was tested at graphql server

  • Was Ingredient Methods published at fetch plugin?
  • Did we update package at this repo?
  • Moved data to selector.js here?
  • Completed and tested here with approval from Nada

users

Schema
Static Data that was tested at graphql server

  • Was users Methods published at fetch plugin?
  • Did we update package at this repo?
  • Moved data to selector.js here?
  • Completed and tested here with approval from Nada

next types will explain later

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Warning

These dependencies are deprecated:

Datasource Name Replacement PR?
npm @babel/plugin-proposal-class-properties Unavailable
npm merge-graphql-schemas Unavailable

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Ignored or Blocked

These are blocked by an existing closed PR and will not be recreated unless you click a checkbox below.

Detected dependencies

npm
package.json
  • @groceristar/groceristar-fetch ^2.2.7
  • @groceristar/sd-wrapper ^4.15.0
  • express ^4.17.1
  • graphql-yoga ^1.18.3
  • jest ^25.0.0
  • merge-graphql-schemas ^1.7.3
  • snyk ^1.258.2
  • supertest ^4.0.2
  • @babel/cli 7.8.4
  • @babel/core 7.9.0
  • @babel/node 7.8.7
  • @babel/plugin-proposal-class-properties 7.8.3
  • @babel/preset-env 7.9.0
  • babel-core 7.0.0-bridge.0
  • babel-jest 25.2.6
  • babel-plugin-module-resolver 4.0.0
  • nodemon 2.0.2
  • regenerator-runtime 0.13.5
  • standard 14.3.3
travis
.travis.yml
  • node 10
  • node 11

  • Check this box to trigger a request for Renovate to run again on this repository

discussion

what approach we'll have for our graphql server?
i mean there a lot of servers like yoga or apollo stuff, please advice

test how our server works in real world

  • should be deployed and visible from outside
  • should be connected to one of our react projects(maybe at first time we should just have a clean CRA only)
  • instead of using 5-7 methods from our fetch plugin - we should get data by using some queries...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.