Updated flow of the app
--------------------
1. **Battery Low Team**
Lets change the register page to this

The new form on the Register page should capture the following
- username
- first name
- lastname
- email
- password
- sex
- Options of MALE, FEMALE and "Others"
- dob # lets make this a date field selector
- language # lets make this a drop down of all languages abbrevation like (en, fr, etc)
References
- https://meta.wikimedia.org/wiki/Template:List_of_language_names_ordered_by_code
- https://www.loc.gov/standards/iso639-2/php/code_list.php
Once this form is complete, make call to hlv-auth http://20.84.224.239:8081/api/v1/auth/signup
2. **Shihab**
Upon successful creation of the user from this new form, can you return the whole data of the user created in this format(user_id, profile).
Example
```json
{
"user_id": 2,# this should be the id of the user created. If you can change this to uuid that would be better also
"profile": {
"firstname": "ruhul",
"lastname": "",
"dob": "01/01/1998",
"language": "en",
"sex": "MALE"
}
}
}
```
3. **Battery Low Team**
Immedieately you get this data back from the user creation, we need to make a call to the create identity api before moving on to the next page. Make the POST call to this endpoint
`http://127.0.0.1:8085/api/v1/identity`
4. **Battery Low Team**
After creating the users lets just have this screen to ask for user allergies as so.

So the idea is that i will provide you with all the known allergies, and you will poulate the upper box with that information. You will allow users select from that box and populate the lower box with the user selection from above. Also, for every allergies added into the lower box, lets have an 'X' button so user can remove if they want to.
Also, we will have the options for users to add allergies (as "others") if they can't find thier allergies in the upper box options. I will let you guys decide on how to design this.
once you have collected all this information, just send the payload to this POST endpoint once the users click on next
`http://127.0.0.1:8085/api/v1/identity/allergies`
We will ditch the page that have
`Do you have diabetes`
`Do you have blood pressure`
5. **Battery Low Team**
Also, lets populate the page with the right information (information from the user info) and the users allergies. This page should also have the options to make modifications to some user information
In addition let's add a pill button on the bottom that says
"Become a premium member". This will be a placeholder for now

