Sat Jan  8 10:10:10 EST 2022
--------------------------------------------------------------------------------
I have that interview coming up in two days and getting some prep notes from rick.

Interview Prep
--------------------------------------------------------------------------------
Talk about applications that I have built before.
- Lavendale
    - Healthcare
    - Recycling
- Political Platform
- Mail Pilot 
- Throttle
Talk about technologies that you used in your Applications.
- SwiftUI
- Combine
- Core Data
- URLSessions

Bug that I once had and solved (Explanation).
- Pagination Bug
    - Problem 
    When pulling the data from the API, there were times when the data would get duplicated because the server would be sending anything thing it had on that page. 
   - Solution 
   By making functions to add the data into the data structures instead of going directly to them I was able to clean the data before it corrupted the data structure which then would create non-sensible layouts within the UI.
   Within the API I would create a new section and poke into the head of the first element to see where the data needed to be added within the actual dataset before it gets added into it. 
   It would do it for mismatched dates, joining dates to the previous section and ore removing a section.
- Natural Language Processing
    - Problem 
    Many steps to this but it was a problem of data collection and cleaning on a massive scale. 
    - Solution 
    Learning a vast amounts of tools to do the job right.
    Each iteration accounted for an exponential more data that could be collected and processed.

Sexy Closure
--------------------------------------------------------------------------------
A concept that should be crucial to software engineering.
Finish what you start.
Have sexy closure in the knowledge of knowing that your job is done in what you set out to do.
Its hard but its worth it.

Match My Mechanic
--------------------------------------------------------------------------------
Transitioning over to sqlite is dead.
It was a desperate attempt to not face the problems of the database that I currently had running.
So continuing with postgres :) 

It looks like for the API to work correctly I need to understand how to link and proper SSL Certificate with my node application. 
Lets get started. 
################################################################################
sudo apt-get update &&
sudo apt-get install software-properties-common &&
sudo add-apt-repository universe &&
sudo add-apt-repository ppa:certbot/certbot &&
sudo apt-get update
sudo apt-get install certbot
sudo certbot certonly --standalone
################################################################################

After doing this there were a couple of prompts that you might wanna know about. 

- Enter email for using with Let's Encrypt 
- Terms of Service
- Willing to share you email
- Enter domain names

Upon success you will get the message like: 
IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/api.matchmymechanic.com/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/api.matchmymechanic.com/privkey.pem
   Your certificate will expire on 2022-04-08. To obtain a new or
   tweaked version of this certificate in the future, simply run
   certbot again. To non-interactively renew *all* of your
   certificates, run "certbot renew"


Now we must try to get our application running again. 

Okay that wasn't it and I think I know what it is now. 
On the managed database at digital ocean there is a Download CA Cert Button and I think if I do that and scp it into the server than it will work fine. 
Lets give it a shot.

To do the secure copy!
scp  Downloads/ca-certificate.crt root@api.matchmymechanic.com:/home/quindarius/
ca-certificate.crt

That did not work either but what did work was:
NODE_TLS_REJECT_UNAUTHORIZED='0' node api.js

A complete hack for sure but it works and gets data into the application.

curl api.matchmymechanic.com:3001/customers
[{"customer_id":1,"first_name":"quindarius","last_name":"lyles-woods","phone":"7044707036","address":"305 Darby Rd","email":"quindarius@dam.wtf.com"}]%

Nice.

Now the api is working again I can rebuild it for the following operations

- Create 
- Delete 
- Update 

I will have all of these endpoints within the application as well but not all will be actionable within the application unless programmed to do it.

Getting the create end points done well enough. 
This is what a proper curl request looks like to the API
curl -X "POST" "http://api.matchmymechanic.com:3001/customers? \
first_name=quin&last_name=test&phone=7707707700&address=some%20adresss&email=test%40test%40gmail.com"

Now to add all the other endpoints.
Repair Added

All the POST endpoints are working.

Looking to add the Put endpoints
Done
Done with the Delete endpoints as well

This project is going to serve as a great reference for building API's and interfacing with postgres! 

I am using paw to test the API's in case someone whats to follow that.

I set out to finish the api and database today and that is done. 
Tomorrow we will put the finishing touches on the iOS Application and the finishes the project!