Lab 2 – Donor CRM

Lab 2 Deliverable Overview


Lab 2: API Flow Diagram (Excalidraw)

Steps to describe diagram

  1. Client Request:
  2. Server Processing:
  3. Database Interaction:
  4. Client Response:

Lab 2.1: Database / JSON Logic

Sample JSON from /api/donors/recent:

[
  {
    "id": 1,
    "name": "Jane Doe",
    "email": "jane@mail.com",
    "amountLastYear": 150,
    "lastContactDate": "2025-11-01"
  },
  {
    "id": 2,
    "name": "John Smith",
    "email": "john@mail.com",
    "amountLastYear": 200,
    "lastContactDate": "2025-10-15"
  }
]

Explanation (200+ words):

Each donor has basic information like id, name, and email, along with donation details such as amountLastYear and lastContactDate. When the app needs to show recent donors, it asks the database for all donors and organizes them by who was contacted most recently. The server then converts each database entry into a simple JSON format that the app can understand. This approach lets the app display donor information dynamically without having any data permanently written into the code. The id field is a unique number for each donor, which ensures the system can correctly update records or send emails to the right person. The lastContactDate field helps staff members know who needs to be contacted soon, while amountLastYear quickly shows how much each person donated. By using JSON to organize and send data, the system keeps different parts separate: the app handles what users see, the server manages getting and processing data, and the database stores all the records safely. This organized structure makes the system easier to update and expand as the organization grows.

Database Query Logic Example: