Your first-choice app for going dutch
This project is for the 2nd week of KAIST CS496 Immersion Camp: Intensive Programming and Startup, the base requirements of the project being developing an android application using a backend server. Check out the client application here
Warning: the paths to endpoints and the inner implementations were done in an extremely hasty manner. So please bear with the inconsistencies! Below is a list of endpoints that a user can send requests to:
- POST
/auth/login
: retrieve informations(id, email, first and last name) of a user that are stored in Facebook's database required fields:access_token
: the access token received from Facebook in the client side returns (JSON):member
: whether or not this user is already logged into GoDutchid
: identification number of user stored in Facebookemail
: email of user stored in Facebook (empty string if it doesn't exist)first_name
: first name of user stored in Facebooklast_name
: last name of user stored in Facebook
- POST
/auth/register
: register a new user to GoDutch- required fields: JSON object. Check out the schema in
models/User.js
for reference.
- required fields: JSON object. Check out the schema in
- POST
/api/contacts/insert
: add a list of contacts for a specific user required fields:id
: the identification string from facebook's access tokencontacts
: an array of{ name: String, number: String, email: String }
objects, each of which represent a single contact returns:{ success: true }
if successful- error message with status
500
otherwise
- GET
/api/images/list/:id
: get a list of paths to a user's gallery params:id
: identification string of user returns:- the images are stored under the path
/tmp/uploads/<user-id>/<photo-name>
. the server will return a list of paths without the first/tmp
part
- POST
/api/images/upload
: upload a list of photos to the user's gallery required fields:id
: identification string of user- The client must send a request of content type
multipart/form-data
under the namephotos
to send their photos returns: { success: true }
if successful- error message with status
500
otherwise
- POST
/api/images/delete
: delete a specified list of images from the user's gallery required fields:id
: identification string of userphotos
: path to the photo, following the same format to that of GETapi/images/list/:id
returns:{ success: true, photos: <paths_to_photos> }
if successful- error message with status
500
otherwise
- GET
/api/parties/list/:id
: retrieve a list of parties that a specific user is included in params:id
: identification string of user returns:- array of objects that the specified user is included in
- GET
/api/parties/transactions/:id
: retrieve all transactions in a specific party, grouped and sorted by transaction date params:id
: identification string of user returns:- a complex list of objects, each of which represent transactions added on a specific day. refer to code for more detail
- error message with status
500
if unsuccessful
- GET
/api/parties/single/:id
: retrieve members included in a specific party params:id
: identification string of party returns (JSON):members
: members of the partynamesMap
: JS object containing -> key-value mappings
- GET
/api/parties/:id/resolve
: resolve all transactions of a specific party and return who should send money to whom params:id
: identification string of party returns (JSON):result
: JS object containing money transfer details. refer to implementation for further detailnamesMap
: JS object containing -> key-value mappings
- POST
/api/parties/add
: add a new party required fields:id
: desired name of the partymembers
: an array ofid
s of the members of the party to be created returns:{ success: true }
if successful- error message with status
500
otherwise
- POST
/api/parties/transactions/complete
: mark transactions between two users as completed required fields:party_id
: identification string of party that the transaction is included inuser_id
: identification string of user that sends the moneyto
: identification string of user that receives the money returns:{ successful: true }
if successful- error message with status
500
if unsuccessful
- POST
/api/parties/:id/transactions/add
: add a new transaction to a specific party params:id
: identification string of party returns:{ successful: true }
if successful- error message with status
500
otherwise
- GET
/api/users/list/:id
: retrieve the information of people that are members of GoDutch among the contacts of user withid
params:id
: identification string of user returns:result
: the information of people that are members of GoDutch among the contacts of userid
- GET
/api/users/single/:id
: retrieve the information of a specific user params:id
: identification string of user returns:result
: information of user. refer tomodels/User.js
schema for further detail
- GET
/api/users/multiple
: retrieve informations of multiple users queries:users
: array of user ids returns:result
: array of informations of users. refer tomodels/User.js
schema for further detail
- GET
/api/users/peopleiowe/:id
: retrieve an array of people a specific users owes money to params:id
: identification string of user returns (JSON):result
: an array of people a specific users owes money tonamesMap
: JS object containing -> key-value mappings