Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fakturk/auction-bid-tracker
Auction Bid Tracker golang implementation
https://github.com/fakturk/auction-bid-tracker
Last synced: 2 days ago
JSON representation
Auction Bid Tracker golang implementation
- Host: GitHub
- URL: https://github.com/fakturk/auction-bid-tracker
- Owner: fakturk
- Created: 2020-02-17T13:43:52.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2020-02-18T16:58:34.000Z (almost 5 years ago)
- Last Synced: 2024-03-15T18:21:23.107Z (10 months ago)
- Language: Go
- Size: 93.8 KB
- Stars: 4
- Watchers: 2
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# auction-bid-tracker
Auction Bid Tracker golang implementationYou have been asked with building part of a simple online auction system which will allow users to concurrently bid on items for sale. The system needs to be built in Go and/or Python.
Please, provide a bid-tracker interface and concrete implementation with the following functionality:
- [x] record a user’s bid on an item;
- [x] get the current winning bid for an item;
- [x] get all the bids for an item;
- [x] get all the items on which a user has bid;
- [x] build simple REST API to manage bids.You are not required to implement a GUI (or CLI) or persistent store (events are for reporting only). You may use any appropriate libraries to help.
# Structure
We have three different structs for holding each value which are user, item and bid. When we are adding a bid to an item from a user we use user id and item id together.| User | Item | Bid |
| ----- | ----- | ------- |
| id | id | user id |
| name | name | user id |
| | | amount |# Postman usage
There is a postman collection added for 18 requests and "auction-bid-tracker.postman_collection.json" file can be implemented in the Postman and directly called from there.
Also some mock data added inside of the program for test usage.
![Postman ](/images/auction-bid-tracker-postman.png)
# How To Rungo run main.go
# Usage
(Part I - Solutions to given problems)
- record a user’s bid on an item :- request type: POST
- host: localhost:8000/bids/{userid}/{itemid}/{amount}
- get the current winning bid for an item:
- request type: GET
- host: localhost:8000/winner/{itemid}
- get all the bids for an item:
- request type: GET
- host: localhost:8000/bids/{itemid}
- get all the items on which a user has bid
- request type: GET
- host: localhost:8000/items/user/{userid}
(Part II - REST API Management)
- add user
- request type: POST
- host: localhost:8000/users
- add user with name
- request type: POST
- host: localhost:8000/users/{name}
- get users
- request type: GET
- host: localhost:8000/users
- get user by id
- request type: GET
- host: localhost:8000/users/id/{idnumber}
- delete user by id
- request type: DELETE
- host: localhost:8000/users/id/{idnumber}
- add item
- request type: POST
- host: localhost:8000/items
- add item with name
- request type: POST
- host: localhost:8000/items/{name}
- get items
- request type: GET
- host: localhost:8000/items
- get item by id
- request type: GET
- host: localhost:8000/items/id/{idnumber}
- delete item by id
- request type: DELETE
- host: localhost:8000/items/id/{idnumber}
- add bid
- request type: POST
- host: localhost:8000/bids/{userid}/{itemid}/{amount}
- update bid
- request type: PUT
- host: localhost:8000/bids/{userid}/{itemid}/{amount}
- get bids
- request type: GET
- host: localhost:8000/bids
- get bid (by user id and item id)
- request type: GET
- host: localhost:8000/bids/{userid}/{itemid}
- delete bid
- request type: DELETE
- host: localhost:8000/bids/{userid}/{itemid}