Activity

Joel Joby

ISTG IM CODING AT GOD SPEED. okay so i implemented the function that is the api + frontend (used little AI for frontend UI part) but once the ui was done i finished creating the api and in like 30 mins max a large reason for that was some AI told me about single responsibility bs and i followed it and now like its like i had to call a bunch of functions that all with some error handling cuz I had created the code for creating project during account creation long back and it was soo cool just calling the functions and then BOOM DONE! also had to write a little fronted logic cuz AI broke

0
Joel Joby

Dint think i spend so muchn time like 3 hours but anyway I managed to write the code for dashboard data population tho the hardest part was the SQL query so I had a design choice in front of me either I had to make multiple requests to the database which i have hosted on my server and that would take 1-2 sec per request * by 3-4 fields i need or i could request everything in one query that would take like 3-4 at max but this way it would be far more inefficient AND I WAS IN A DILEMA idk its spelling but yea and then i realized i need to execute a count query and its going to be a join and i researched on how count queries work so that would have to generate the table anyway at this point I realised i should have keept a counter table as well cuz running this log is going to be expensive so naturally i scraped the idea of multiple queries cuz then ill have to render it again BROO IM SO STUPID i should not have done that like itsss sooooo inefficient but now what can I do adding that cache type feature would add like 5 more hours and ive already spent enough time and im like ill use count and it took me easy 30 mins to figure out the right query to include all the details but then im like bruh it was not counted cuz i use pgAdmin but OK and then luckyily i just had to plug in a few endpoints and from my projects table frontend code and it worked like butter i dint reuse a single bit of code

0
Joel Joby

SO i was finally able to finish revoke access had it do the below checks to make sure there was no logic based error in the code
//the flow should be check the auth key from headers and verify and then deocode the info
//get the project id and user id to be removed from the body
//check if user owns the project if yes then let him do
// also check if the person being remove is not the owner
//check if user already exists in the project
//remove the dude from the project
and I also made a video of it and also made sure it shows the right error when the person is added and removed and something is incorrect it took me more time to think and make the query also i enabled RLS via an exists call to make sure few conditions were ensured by the query it self and to ensure the security of the application IDK why my application is kinda slow not sure if its cuz of next.js or what it could also be cuz my vm is in us and im not based in us its pretty far from me so could be that also but ill take care of that during deployment
shit i was reecorduing the worng part AHHHHHHH and i cant change wowo

Attachment
Attachment
0
Joel Joby

Okay SOOO I finished the API building and i also tested it with 4 cases: when request api key is not valid. when user does not have perms to make the action i.e.e he is not the owner of the project and then the provided email does not have an account and then the last one when the user is already attached to the project. thennn i created the api and then changed the structure of the controller to input the api key and then decode the users uuid instead of just accepting it like that. then I had to integartate the api key with my frontend code id say this was the hardest part cuz AI made pretty messy code to handle it it was all very confusing cuz it was setting stuff improperly cuz of wrong order and stuff but them Im the GOAT i figured it out and then made the api and then the erros it shows are also ver responsive and the user will understand what error has happening but oon the dull side i forgot to populate the data so i need to make that and also make the revoke access thing . AHHH I FOUND AN ANNOYING BUG EVEN IF IT WORKS THE ERROR MESSAGE SHOW ITS FAILED and it also says it worked need to work on that next

Attachment
Attachment
0
Joel Joby

OKAYYY SO this was kinda a long thing and I did design this part of the system well most people would just add a row to the intermediary database to allow a new user to access a project but i went one step ahead and made my workflow little more stable. so firstly i check if the user trying to perform the operation is the owner of the project or not cuz i have a created_by column which it checks with and then i go on to check if the email id the user is trying to add is valid and does it exist or not and after all this there is also a function to get the uuid from the email cuz i used uuid in the table instead of email but now that i think back i should have given email i could have prevented one more less read hmm its a good thing to think about. i mean no what if the user changes his email then what the system would lose its redundancy idk what it means but i think its this but ukwim and im yet to integrate it into the main api but ive written the contorller function the service function and the modal function just need to test it from the controller and if it works ill api it and integrate it into my frontend thats my next 2-3 hour plan but below is the list of files i created or like i designed and the result of running test function with sample values. ALSO i did a small code refactoring moving and structuring file s to where they belong

Attachment
0
Joel Joby

Okay So I continued what i was doing mainly worked on the project settings page so I needed to allow people to update their project and add multiple to the project as well so to do this i first created a modal which pops up when the button is clicked this was fairly simple and i used AI to do this cuz im bad at UI stuff so yea but i added the functionality to the thing like calling the right apis but thats just a place holder function for now while I make the apis. I also started the api’s wrote a framework on how the api should work and then i wrote the postgres query for it and now im figuring to run it without adding it as an api obv so that i can test it.

Attachment
0