Skip to content

Latest commit

 

History

History
214 lines (124 loc) · 12.3 KB

VersionLog.md

File metadata and controls

214 lines (124 loc) · 12.3 KB

VERSION LOG AND CONTROL

  • Versioning is going to progress as follows: +0.01 for small bugs fixes, visual effects implementations, user experience improvements, small code refactoring +0.1 for bigger implementations, big code refactoring, big changes in the program logic +1 if complete new functionality/page is added, or for massive changes being deployed at once

V1.00 06/26/2024

Web aplication released to production with the following capabilities:

  • Create, Read, Update, and Delete customers through MongoDB Customer Info includes Company Name, Email, Phone Number, Profile pic, Contact name, street address, city address, state address, and zip code.

  • Create, Read, and Delete invoices through MongoDB Invoice info includes: Customer info, date of service, invoice number, subtotal, tax percentage, corresponding tax, total price Currently, 5 states are available for auto tax calculation. They are:

    • NJ
    • NY
    • PA
    • CT
    • FL
    • For states othen than those, tax calculation is not available
    • Superseded in v1.21: all 50 states are supported.
  • Access individual customers profile, where it is possible to Read, Update, and Delete their personal information as well as read and delete their corresponding invoices.

  • Access Invoices from the main page, where they are organized by Recent to Old order Even invoices that had their corresponding company deleted can be accessed and downloaded

  • On the PDF page, it is possible to download the current invoice to a local directory, and it is not possible to save the pdf twice to prevent duplicates

  • Nav bar at the top with top of the page and home options is available on all pages

Home Page Components:

  • Line block to create Customers, Generate Invoice, and go to the invoices part

  • Customers Card part where is possible to access their profile page, edit, and delete their information

  • Invoices List part with all invoices organized recent to Old

Customers Profile Page Components:

  • Full customers info with options to update and delete their info

  • Invoices list with all the invoices that corresponds to the customer being accessed

Create Customer Page components:

  • Fields to enter all customer info, with checks and validations to essential fields, and formatting rules to some fields

  • Essential fields are: Company Name, Phone number, Email, Zip Code, Contact Name

  • The following fields require specific formats that are specified to the user: Phone number, Email, Zip Code

Edit Customer Page components:

  • Fields to edit every Customer Info

  • Same checks, validity, and formatting rules as in the Create Customer page

Generate Invoice Page components:

  • Ability to generate Invoices with pre-loaded Customer information

  • Update button that allows customer info to be changed before Invoice generation

  • fields for all invoice info and operations

  • generate button that directs the customer to the PDF page for a last check

PDF Page components:

  • Options to save invoice in the DB and edit it if any mistake is seen

  • Visualization of the final PDF with zoom, navigations, download options, and print options

V1.01

  • Added Version Log and Control to keep track of implementations and bugs fixed
    • "file-saver" dependency was added

PDF Page:

  • A download button was added so the file is downloaded with a personalized name that follows #invoice number - company name pattern for better organization

  • Fixed a bug that would crash the page if the user hit the home button while having information loaded

  • PDF title now also follows the pattern of #invoice number - company name

  • Save Invoice Button now becomes disabled after user saves it once to prevent duplicates

Create Customer page:

  • New rules for company name were added, these rules excludes characters that are not allowed by Windows directory. This change was made to prevent conflict when saving invoices

  • Visual effects for errors in formatting/verification were improved to help user see specifically which field is failing validation

  • Company Name is now a mandatory field for customer creation, while contact name is no longer a requirement

Edit Customer page:

  • Company name field were adapted to the new rules of windows directory characters

  • Visual effects for errors in formatting/verification were improved to help user see specifically which field is failing validation

  • Company Name is now a mandatory field, while contact name is no longer a requirement

V1.11

Invoice Page:

  • Introduced Table form as a alternative to Job Description. This is intended to make it easier to "itemize" and organize the invoice.

  • All necessary corrections and adjustments were done to support this new feature.

PdfPage:

  • Adjusted the pdf format to display, dynamically, the table content or the Job Description, depending on how the invoice was created.

v1.21

Table Invoice Component:

  • added a month filter component that will filter the invoices based on the month selected out of the calendar.

  • added download invoice option within the table, which is compatible with the month filtering and profile page invoices.

Create Page / Edit Page:

  • Phone number field now allows the input of 10 straight digits (XXXXXXXXXX) and will format it once unfocused.

  • All of 50 US States are now supported in this web application. All tax information was imported and is now available to use.

taxController:

  • refactored switch case function to a taxRateDictionary for cleaningness and effectiveness purposes.

PdfPage:

  • refactored the table styles components.

v1.22

API error handling:

  • Client mistakes no longer answer 500: a malformed id or an undecodable URL, a value of the wrong type and a disallowed CORS origin now answer 400 (or 403 for the origin), with no internal details in the message.
  • A duplicate-key error answers 409. Any other unexpected error answers 500 with a generic message; the real message is only logged.
  • The validators and the tax controller reject wrong-typed values (a number for a phone number, company name or state) instead of failing; an email over 150 characters is an invalid email, and a final price must be fully numeric.
  • Added a ForbiddenError (403) class.

v1.23

