Skip to content

DylanPerdigao/BidYourAuction-API

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BidYourAuction

Setup

Requirements

  1. PostgreSQL
  2. Python 3.9
  3. Libraries & Frameworks
python -m pip install wheel
python -m pip install flask
python -m pip install jwt
python -m pip install psycopg2
python -m pip install cryptography

Connect to database

psql -h localhost -p 5432 -d postgres -U postgres

Database Setup

  1. Connect to the database
psql -h <host> -p <port> -d <db_name> -U <user>
  1. Insert password
<password>
  1. Execute data.sql
\i data.sql;

Register admins

  1. Modify registAdmins.py
# [ [username, password, email], ... ]
admins = [
    ["username1", "password1", "[email protected]"],
    ["username2", "password2", "[email protected]"],
    ...
]
  1. Execute Script
python3 registAdmins.py

Requests

User Sign Up

POST http://localhost:8080/dbproj/user
{
   "username": "maria",
   "email": "[email protected]",
   "password": "password"
}

Sign In

PUT http://localhost:8080/dbproj/user
{
   "username": "mara",
   "password": "password"
}

Create Auction

POST http://localhost:8080/dbproj/leilao
{
   "artigoId": 69,
   "precoMinimo": 10000.00,
   "titulo": "Lingote de ouro",
   "descricao": "Ouro puro (24 quilates)",
   "dataFim": "2021-06-10 23:59"
}

List existing Auctions

GET http://localhost:8080/dbproj/leiloes

Search existing Auctions

GET http://localhost:8080/dbproj/leiloes/{keyword}

Auction's details

GET http://localhost:8080/dbproj/leilao/{leilaoId}

List Auctions where user has some activity

GET http://localhost:8080/dbproj/user/leiloes

Bid

POST http://localhost:8080/dbproj/licitar/{leilaoId}/{licitacao}

Edit Auction's details

PUT http://localhost:8080/dbproj/leilao/{leilaoId}
{
   "titulo": "Agua do Mondegoo",
   "descricao": "Agua fresca do rio Mondegoo"
}

Write feed message

POST http://localhost:8080/dbproj/feed/{leilaoId}
{
   "message": "O que justifica o preco do artigo?",
   "type": "question"
}

List notifications

GET http://localhost:8080/dbproj/inbox

Check if Auction ended

PUT http://localhost:8080/dbproj/leilao/checkFinish

Cancel Auction

PUT http://localhost:8080/dbproj/leilao/cancel/{leilaoId}

Ban user

PUT http://localhost:8080/dbproj/ban/{username}

Get some statistics

GET http://localhost:8080/dbproj/stats

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 76.3%
  • PLpgSQL 23.7%