GithubHelp home page GithubHelp logo

ktor-vi / back-my-books Goto Github PK

View Code? Open in Web Editor NEW

This project forked from lvannebenne/back-my-books

0.0 1.0 0.0 460 KB

Back-end - Library manager

License: MIT License

JavaScript 88.83% HTML 11.17%

back-my-books's Introduction

Back my books ๐Ÿ““

Our last (but not least) Becode Project !

Some guy called Jeff asked us for a library manager for his books, so we did it!

With GraphQL

Our demo website (On Heroku)

Stack Technique

  • Node.js (Server)
  • PostgreSQL (Database)
  • Sequelize (ORM)
  • Babel (Transpiler)
  • Apollo-Server && Apollo Client

Playground (query testing) is here.

If you want to query the Playground with some authentication, you can get it from here.

How to use Sequelize-CLI :

npm run build:server

In the src/ folder :

npm install --save-dev sequelize-cli

  1. Fill the bin/config/config.json with the database credentials.

  2. in the src/ folder :

npx sequelize db:create - Creates the database sequelize db:migrate - Creates the following tables : * books * borrows * comments * opinions * users

Note : Tables names are plural

Sequelize db:seed - Optional, fills the tables with 3 books and their info.

Tables and models :

The entries in the database, type and references (relations) are in the /models folder

* books => book
* borrows => borrow
* comments => comment
* opinions => opinion
* users => user

Queries

All the queries, with a getAll... will, by default render 5 books.

However, you can pass the limit parameter :

e.g :

getAllUsers(limit: 10) {...}

More informations about our API is in the Playground

Mutations (Queries that change stuff ) :

Books

createBook()

An error will occur if the ISBN (10 or 13) exists in the database

Borrows

createBorrow()

An error will occur if a user already borrowed 5 books we know we have plenty books, but hey, bring back the 5 others, please

bookReturn()

An error will occur if the user tries to give back a book that he never borrowed. maybe he stole it ?

Comments

createComment()

An error will occur if the user already gave his opinion on the book. give the book a thumbs up, please

Opinions

giveOpinion()

An error will occur if the user tries to reply more than once on a comment No need for drama in the comment section

Users

createUser()

An error will occur if a user's username or email are in the database.

For obvious reasons

Have fun !

๐Ÿฆ„   Lindsay Vannebenne
๐Ÿ•ถ  Michael Jacquemart
๐Ÿ”ญ  Victor Philippe

back-my-books's People

Contributors

lvannebenne avatar michaeljacquemart avatar ktor-vi avatar

Watchers

 avatar

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.