## That is most of it on the app side.
HOW TO USE API
---------------
Regarding the api documentation, it is self explanatory on the swagger ui but let me document how to use also.
### **POST ENDPOINTS**
**Create Identity**
When to use:
- make a call to this endpoint right after user has been created on the sign up page
Payload:
- user_id: the id of the user returned from the signup page
- profile: the profile of the user returned from the signup page
```json
curl -X 'POST' \
'http://127.0.0.1:8085/api/v1/identity' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{ "user_id": 3, "profile": { "firstname": "ruhul", "lastname": "", "dob": "01/01/1998", "language": "en" } }'
```
**Add Allergies**
When to use:
- make a call to this endpoint right after user and identity has been created.
- Also, if users go to thier profile and they want to add to thier allergies list
Payload:
- id: the id of the user
- allergies: list of allergies to add for the user
```json
curl -X 'POST' \
'http://127.0.0.1:8085/api/v1/identity/allergies'\
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d ' { "id": 2, "allergies": [ "allergy_1", "allergy_2", "allergy_3", "allergy_4" ] }'
```
**Add History**
When to use:
- make a call to this endpoint anytime the users scans a product
Payload:
- id: the id of the user
- upc: the upc scanned
- upc_found: if the upc is found or not
```json
curl -X 'POST' \
'http://127.0.0.1:8085/api/v1/identity/history' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{ "id" : 2, "upc" : "1", "upc_found" : 1 }'
```
**Add Favourite**
When to use:
- make a call to this endpoint anytime the users adds a product to thier favourite.
Payload:
- id: the id of the user
- upc: the upc added to thier favourite
```json
curl -X 'POST' \
'http://127.0.0.1:8085/api/v1/identity/favourite' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d ' { "id" : 2, "upc" : "1" }'
```
### **GET ENDPOINTS**
**Get Allergies**
When to use:
- any point in the app where we need to get allergies
Resoonse Payload:
```json
{
"data": {
"allergies": [
"allergy_1",
"allergy_2",
"allergy_3",
"allergy_4"
],
"id": 2,
"hlv_id": "c707b481-8c1d-4f60-bfa9-e25d395b2475"
}
}
```
- id: the id of the user
- hlv_id: identity of the user
- allergies: list of all the user allergies
```json
curl -X 'GET' \
'http://127.0.0.1:8085/api/v1/identity/2/allergies'\
-H 'accept: application/json'
```
**Get History**
When to use:
- any point in the app where we need to get users upc history
Resoonse Payload:
```json
{
"data": {
"id": 2,
"hlv_id": "c707b481-8c1d-4f60-bfa9-e25d395b2475",
"upcs": [
{
"upc": "1",
"date_added": "2023-06-28T14:58:36"
},
{
"upc": "3",
"date_added": "2023-06-28T00:59:20"
},
{
"upc": "1",
"date_added": "2023-06-28T00:57:23"
}
]
}
}
```
- id: the id of the user
- hlv_id: identity of the user
- upcs: list of the upc
- upc: the upc
- date_added: the date at which the upc was added
NOTE:
- The **upcs** list is already sorted by the added date, so you should just display the data as returned from the api.
- In cases where we have duplicate upc in the upcs list, then you will need to de-dedup. That-is remove the upc that has the oldest date from the list. Example, in the response payload show above, we see upc 1 is duplicate, in this case will need to remove the upc 1 with the date `2023-06-28T00:57:23` from the list before displaying.
- Also, the date_added is an important, as we will need it to delete upc from history. SO make sure to save this information.
```json
curl -X 'GET' \
'http://127.0.0.1:8085/api/v1/identity/2/history'\
-H 'accept: application/json'
```
**Get Favourites**
When to use:
- any point in the app where we need to get users upc favourite
Resoonse Payload:
```json
{
"data": {
"id": 2,
"hlv_id": "c707b481-8c1d-4f60-bfa9-e25d395b2475",
"upcs": [
{
"upc": "1",
"date_added": "2023-06-28T15:01:17"
},
{
"upc": "1",
"date_added": "2023-06-28T01:05:06"
}
]
}
}
```
- id: the id of the user
- hlv_id: identity of the user
- upcs: list of the upc
- upc: the upc
- date_added: the date at which the upc was added
NOTE:
- The **upcs** list is already sorted by the added date, so you should just display the data as returned from the api.
- In cases where we have duplicate upc in the upcs list, then you will need to de-dedup. That-is remove the upc that has the oldest date from the list. Similar to what we are doing in GET History endpoint
- Also, the date_added is an important, as we will need it to delete upc from favourite if we want to. SO make sure to save this information.
```json
curl -X 'GET' \
'http://127.0.0.1:8085/api/v1/identity/2/favourites' \
-H 'accept: application/json'
```
**Get Recommendation**
When to use:
- any point in the app where we need to get users upc recommendation
Resoonse Payload:
```json
{
"data": {
"id": 2,
"hlv_id": "c707b481-8c1d-4f60-bfa9-e25d395b2475",
"upcs": [
{
"upc": "90",
"date_added": "2023-06-28T01:11:14"
},
{
"upc": "10",
"date_added": "2023-06-28T01:11:06"
},
{
"upc": "1",
"date_added": "2023-06-28T01:10:44"
}
]
}
}
```
- id: the id of the user
- hlv_id: identity of the user
- upcs: list of the upc
- upc: the upc
- date_added: the date at which the upc was added
NOTE:
- The **upcs** list is already sorted by the added date, so you should just display the data as returned from the api.
- In cases where we have duplicate upc in the upcs list, then you will need to de-dedup. That-is remove the upc that has the oldest date from the list. Similar to what we are doing in GET History endpoint
- Also, the date_added is an important, as we will need it to delete upc from favourite if we want to. SO make sure to save this information.
```json
curl -X 'GET' \
'http://127.0.0.1:8085/api/v1/identity/2/recommendations' \
-H 'accept: application/json'
```
### **DELETE ENDPOINTS**
**Delete Allergies**
When to use:
- make a call to this endpoint anytime the users is in thier profile page and wants to delete from thier allergies
Payload:
- id: the id of the user
- allergies: list of allergies to delete for the user
```json
curl -X 'DELETE' \
'http://127.0.0.1:8085/api/v1/identity/allergies' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{ "id": 2, "allergies": [ "allergy_1", "allergy_1" ]}'
```
**Delete History**
When to use:
- make a call to this endpoint anytime the wants to remove a upc from thier history
Payload:
- id: the id of the user
- upc: the upc to delete
- date_added: the date the upc was added (returned when you get the user history)
```json
curl -X 'DELETE' \
'http://127.0.0.1:8085/api/v1/identity/history' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{ "id" : 2, "upc" : "1", "date_added": "2023-06-28T00:57:23" }'
```
**Delete Favourite**
When to use:
- make a call to this endpoint anytime the wants to remove a upc from thier Favourites
Payload:
- id: the id of the user
- upc: the upc to delete
- date_added: the date the upc was added (returned when you get the user history)
```json
curl -X 'DELETE' \
'http://127.0.0.1:8085/api/v1/identity/favourite' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{ "id" : 2, "upc" : "1", "date_added": "2023-06-28T00:59:54" }'
```
**Delete recommendation**
When to use:
- make a call to this endpoint anytime the wants to remove a upc from thier recommendation
Payload:
- id: the id of the user
- upc: the upc to delete
- date_added: the date the upc was added (returned when you get the user history)
```json
curl -X 'DELETE' \
'http://127.0.0.1:8085/api/v1/identity/recommendation' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{ "id" : 2, "upc" : "2", "date_added": "2023-06-28T00:59:54" }'
```
Country Code
------------
```json
"country_name","country_code"
"Afghanistan","AF"
"Åland Islands","AX"
"Albania","AL"
"Algeria","DZ"
"American Samoa","AS"
"Andorra","AD"
"Angola","AO"
"Anguilla","AI"
"Antarctica","AQ"
"Antigua and Barbuda","AG"
"Argentina","AR"
"Armenia","AM"
"Aruba","AW"
"Australia","AU"
"Austria","AT"
"Azerbaijan","AZ"
"Bahamas","BS"
"Bahrain","BH"
"Bangladesh","BD"
"Barbados","BB"
"Belarus","BY"
"Belgium","BE"
"Belize","BZ"
"Benin","BJ"
"Bermuda","BM"
"Bhutan","BT"
"Bolivia (Plurinational State of)","BO"
"Bonaire, Sint Eustatius and Saba","BQ"
"Bosnia and Herzegovina","BA"
"Botswana","BW"
"Bouvet Island","BV"
"Brazil","BR"
"British Indian Ocean Territory","IO"
"Brunei Darussalam","BN"
"Bulgaria","BG"
"Burkina Faso","BF"
"Burundi","BI"
"Cambodia","KH"
"Cameroon","CM"
"Canada","CA"
"Cabo Verde","CV"
"Cayman Islands","KY"
"Central African Republic","CF"
"Chad","TD"
"Chile","CL"
"China","CN"
"Christmas Island","CX"
"Cocos (Keeling) Islands","CC"
"Colombia","CO"
"Comoros","KM"
"Congo","CG"
"Congo (Democratic Republic of the)","CD"
"Cook Islands","CK"
"Costa Rica","CR"
"Côte d'Ivoire","CI"
"Croatia","HR"
"Cuba","CU"
"Curaçao","CW"
"Cyprus","CY"
"Czech Republic","CZ"
"Denmark","DK"
"Djibouti","DJ"
"Dominica","DM"
"Dominican Republic","DO"
"Ecuador","EC"
"Egypt","EG"
"El Salvador","SV"
"Equatorial Guinea","GQ"
"Eritrea","ER"
"Estonia","EE"
"Ethiopia","ET"
"Falkland Islands (Malvinas)","FK"
"Faroe Islands","FO"
"Fiji","FJ"
"Finland","FI"
"France","FR"
"French Guiana","GF"
"French Polynesia","PF"
"French Southern Territories","TF"
"Gabon","GA"
"Gambia","GM"
"Georgia","GE"
"Germany","DE"
"Ghana","GH"
"Gibraltar","GI"
"Greece","GR"
"Greenland","GL"
"Grenada","GD"
"Guadeloupe","GP"
"Guam","GU"
"Guatemala","GT"
"Guernsey","GG"
"Guinea","GN"
"Guinea-Bissau","GW"
"Guyana","GY"
"Haiti","HT"
"Heard Island and McDonald Islands","HM"
"Holy See","VA"
"Honduras","HN"
"Hong Kong","HK"
"Hungary","HU"
"Iceland","IS"
"India","IN"
"Indonesia","ID"
"Iran (Islamic Republic of)","IR"
"Iraq","IQ"
"Ireland","IE"
"Isle of Man","IM"
"Israel","IL"
"Italy","IT"
"Jamaica","JM"
"Japan","JP"
"Jersey","JE"
"Jordan","JO"
"Kazakhstan","KZ"
"Kenya","KE"
"Kiribati","KI"
"Korea (Democratic People's Republic of)","KP"
"Korea (Republic of)","KR"
"Kuwait","KW"
"Kyrgyzstan","KG"
"Lao People's Democratic Republic","LA"
"Latvia","LV"
"Lebanon","LB"
"Lesotho","LS"
"Liberia","LR"
"Libya","LY"
"Liechtenstein","LI"
"Lithuania","LT"
"Luxembourg","LU"
"Macao","MO"
"Macedonia (the former Yugoslav Republic of)","MK"
"Madagascar","MG"
"Malawi","MW"
"Malaysia","MY"
"Maldives","MV"
"Mali","ML"
"Malta","MT"
"Marshall Islands","MH"
"Martinique","MQ"
"Mauritania","MR"
"Mauritius","MU"
"Mayotte","YT"
"Mexico","MX"
"Micronesia (Federated States of)","FM"
"Moldova (Republic of)","MD"
"Monaco","MC"
"Mongolia","MN"
"Montenegro","ME"
"Montserrat","MS"
"Morocco","MA"
"Mozambique","MZ"
"Myanmar","MM"
"Namibia","NA"
"Nauru","NR"
"Nepal","NP"
"Netherlands","NL"
"New Caledonia","NC"
"New Zealand","NZ"
"Nicaragua","NI"
"Niger","NE"
"Nigeria","NG"
"Niue","NU"
"Norfolk Island","NF"
"Northern Mariana Islands","MP"
"Norway","NO"
"Oman","OM"
"Pakistan","PK"
"Palau","PW"
"Palestine, State of","PS"
"Panama","PA"
"Papua New Guinea","PG"
"Paraguay","PY"
"Peru","PE"
"Philippines","PH"
"Pitcairn","PN"
"Poland","PL"
"Portugal","PT"
"Puerto Rico","PR"
"Qatar","QA"
"Réunion","RE"
"Romania","RO"
"Russian Federation","RU"
"Rwanda","RW"
"Saint Barthélemy","BL"
"Saint Helena, Ascension and Tristan da Cunha","SH"
"Saint Kitts and Nevis","KN"
"Saint Lucia","LC"
"Saint Martin (French part)","MF"
"Saint Pierre and Miquelon","PM"
"Saint Vincent and the Grenadines","VC"
"Samoa","WS"
"San Marino","SM"
"Sao Tome and Principe","ST"
"Saudi Arabia","SA"
"Senegal","SN"
"Serbia","RS"
"Seychelles","SC"
"Sierra Leone","SL"
"Singapore","SG"
"Sint Maarten (Dutch part)","SX"
"Slovakia","SK"
"Slovenia","SI"
"Solomon Islands","SB"
"Somalia","SO"
"South Africa","ZA"
"South Georgia and the South Sandwich Islands","GS"
"South Sudan","SS"
"Spain","ES"
"Sri Lanka","LK"
"Sudan","SD"
"Suriname","SR"
"Svalbard and Jan Mayen","SJ"
"Swaziland","SZ"
"Sweden","SE"
"Switzerland","CH"
"Syrian Arab Republic","SY"
"Taiwan, Province of China","TW"
"Tajikistan","TJ"
"Tanzania, United Republic of","TZ"
"Thailand","TH"
"Timor-Leste","TL"
"Togo","TG"
"Tokelau","TK"
"Tonga","TO"
"Trinidad and Tobago","TT"
"Tunisia","TN"
"Turkey","TR"
"Turkmenistan","TM"
"Turks and Caicos Islands","TC"
"Tuvalu","TV"
"Uganda","UG"
"Ukraine","UA"
"United Arab Emirates","AE"
"United Kingdom of Great Britain and Northern Ireland","GB"
"United States of America","US"
"United States Minor Outlying Islands","UM"
"Uruguay","UY"
"Uzbekistan","UZ"
"Vanuatu","VU"
"Venezuela (Bolivarian Republic of)","VE"
"Viet Nam","VN"
"Virgin Islands (British)","VG"
"Virgin Islands (U.S.)","VI"
"Wallis and Futuna","WF"
"Western Sahara","EH"
"Yemen","YE"
"Zambia","ZM"
"Zimbabwe","ZW"
"ALAND ISLANDS", "AX"
"BOLIVIA","BO"
"BOSNIA AND HERZEGOWINA","BA"
"CAPE VERDE","CV"
"CONGO, THE DEMOCRATIC REPUBLIC OF THE","CD"
"COTE D""IVOIRE","CI"
"CROATIA (local name: Hrvatska)","HR"
"CURACAO","CW"
"European Union","??"
"FRANCE, METROPOLITAN", "FR"
"KOREA, DEMOCRATIC PEOPLE""S REPUBLIC OF","KP"
"KOREA, REPUBLIC OF","KR"
"LIBYAN ARAB JAMAHIRIYA","LY"
"MACAU","MO"
"MACEDONIA, THE FORMER YUGOSLAV REPUBLIC OF","MK"
"MICRONESIA, FEDERATED STATES OF","FM"
"MOLDOVA, REPUBLIC OF","MD"
"NETHERLANDS ANTILLES","AN"
"NETHERLANDS ANTILLES (retired code)","AN"
"PALESTINIAN TERRITORY, OCCUPIED","PS"
"REUNION","RE"
"SERBIA AND MONTENEGRO","CS"
"SERBIA AND MONTENEGRO (see individual countries)","CS"
"SLOVAKIA (Slovak Republic)","SK"
"SVALBARD AND JAN MAYEN ISLANDS","SJ"
"UNITED KINGDOM","GB"
"UNITED STATES","US"
"VATICAN CITY STATE (HOLY SEE)","VA"
"VENEZUELA","VE"
"WALLIS AND FUTUNA ISLANDS", "WF"
"YUGOSLAVIA","YU"
"ZAIRE","CD"
```