Skip to content
This repository has been archived by the owner on Jul 31, 2022. It is now read-only.

Auctions system where users can sell and bid products, where the focus was to manage database transactions and build a consistent ER Diagram

License

Notifications You must be signed in to change notification settings

RodrigoSobral2000/Assignment_2021_BD

Repository files navigation

Lights, Camera, Auction 🎬

Lights, Camera, Auction is the name of our API, which pretends to manage an auction's ecosystem where people create an account, create their auctions, and sell their goods to someone who's interested in them.


Used Technologies 💻


ER Diagram

ER Diagram

RDM Diagram

ER Diagram


How to run it 🏃

⚠️ Keep all the files and directories as they are, otherwise, is not guaranteed it works.

⚠️ Create a .env file and a .env.example file with the following content: SECRET=your secret

💾 First of all you'll need to build a nodejs package with some dependencies, so you must run:

  • npm init -y

  • npm install express body-parser pg-promise jest axios jsonwebtoken dotenv-safe

🏧 Now you may be able to deploy it, do it running node server.

🚦 You can also test it with npm run test, however, not all tests are implemented.

🌎 Make it public with ./ngrok http 8080 -host-header="localhost:8080"


RULES 📋

  1. Each user session has a timeout of 1 hour. Then you have to login once again.

  2. Each user has a unique username and email.

  3. An auction can be created without a minimum price, in this case, the default value will be 0.

  4. Once auctioned, a product cannot be auctioned again, until the auction ends without any bid.

  5. Only the seller has the permission to edit his own auctions.

  6. Anybody can bid an auction, except the owner.

  7. Only bid above maximum bid are accepted.

  8. If it's the first bid, the amount must be above minimum price.

  9. The owner of an auction receives notifications about all the messages written in his auctions, including his owns.

  10. Any user can clear his entire notification inbox.


Getting Started 👶

After the server is deployed, you can now create an account.

POST http://localhost:8080/dbproj/user

body:
{
    "username": "John",
    "password": "test123",
    "email": "john123@gmail.com"
}

An then login.

PUT http://localhost:8080/dbproj/user

body:
{
  "username": "John",
  "password": "test123"
}

When you're successfully logged in, you may have access to the entire system.

A token is given to you, ⚠️ save it because you won't receive another one within an hour!

  • Logout
PUT http://localhost:8080/dbproj/user/logout

headers:
{
    "authtoken": "yourtoken123"
}
  • Create an Auction
POST http://localhost:8080/dbproj/leilao

headers:
{
    "authtoken": "yourtoken123"
}

body:
{
	"titulo": "yourtitle", 
	"descricao": "yourdescription",
	"precoMinimo": 1, (is not a must)
	"limite": "2020/5/31:22:00",
	"artigoId": 1
}
  • List All Running Auctions
GET http://localhost:8080/dbproj/leiloes

headers:
{
    "authtoken": "yourtoken123"
}
  • List All Running Auctions By Product ID Or Product Description
GET http://localhost:8080/dbproj/leiloes/?keyword=

queries:
{
    "keyword": "yourkeyword"
}

headers:
{
    "authtoken": "yourtoken123"
}
  • List Auction By Its ID
GET http://localhost:8080/dbproj/leiloes/?leilaoId=

queries:
{
    "leilaoId": "yourauctionId"
}

headers:
{
    "authtoken": "yourtoken123"
}
  • List All User Activity
GET http://localhost:8080/dbproj/user/atividade

headers:
{
    "authtoken": "yourtoken123"
}
  • Make a Bid
GET http://localhost:8080/dbproj/leiloes/?leilaoId=&licitacao=

queries:
{
    "leilaoId": "yourauctionId",
    "licitacao": "yourbid"
}

headers:
{
    "authtoken": "yourtoken123"
}
  • Edit An Auction
PUT http://localhost:8080/dbproj/leilao/?leilaoId=

queries:
{
    "leilaoId": "yourauctionId"
}

headers:
{
    "authtoken": "yourtoken123"
}

body:
{
    "titulo": "yourtitle",
    "descricao": "yourdescription",
	"limite": "yourdate",
	"precominimo": 19.99
}
  • Write a Message In a Auction Mural
POST http://localhost:8080/dbproj/leilao/mural/?leilaoId=

queries:
{
    "leilaoId": "yourauctionId"
}

headers:
{
    "authtoken": "yourtoken123"
}

body:
{
    "message": "yourmessage"
}
  • Check User Inbox
GET http://localhost:8080/dbproj/user/inbox

headers:
{
    "authtoken": "yourtoken123"
}
  • Clear User Inbox
DEL http://localhost:8080/dbproj/user/inbox

headers:
{
    "authtoken": "yourtoken123"
}
  • List All Products
GET http://localhost:8080/dbproj/artigos

headers:
{
    "authtoken": "yourtoken123"
}

Contributors

Licenciatura em Engenharia Informática - Universidade de Coimbra
Bases de Dados - 2020/2021
Coimbra, 31 de maio de 2021

🎓 Diogo Flórido

🎓 Rodrigo Fernando Henriques Sobral


License 🔗

Have a look at the license file for details


About

Auctions system where users can sell and bid products, where the focus was to manage database transactions and build a consistent ER Diagram

Topics

Resources

License

Stars

Watchers

Forks