# Database Model Summary

---

**Document Version:** 1.0
**Project:** Student Bazaar
**Document Type:** Database Model Summary
**Status:** Approved
**Last Updated:** 28 June 2026
**Author:** Nemmi Tangha

---

# Overview

Student Bazaar Version 1 uses a normalized relational database built on MySQL and accessed through Flask-SQLAlchemy.

The database is organized into logical domains to improve maintainability, scalability, and clarity.

The Version 1 design consists of **18 core tables**.

---

# Authentication

| Table | Purpose |
|--------|---------|
| users | Stores authentication and account information for all registered users and Super Admins |
| user_profiles | Stores user profile information |
| email_verifications | Stores email verification tokens |
| password_reset_tokens | Stores password reset requests |

---

# Marketplace

| Table          | Purpose                          |
| -------------- | -------------------------------- |
| categories     | Product categories               |
| listings       | Marketplace listings             |
| listing_images | Product images (1–7 per listing) |
| favorites      | User favorite listings           |

---

# Negotiation

| Table  | Purpose                                                |
| ------ | ------------------------------------------------------ |
| offers | Stores all offers, counter-offers, and accepted offers |

---

# Communication

| Table         | Purpose                                             |
| ------------- | --------------------------------------------------- |
| chat          | Conversation between buyer and seller for a listing |
| messages      | Chat messages within conversations                  |

---

# Meet-up

| Table   | Purpose                              |
| ------- | ------------------------------------ |
| meetups | Stores scheduled meet-up information |

---

# Notifications

| Table         | Purpose            |
| ------------- | ------------------ |
| notifications | User notifications |

---

# Administration

| Table                 | Purpose                            |
| --------------------- | ---------------------------------- |
| reports               | Reports submitted by students      |
| advertisements        | Banner and rewarded advertisements |
| premium_subscriptions | Premium membership information     |
| admin_logs            | Administrative audit logs          |

---

# System Configuration

| Table           | Purpose                                  |
| --------------- | ---------------------------------------- |
| system_settings | Stores configurable application settings |

Examples include:

* Chat message limit
* Rewarded ad unlock amount
* Maximum listing images
* Listing expiration period

---

# Design Principles

The database follows these principles:

* Third Normal Form (3NF)
* Referential Integrity
* High Cohesion
* Low Coupling
* Soft Deletes where appropriate
* Scalable Architecture
* Auditability
* Security by Design

---

# Business Rules

* One account can both buy and sell.
* Listings require a minimum of 1 and a maximum of 7 images.
* One conversation exists per buyer, seller, and listing combination.
* Each participant is counted independently from their first message.
* Free users receive 10 messages per conversation (per participant).
* One rewarded advertisement unlocks 5 additional messages.
* Premium users receive unlimited messaging.
* Offers maintain complete negotiation history.
* Meet-ups can only be scheduled after an offer has been accepted.
* Student Bazaar does not process payments or facilitate financial transactions.
* Platform behavior is configurable through the `system_settings` table.
---

# Conclusion

This database model represents the approved Version 1 architecture for Student Bazaar. All future database schemas, SQLAlchemy models, APIs, and business logic must follow this design unless a formal architectural revision is approved.
