Welcome to Re-Thrift's codebase! The below will document any relevant information about Re-Thrift's backend/frontend code.
Re-Thrift aims to increase sustainable consumption by matching need and supply. Oftentimes, people are reluctant to thrift or shop second-hand at major thrift stores such as Goodwill or Buffalog Exchange because they have no idea what they might find. In some cases, they might be looking for a specific item that they do not know exists. Re-Thrift also makes hosting thrift pop-ups easier, as organizers can directly request for items from users. Organizers can set up events with requests for certain items and quantities. Donors can see what items they have to donate and respond to organizers who need donated items. In this way, we are hoping thrifting can become a more decentralized process that is more tailored to local experiences of communities.
Running locally requires a few extra npm scripts from package.json
in comparison to A5.
- Run
npm run serve
, which compiles the frontend for hot-reloading with webpack and serves it at port8080
. - Open a new terminal (with the original one still open) and run
npm run dev
to start the backend at port3000
. - To view your website, connect to localhost:8080 (instead of port 3000) since the backend will no longer serve any HTML files.
Our official site is deployed here
For the Alpha release, we have implemented User and Donation Request. Note: Freet documentation has been kept to serve as a continuous reference while implementing other concepts, but is not used for any functionality and will be deleted before the final push.
This renders the index.html
file.
Body
username
{string} - The user's usernamepassword
{string} - The user's password
Returns
- A success message
- An object with user's details (without password)
Throws
403
if the user is already logged in400
if username or password is not in correct format format or missing in the req401
if the user login credentials are invalid
Returns
- A success message
Throws
403
if user is not logged in
Body
username
{string} - The user's usernamephone
{string} - The user’s phone numberemail
{string} - The user’s email address for contactlocationcity
{string} - The user’s citylocationstate
{string} - The user’s statepassword
{string} - The user's password
Returns
- A success message
- An object with the created user's details (without password)
Throws
403
if there is a user already logged in400
if username or password is in the wrong format409
if username is already in use
Body (no need to add fields that are not being changed)
username
{string} - The user's usernamephone
{string} - The user’s phone numberemail
{string} - The user’s email address for contactlocationcity
{string} - The user’s citylocationstate
{string} - The user’s statepassword
{string} - The user's password
Returns
- A success message
- An object with the update user details (without password)
Throws
403
if the user is not logged in400
if username or password is in the wrong format409
if the username is already in use
Returns
- A success message
Throws
403
if the user is not logged in
Returns
- An array of all requests sorted by the start date of the accepting donations period
Returns
- An array of requests posted by the user with username
author
Throws
400
ifauthor
is not given404
ifauthor
is not a recognized username of any user
Body
contact
{string} - the email or phone number specific to this requestdescription
{string} - the types of clothing and amounts wanted
Returns
- A success message
- A object with the created request
Throws
403
if the user is not logged in400
If the any of the required request content is empty
Returns
- A success message
Throws
403
if the user is not logged in403
if the user is not the requestor404
if the requestId is invalid
Body
contact
{string} - the email or phone number specific to this requestdescription
{string} - the types of clothing and amounts wanted
Returns
- A success message
- An object with the updated request
Throws
403
if the user is not logged in404
if the requestId is invalid403
if the user is not the requestor400
if there are no update fields given filled (all empty)
Returns
- An array of all events sorted in descending order by event date (or earliest date if it spans multiple days)
Returns
- An array of events hosted by the user with username
coordinator
Throws
400
ifcoordinator
is not given404
ifcoordinator
is not a recognized username of any user
Returns
- An array of events occurring between
startrange
andendrange
(inclusive)
Throws
400
ifstartrange
is not given (ifendrange
is not given, assume no end date)404
ifstartrange
orendrange
is invalid404
ifendrange
exists and is earlier the current date
Returns
- An array of events in a given location
Throws
400
iflocation
is not given404
iflocation
is invalid (i.e. improperly formatted as city,state(two-letter abbreviation))
Body
startdate
{string} - Start date of the event formatted as "yyyy-mm-dd"enddate
{string} - End date of the event formatted as "yyyy-mm-dd"location
{string} - The location of the eventdescription
{string} - The description of the items the coordinator is looking for to be donatedcontact
{string} - The contact method (phone or email) by which the coordinator wants to setup donation drop offsdonationdate
{string} - Last date for accepting donations, formatted as "yyyy-mm-dd"
Returns
- A success message
- A object with the created event
Throws
403
if the user is not logged in400
if the any of the event content is empty404
if thestartdate
orenddate
are invalid, or isenddate
is distinctly earlier thanstartdate
404
if thedonationdate
is invalid404
if thelocation
state abbreviation does not exist
Returns
- A success message
Throws
403
if the user is not logged in403
if the user is not the coordinator of the event404
if the eventId is invalid
Body
startdate
{string} - Start date of the event formatted as "yyyy-mm-dd"enddate
{string} - End date of the event formatted as "yyyy-mm-dd"location
{string} - The location of the eventdescription
{string} - The description of the items the coordinator is looking for to be donatedcontact
{string} - The contact method (phone or email) by which the coordinator wants to setup donation drop offsdonationdate
{string} - Last date for accepting donations, formatted as "yyyy-mm-dd"
Returns
- A success message
- An object with the updated event
Throws
400
if all fields are empty403
if the user is not logged in403
if the user is not the coordinator of the event404
if the eventId is invalid
Body
event
{int} - Event flag, 0 when event is still a request and 1 when responses are closed and event moves to events page
Returns
- A success message
- An object with the updated event
Throws
400
ifevent
is empty403
if the user is not logged in403
if the user is not the coordinator of the event404
if the eventId is invalid