Grey Market Labs assessment
This commit is contained in:
77
README.md
77
README.md
@@ -1,3 +1,76 @@
|
||||
# greymarketlabs-assignment
|
||||
# Running the service
|
||||
## Pre-Reqs
|
||||
* Access to the interenet
|
||||
* Docker environment installed with proper user permissions
|
||||
|
||||
## Running
|
||||
* This will use port 4916, if that is not available modify the Makefile
|
||||
* Run `make`
|
||||
|
||||
## Stopping
|
||||
* Type `exit`
|
||||
|
||||
## Testing
|
||||
* Run `bash ./test.sh` in a seperate window on the same machine
|
||||
|
||||
# API Description
|
||||
## Setting Persona
|
||||
|
||||
GET request to /set_persona with the following properties
|
||||
* persona_id: integer (if not unique it will override a previous persona)
|
||||
* first_name: string first name of persona
|
||||
* last_name: string last name of persona
|
||||
* interest_list: string comma seperated list of interests
|
||||
* lat: floating point latitude of location
|
||||
* lon: floating point longitude of location
|
||||
|
||||
This will return a json formatted string of the values you set
|
||||
|
||||
## Getting persona
|
||||
GET request to /get_persona with the following propertie
|
||||
* persona_id: integer id (error will occur if it does not exist)
|
||||
|
||||
This will return a JSON in the following format
|
||||
* id: integer persona id
|
||||
* first_name: string first name
|
||||
* last_name: string last name
|
||||
* interest_list: comma seperated string of interests
|
||||
* latitude: floating point latitude
|
||||
* longitude: floating point longitude
|
||||
* city: string city
|
||||
* state: string state
|
||||
* temperature: current temperature in fahrenheit
|
||||
|
||||
# Further Questions
|
||||
## A
|
||||
I was not able to complete every aspect of this assignment. I few things I would have liked to accomplish in addition were:
|
||||
* Proper error checking
|
||||
* Currently it'll just fail out if bad inputs are given. I would have liked to have it error gracefully with proper error codes
|
||||
* Clean up the code
|
||||
* There are some odd variable names and no comments
|
||||
* Several variables in the API itself change from input to output, I would have liked to make those the same
|
||||
* Better id handling
|
||||
* Have additional ways to determine what the next un-assigned ID would be
|
||||
* Have a better way when getting the information that an ID doesn't exist
|
||||
* Better testing
|
||||
* Create a little more robust testing
|
||||
* Temperature
|
||||
* I grabbed the first temperature returned, rather than the current. It isn't too far off, but would have like to get the actual current temperature.
|
||||
|
||||
## B
|
||||
Potential issues include
|
||||
* Poor error handling, the app will crash on bad input
|
||||
* Provide more rubust intput checking with error code/string returns
|
||||
* Interest list handling
|
||||
* Right now it is just a comma seperated list
|
||||
* I would have liked to have a seperate table of interests, then the returned json could have been an array list. This would have provided better access for the front end
|
||||
* Repeat/Unknown IDs
|
||||
* A repeat ID will overwrite perviously set values, this was a choice, but the API should have an update vs new option
|
||||
* There could also be a way to not give an ID and the next ID is reaturned to the front end
|
||||
* Unknown IDs on get are not handled and will cause a crash, there should be an error message returned
|
||||
|
||||
## C
|
||||
Possible security issues are:
|
||||
* If anyone has arbetrary access they will be able to get all the persona information, this should be locked down to only authorized users
|
||||
* Overloading the memory with large values, there is no limit to the length of the strings, thus someone could overwhelm the system by putting in too long of strings
|
||||
|
||||
Assignment for Grey Market Labs
|
||||
Reference in New Issue
Block a user