Team: CHLW
Members: Yichen Liu, Siyu Wu, Mengyuan Huang, Jiyao Chen
-
Player
-
GET /player
- Description: Return a full list of registered players
- Sample HTTP Request: localhost:8080/player
- Description: Return a full list of registered players
-
GET /player
- Description: Return a list of users that matches the given parameter
- Optinal Parameters:
player_id
(Type: Integer)email
(Type: String)playername
(Type: String)
- Sample HTTP Request:
localhost:8080/player?player_id=1
- Sample Response:
Status: 200
[ { "player_id": 1, "playername": "sw3607", "email": "sw3607@columbia.edu" } ]
- Optinal Parameters:
- Description: Return a list of users that matches the given parameter
-
POST /player
- Description: Create a new player with username and email. UserID will be generated automatically.
- Sample Request Body:
{ "playername": "sw3607", "email": "sw3607@columbia.edu" }
- Sample Response:
status: 201
[ { "player_id": 1, "playername": "sw3607", "email": "sw3607@columbia.edu" } ]
- Description: Create a new player with username and email. UserID will be generated automatically.
-
PUT /player
- Description: Update player information. Input must contain playerID. Only playername and email can be updated.
- Sample Request Body:
{ "player_id": 1, "playername":"newname@columbia.edu", "email":"newemail@columbia.edu" }
- Sample Response:
status: 200
[ { "player_id": 1, "playername": "newname@columbia.edu", "email": "newemail@columbia.edu" } ]
- Description: Update player information. Input must contain playerID. Only playername and email can be updated.
-
DELETE /player
(coming soon)
-
-
Item
-
GET /item
- Description: Return a full list of items
- Sample HTTP Request:
localhost:8080/item
- Sample HTTP Request:
- Description: Return a full list of items
-
GET /item
- Description: Return a list of items that matches the given parameters
- Optional Parameters:
item_id
(Type: Integer)item_name
(Type: String)item_description
(Type: String)item_category
(Type: String)
- Sample HTTP Request:
localhost:8080/item?item_id=1
- Sample Response:
Status: 200
[ { "item_id": 1, "item_name":"shield", "item_description":"a stone shield", "item_category":"defence" } ]
- Optional Parameters:
- Description: Return a list of items that matches the given parameters
-
POST /item
- Description: Add a new item to the database.
- Sample Request Body:
{ "item_name":"shield", "item_description":"a stone shield", "item_category":"defense" }
- Sample Response:
Status: 201
[ { "item_id": 1, "item_name":"shield", "item_description":"a stone shield", "item_category":"defence" } ]
- Description: Add a new item to the database.
-
PUT /item
- Description: Update an existing item in the database.
- Sample Request Body:
{ "item_id": 1, "item_name":"shield", "item_description":"a stone shield", "item_category":"defence" }
- Sample Response:
Status: 200
[ { "item_id": 1, "item_name":"shield", "item_description":"a stone shield", "item_category":"defence" } ]
- Description: Update an existing item in the database.
-
DELETE /item/{item_id}
- Description: Delete the given item.
- Sample HTTP Request:
localhost:8080/item?item_id=1
- Sample Response:
Status: 200
- Sample HTTP Request:
- Description: Delete the given item.
-
-
Transaction
GET /transaction
- Description: Return a full list of transactions
- Sample HTTP Request:
localhost:8080/transaction
- Sample HTTP Request:
- Description: Return a full list of transactions
GET /transaction
- Description: Return a list of transactions that matches the given parameters
- Optional parameters:
transaction_id
(Type: Integer)item_id
(Type: Integer)buyer_id
(Type: Integer)seller_id
(Type: Integer)quantity
(Type: Integer)open
(Type: Boolean)post_time
(Type: LocalDateTime)close_time
(Type: LocalDateTime)price
(Type: Integer)accept
(Type: Boolean)
- Sample HTTP Request:
localhost:8080/transaction?transaction_id=1
- Sample Response:
Status: 200
[ { "transaction_id": 1, "item_id": 1, "buyer_id": 2, "seller_id": 1, "quantity": 1, "open": true, "post_time": "2022-12-04-17-22-53", "close_time": null, "price": 100, "accept": false } ]
- Optional parameters:
- Description: Return a list of transactions that matches the given parameters
POST /transaction
- Description: Add a new transaction to the database.
- Sample Request Body:
{ "seller_id":"1", "item_id" : "1", "price" : "100", "quantity" : "1", "accept" : false, "open" : true }
- Sample Response:
Status: 201
[ { "transaction_id": 1, "item_id": 1, "buyer_id": null, "seller_id": 1, "quantity": 1, "open": true, "post_time": "2022-12-04-17-22-53", "close_time": null, "price": 100, "accept": false } ]
- Description: Add a new transaction to the database.
PUT /transaction/{seller_id}/{transaction_id}
- Description: Update a given transaction.
- Sample Request Body:
{ "initial_price" : "3", "quantity" : "3" }
- Sample Response:
Status: 200
[ { "transaction_id": 1, "item_id": 1, "buyer_id": null, "seller_id": 1, "quantity": 3, "open": true, "post_time": "2022-12-04-17-22-53", "close_time": null, "price": 3, "accept": false } ]
- Description: Update a given transaction.
PUT /transaction/close/{seller_id}/{transaction_id}
- Description: Close the given transaction.
- Sample Response:
Status: 200
[ { "transaction_id": 1, "item_id": 1, "buyer_id": null, "seller_id": 1, "quantity": 3, "open": false, "post_time": "2022-12-04-17-22-53", "close_time": "2022-12-04-17-22-54", "price": 3, "accept": false } ]
- Sample Response:
- Description: Close the given transaction.
DELETE /transaction
(coming soon)
-
Negotiation
Get /view-negotiation
- Description: Return a list of negotiations according to the transaction_id.
- Sample HTTP Request:
localhost:8080/view-negotiation?fk_transaction_id=1
- Sample Response:
Status: 200
[ { "negotiation_id": 1, "buyer_id": 2, "post_time": "2022-12-04-17-22-53", "close_time": null, "price": 3, "quantity": 5, "open": true, "accept": null, "transaction": {"transaction_id":1} } ]
- Sample HTTP Request:
- Description: Return a list of negotiations according to the transaction_id.
POST /addnegotiation/{buyer_id}
- Description: Add a new negotiation.
- Sample Request Body:
{ "buyer_id":1, "price":3, "quantity":5, "transaction":{ "transaction_id":1 } }
- Sample Response:
Status: 201
[ { "negotiation_id": 1, "buyer_id": 2, "post_time": "2022-12-04-17-22-53", "close_time": null, "price": 3, "quantity": 5, "open": true, "accept": null, "transaction": {"transaction_id":1} } ]
- Description: Add a new negotiation.
PUT /accept-negotiation/{seller_id}/{negotiation_id}
- Description: Accept one negotiation.
- Sample HTTP Request:
localhost:8080/accept-negotiation/1/1
- Sample Response:
Status: 200
{ "negotiation_id": 1, "buyer_id": 2, "post_time": "2022-12-04-17-22-53", "close_time": "2022-12-04-17-22-54", "price": 3, "quantity": 5, "open": false, "accept": true, "transaction": {"transaction_id":1, "Open": false, "Accept": true} }
- Sample HTTP Request:
- Description: Accept one negotiation.
This system provides an in-community market with negotiation/auction functionality. Clients can create users and modify the state of players, such as bags of items and amount of money (in-game scenario). Users can post their items to the community market at desired prices, and other users can buy the items or negotiate the price.
Online market server (ebay, stockX.)
Fundraising/auction web app/service
Multiplayer game server
Event ticket-selling service
Any online platform or App with item trading and collection
Clone the whole project from Github, and build it in Intellij.
The database for demo is not uploaded, but we can upload it later if needed. The url in src/main/resources/application.properties to database is a local address to the database, so the user need to modify it before using. The user also need to modify the username and password. Then the user can check if the connection to database is successfully set.
Test files are under src/test/java/com/example/CommunityMarket/Flows. Tests can be done automatically.
We have finished basic functions related to Users, Transactions, and Items table. They can be run to perform insertion, updating, querying on these 3 tables.
We are working to fill other functions like validating user login. We will have them done before the demo.