This note all activities that Nguyen Viet Anh (@VietAnh1010) does on ezkomment project. Note that activities before 14 May were not logged properly.
F2F meeting with teammate
Decided the app features
Finalised proporsal for Orbital submission
I initially started with Spring Framework, but later switched and considered Django and Express
Express was choosen because Express app can be written using Typescript, which has a better type system than Python
Checked and provided suggestions for the poster and video
Installed WSL, Node.js and Typescript on my local PC
Fixed bugs related to npm on WSL 2
Learned and set up suitable configurations for Node.js runtime environment
Learned Firebase local emumerator and hosting
Installed Express and Firebase to prepare for development
Developed simple Express app
N/A
Created new branch for back-end development
Created basic repo stucture
Learned to do authentication on server side with Firebase using JWT or session cookie and manage users
Learned to design data models and do complex query with Firestore
Added route to get, update and delete user
Tested the behaviour of the API using Postman
Created models to represent the relation between entities
Learned about CORS and experienced with browers
N/A
Nest.js uses classes and decorators extensively, making the code looks similar to Spring project
Decided to stick with Express at the momment
class-validator can be used for classes, but not for interfaces
Considered express-validator
Vercel seems to be the most suitable platform for deployment
Considered to migrate the back-end to Next.js
Migrated backend to Next.js for easer deplopment
Serverless function of Next.js works fine for the application
N/A
N/A
Note: My commit messages were terrible
next-connect is wonderful for serverless environment
Demolished monorepo structure for Next.js
Wrote API specifications
Started implementing validators to sanitise requests
Discussed API specifications and implementation details
Changed the data models on Firestore as multiple nested collections are terrible
Tried
formidable
andmulter
to parse form dataLearned Firebase Storage
Resolved problem when parsing form data by turning off
bodyParser
in Next config (I was fortunate enough to find this on StackOverflow)
Firebase Admin SDK does not have
getDownloadUrl()
, the workarounds are not reliable (more info)Public URL was used, although it's not very secure
Note: Terrible communication delayed our process ...
Authentication problem was solved trivially by attaching middlewares to verify JWT before the handling requests
Added transactions for CRUD to ensure the consistency of logic (for example: user's sites must not have duplicated names)
Wrote proper error handlers for meaningful status codes and messages
Setting up Firebase Emulator was troublesome - I had to install JRE
And I kept connecting to the real databases when trying out the Emulator for unit tests. I wrote setup file (after env) to prevent this, but it did not work correctly
Wrote scripts to generate test data
Wrote setup file (before env) to prevent the unit tests from connecting to the real databases, but it did not work correctly (again)
Wrote unit tests for users and sites. Now I know how useful dependencies injection is
Fixed setup files
Used
beforeAll
hook to setup test data, for easier modification (if my implementation changes in the future)Added test cases to increase coverage
Added page count for sites
Added comment count for both sites and pages
Added new test cases for sites and pages statistics
Added Firebase Emulator for unit testing
Added test cases for newly implemented features
Demolished setup files, use custom testing environment (much more consistent, very nice)
Changed implementation, now allow pages to have duplicated names
Enforced that the decoded uid and the documents' uids must match before executing CRUD actions
I kept making typos in my action.yml files (fixed by a bunch of force-pushes)
Added even more tests to increase the coverage and used Promise.all to decrease the test time
Discussed specifications for customisation section
Wrote and reviewed README
Brainstormed for MS2 video
Optimised GET endpoints, as I realised only 1 transaction is required
Looking back, I should have broken down my commits into smaller ones. I did too much in one commit
Question: Some of my commits are not shown on GitHub?
N/A
Used demo project id to initialise Firebase Admin for testing
Got rid of redudant
env.test.local
on local machine and GitHub secrets
Also fixed issue #127 (get download URL for images from Firebase Storage)
Everyone included
Machine Learning
in their README :)
Did not do anything significant during these few days
Also added unit tests for this feature
codecov
kept falling
Some commits were repeated on repo' history?
This feature is quite easy to implement
This features is much more difficult to implement
I tried to use a counter for this feature, but the implementation was terrible
Discovered a bug when implementing this feature - I forgot to delete subcollections
The final implementation is not very efficient - but it works with O(n) complexity
Also fixed the bug discovered yesterday and add more unit tests to cover it
My code looked like spaghetti after implementing new features
Cleaned up to keep my eye sane
Should be at least 2 times faster
For the best performance, I had to repeat code (which is not a good practice)
Fixing the code to make it less repetitive made performance decreased
I will find a way to improve it later