Coder Social home page Coder Social logo

aml-hassan-abd-el-hamid / book-store-backe-end-project Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 3.0 84 KB

Book Store Back-End built using Express and Node JS as a college project

License: The Unlicense

JavaScript 99.11% Dockerfile 0.89%
backend expressjs nodejs webdevelopment

book-store-backe-end-project's Introduction

Book-Store-Back-End-project

Task One

Our project is depending on NodeJs to build a Book Store, Which provides different types of books and make customer able to buy any of them. Each book has its Name, Author and Price as an initial attributes.

In File: Books.js you can see the basic set of books which we created.

The Basic functions we used is: Get, Post, Delete, and Put to make basic proccesses in our BookSet, you can see this here: BookController . With help of Postman these functions are applied. Like that:

Post

Adding book by ID:4:

new

Get

Getting all books:

95

Getting one book by ID:1

96

Put

Editing specific book by ID:4

98

Delete

*Deleting one book ID:2 and showing the rest books:

100

Deleting specific book by ID:

99

Note

1-The validation function file: BookValidation is used to validate the rules which we predetermined, we call it in need (e.g.: Put and Post).

2-The Router file: BookRouter is used to access all functions when it's called.

.................................................................................................................................................................................................

Task Two

In this task, We created a simple Nosql DataBase in MongoDB: it's consists of

1- Books: Which contains all books in DB which have some attributes, such like: BookName, BookAuthor, PublicationYear, and BookCount.

2- User: User can make order by choosing any available books, each user has an specific order in which we can specify and calculate all total amount of books he has orderd.

3-Order: This order contains all books the user has chosen (Each user with specific order). We handle the case of ordering some Books which is above the number of our available books, In addition to making user able to Enter his information (e.g. Address, Name, Email, PhoneNumber,...) and in case of confirmation order (checkout) the total price is calculated, and the quantity of available books also.

The relation between tables:

Schema

now we add 2 books in our Books table as shown, each book has its attributes like name, author, price, and count that shown the number of avaliable books in the store.

Note: we apply CRUID operations in books table

books

now user fill his information like username, password and email to register the website and we saved this data in our users table as shown.

Note: we apply CRUID operations in users table

user

now user ready to order books from website, he needs to enter his phonenumber, address and quantity of the book(we compare the quantity of book he ordered with the count of the avaliable books in books table). and we store the price of his order in orders table in attribute called amount which calculated from price of the book and the quantity of the book he ordered.

Note: we apply CRUID operations in orders table

order

We make Two functions editOrder and confirmOrder in order_controller.

editOrder : it make any user which already request an order to edit on its order details like count of books that he need.

this picture before editing order. before editing

but this after editing order(which edit Phone number and address and quantity of book which he want then amount changed automatically). After editing

confirmOrder : this function for user for confirmation order and after confirm he can't change or edit anything in his order and before confirmation status of order will be not confirmed but after confirmation will be confirmed and waiting mean waiting for shipping for someone.

this picture before confirmed before confirmed

but this after confirmed after confirmed

At this time, it's admin respinsability to handle the status case, in the Admin table which contains some attributes attached to admin himself (Such like:Name, Password, and Email) as shown in our DB :

2023-04-20_10h52_56

This Admin can handle the case of the status if it arrived to user or not, As shown the Status is changed from: Confirmed and Waiting to: Shipped :

The Admin can also Delete (aka block) some users if he needed, when user didn't complete order in the proper way (as user didn't pay his payment of order).

book-store-backe-end-project's People

Contributors

aml-hassan-abd-el-hamid avatar asmahan-rashed avatar nada-khalefa avatar nourelshehry 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.