Customer integrity:

  • A customer's phone number is stored as its 10 digits ("(555) 123-4567" is saved as "5551234567"), and the unique index on phoneNumber makes the database refuse a duplicate. A phone number that matches another customer in any accepted format answers 409 on create and update.
  • The server builds the customer index before it starts listening, and exits with a clear error if it cannot.
  • A duplicate that reaches the database through a race answers 409 A record with this value already exists.
  • Customers already stored are not rewritten; a number stored in another format is not matched until the stored numbers are normalized.
  • The customer list caps limit at 100 and falls back to the defaults (limit 20, page 1) for a value that is not a whole number of 1 or more, instead of passing it to the database (a negative or non-numeric page no longer answers 500).

v1.24

Date of service:

  • dateOfService on an invoice is now a real calendar date written YYYY-MM-DD: POST /api/v1/invoices answers 400 Date of service must be a real date in YYYY-MM-DD format for a value that is not a string in that format or is not a real date (10/27/2026, 2026-02-30, 2026-13-01, a number).
  • It is stored as a Date at UTC midnight, and every answer that returns an invoice sends it back as YYYY-MM-DD, whatever the server time zone.
  • Invoices already stored are not rewritten (#141); a stored MM/DD/YYYY value is read in the server's local time and can come back a day off, and a value that is not a date is left out of the answer.

v1.25

Unique invoice numbers:

  • invoiceNumber on an invoice is now required: POST /api/v1/invoices answers 400 Invoice number is required for a missing, blank or non-string value. It stays a string and is stored trimmed, so prefixes such as INV-0042 keep working.
  • A unique index on invoiceNumber makes the database refuse a duplicate: an invoice whose number (after trimming, exact match) is already used answers 409 A record with this value already exists.
  • The index is partial, so invoices stored before this version without a number do not collide with each other.
  • The server builds the invoice index before it starts listening, next to the customer index. A local database that already holds duplicate invoice numbers cannot build it, so the server exits at startup with a clear error until the duplicates are resolved (the migration in #141 reports them). Invoices already stored are not rewritten.
  • The invoice page blocks a number already in the list and warns, without blocking, about a gap or a lower number; the PDF page shows the API's message when saving fails.

v1.26

Money in integer cents (ADR-012):

  • Every money amount on an invoice is an integer number of cents: subtotalCents, taxCents, finalPriceCents, and per line unitPriceCents and lineTotalCents. finalPrice, subtotal and tableData are gone from the model, replaced by these and lineItems: [{ description, quantity, unitPriceCents, lineTotalCents }]. taxRate stays a percentage (7.25) and is now required.
  • POST /api/v1/invoices computes the line totals, the subtotal, the tax and the final price on the server (ADR-004) and ignores any such figure the client sends. The tax rate comes from stateAddress, which is now required and must be a state in the tax table. With no lineItems, subtotalCents is required.
  • Rounding: a line total is quantity × unit price rounded half-up to a cent; the tax is subtotal × rate rounded half-up once for the invoice; the final price is their sum.
  • A float, negative or string amount (including "12abc"), a quantity of 0 or less or with more than 2 decimals, a blank description, and a missing or unknown state each answer 400. A result that is not a safe integer answers 400.
  • Invoices already stored keep their old dollar fields and show none of the new ones; they are converted in #141.

Tax calculation in cents:

  • POST /api/v1/tax/calculate takes { subtotalCents, taxRate } (was jobPrice and taxRate) and answers { subtotalCents, taxRate, taxCents, finalPriceCents } (was jobPrice, taxAmount, finalPrice), through the same functions as invoices.
  • Parsing is strict (#145): a numeric string or a partly numeric value such as "12abc" in either input answers 400. A rate has at most 3 decimals.
  • Every tax message, /tax/rate's included, now comes from RESPONSE_MESSAGES (ADR-005). /tax/rate answers as before.

v2.0

Every path moves to /api/v2:

  • Breaking: every endpoint is now under /api/v2/ (/api/v2/customers, /api/v2/invoices, /api/v2/tax). /api/v1/ is gone and has no alias: a request to it answers 404 Route not found. / now answers version: "v2.0". The frontend's API_ENDPOINTS uses the new paths.
  • The request and answer shapes are those of v1.26; nothing else changes in the API.

Migration of data stored before v2.0:

  • npm run migrate:v2 (NODEAPI/scripts/v2Migration.js) converts an existing database once; -- --dry-run lists everything and writes nothing. The procedure (stop the API, mongodump, dry run, run, check, restore) is in "Migrating a database from before v2.0" in Docs/README.md.
  • Customers: phone numbers become their 10 digits.
  • Invoices: dateOfService (MM/DD/YYYY or MMDDYYYY) becomes a Date at UTC midnight; invoiceNumber is trimmed; the money is recomputed by today's rules into lineItems, subtotalCents, taxCents, finalPriceCents and taxRate (the stored rate, or the state's when it has none), and finalPrice, subtotal and tableData are removed. An invoice with no line rows keeps its stored subtotal and has lineItems: [].
  • A final price can change by a cent or more, because the old rows were computed in floating point; each invoice whose final price changes is listed as a notice.
  • A record it cannot convert (an unreadable date, a bad line row, no state, a phone number that is not 10 digits) is left as it is and listed with its _id and the reason. Phone numbers that collide once normalized, and equal invoice numbers, are listed and left as they are, and the unique index that they block is not built; fix them by hand and run it again. Nothing is deleted or merged, and a second run changes nothing.