feat: Add comprehensive documentation suite and reorganize project structure

- Created complete documentation in docs/ directory
- Added PROJECT_OVERVIEW.md with feature highlights and getting started guide
- Added ARCHITECTURE.md with system design and technical details
- Added SECURITY.md with comprehensive security implementation guide
- Added DEVELOPMENT.md with development workflows and best practices
- Added DEPLOYMENT.md with production deployment instructions
- Added API.md with complete REST API documentation
- Added CONTRIBUTING.md with contribution guidelines
- Added CHANGELOG.md with version history and migration notes
- Reorganized all documentation files into docs/ directory for better organization
- Updated README.md with proper documentation links and quick navigation
- Enhanced project structure with professional documentation standards
This commit is contained in:
SamiAhmed7777
2025-10-21 00:39:45 -07:00
commit 0b7e2d0a5b
6080 changed files with 1332936 additions and 0 deletions

View File

@@ -0,0 +1,110 @@
<?php
namespace Donations;
class NotificationHandler {
private $db;
public function __construct() {
$this->db = db();
}
/**
* Create a new notification
*/
public function createNotification($streamer_id, $type, $title, $message, $donor_id = null) {
$sql = "INSERT INTO donation_notifications
(streamer_id, donor_id, type, title, message)
VALUES (?, ?, ?, ?, ?)";
return $this->db->insert($sql, [
$streamer_id,
$donor_id,
$type,
$title,
$message
]);
}
/**
* Get unread notifications for a streamer
*/
public function getUnreadNotifications($streamer_id, $limit = 10) {
$sql = "SELECT * FROM donation_notifications
WHERE streamer_id = ?
AND is_read = 0
ORDER BY created_at DESC
LIMIT ?";
return $this->db->getRows($sql, [$streamer_id, $limit]);
}
/**
* Get all notifications for a streamer
*/
public function getAllNotifications($streamer_id, $limit = 20) {
$sql = "SELECT * FROM donation_notifications
WHERE streamer_id = ?
ORDER BY created_at DESC
LIMIT ?";
return $this->db->getRows($sql, [$streamer_id, $limit]);
}
/**
* Mark notifications as read
*/
public function markAsRead($notification_ids) {
if (empty($notification_ids)) {
return false;
}
$placeholders = str_repeat('?,', count($notification_ids) - 1) . '?';
$sql = "UPDATE donation_notifications
SET is_read = 1
WHERE notification_id IN ($placeholders)";
return $this->db->query($sql, $notification_ids);
}
/**
* Get notification count
*/
public function getUnreadCount($streamer_id) {
$sql = "SELECT COUNT(*) as count
FROM donation_notifications
WHERE streamer_id = ?
AND is_read = 0";
$result = $this->db->getRow($sql, [$streamer_id]);
return $result['count'];
}
/**
* Delete old notifications
*/
public function cleanupOldNotifications($days = 30) {
$sql = "DELETE FROM donation_notifications
WHERE created_at < DATE_SUB(NOW(), INTERVAL ? DAY)";
return $this->db->query($sql, [$days]);
}
/**
* Get notification by ID
*/
public function getNotification($notification_id) {
$sql = "SELECT * FROM donation_notifications WHERE notification_id = ?";
return $this->db->getRow($sql, [$notification_id]);
}
/**
* Mark all notifications as read
*/
public function markAllAsRead($streamer_id) {
$sql = "UPDATE donation_notifications
SET is_read = 1
WHERE streamer_id = ?";
return $this->db->query($sql, [$streamer_id]);
}
}