-- phpMyAdmin SQL Dump
-- version 5.2.1
-- https://www.phpmyadmin.net/
--
-- Host: localhost
-- Generation Time: Apr 02, 2025 at 01:27 PM
-- Server version: 10.4.28-MariaDB
-- PHP Version: 8.2.4

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;

--
-- Database: `myfintech`
--

-- --------------------------------------------------------

--
-- Table structure for table `notifications`
--

CREATE TABLE `notifications` (
  `id` int(11) NOT NULL,
  `user_id` int(11) NOT NULL,
  `message` varchar(255) NOT NULL,
  `is_read` tinyint(1) DEFAULT 0,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `notifications`
--

INSERT INTO `notifications` (`id`, `user_id`, `message`, `is_read`, `created_at`) VALUES
(1, 1, 'Your deposit of GHS 200.00 was successful.', 1, '2025-03-26 20:14:14'),
(2, 1, 'Your deposit of GHS 5,000.00 was successful.', 1, '2025-03-26 20:22:52'),
(3, 1, 'Your deposit of GHS 6,000.00 was successful.', 1, '2025-03-26 20:23:40'),
(4, 1, 'Your deposit of GHS 20,000.00 was successful.', 1, '2025-03-26 20:28:57'),
(5, 1, 'Your deposit of GHS 500,000.00 was successful.', 1, '2025-03-26 20:34:46'),
(6, 1, 'Your deposit of GHS 100,000.00 was successful.', 1, '2025-03-26 20:39:31'),
(7, 1, 'Your deposit of GHS 500,000.00 was successful.', 1, '2025-03-26 21:42:01'),
(8, 1, 'Your deposit of GHS 700,000.00 was successful.', 1, '2025-03-26 21:44:17'),
(9, 1, 'Your deposit of GHS 100.00 was successful.', 1, '2025-03-28 12:25:35'),
(10, 1, 'Your deposit of GHS 100,000.00 was successful.', 1, '2025-03-28 12:36:11'),
(11, 1, 'Your deposit of GHS 50,000.00 was successful.', 1, '2025-03-30 21:59:48'),
(12, 2, 'Your deposit of GHS 600,000.00 was successful.', 1, '2025-03-30 23:47:26'),
(13, 2, 'Your deposit of Ghs25000 was successful.', 1, '2025-04-02 08:34:55'),
(14, 4, 'A user has made a deposit of Ghs25000.', 1, '2025-04-02 08:34:55'),
(15, 2, 'Your deposit of GHS 500,000.00 was successful.', 1, '2025-04-02 08:39:52'),
(16, 1, 'Your deposit of GHS 15,000.00 was successful.', 1, '2025-04-02 08:42:02'),
(17, 1, 'Your deposit of GHS 200,000.00 was successful.', 1, '2025-04-02 08:50:55'),
(18, 4, 'Bartels has made a deposit of GHS 200,000.00.', 1, '2025-04-02 08:50:55');

-- --------------------------------------------------------

--
-- Table structure for table `tbl_deposits`
--

CREATE TABLE `tbl_deposits` (
  `id` int(11) NOT NULL,
  `user_id` int(11) NOT NULL,
  `amount` decimal(10,2) NOT NULL,
  `phone` varchar(15) NOT NULL,
  `email` varchar(100) NOT NULL,
  `transaction_id` varchar(50) NOT NULL,
  `status` enum('pending','successful','failed') NOT NULL DEFAULT 'pending',
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `tbl_deposits`
--

INSERT INTO `tbl_deposits` (`id`, `user_id`, `amount`, `phone`, `email`, `transaction_id`, `status`, `created_at`) VALUES
(1, 1, 500.00, '0247698803', 'jonjaytron02@gmail.com', 'ld32od2x2c', 'successful', '2025-03-26 17:24:45'),
(2, 1, 500.00, '0247698803', 'jonjaytron02@gmail.com', 'v2e07yx40x', 'successful', '2025-03-26 17:25:22'),
(3, 1, 200.00, '0247698803', 'jonjaytron02@gmail.com', 'eywd2h9tir', 'successful', '2025-03-26 17:27:32'),
(4, 1, 1000.00, '0247698803', 'jonjaytron02@gmail.com', '5jkuyh2j0e', 'successful', '2025-03-26 17:32:00'),
(5, 1, 2500.00, '0247698803', 'jonjaytron02@gmail.com', 'st028j3y8a', 'successful', '2025-03-26 18:47:27'),
(6, 1, 3700.00, '0247698803', 'jonjaytron02@gmail.com', 'ftg7hyiini', 'successful', '2025-03-26 19:45:55'),
(7, 1, 200.00, '0247698803', 'jonjaytron02@gmail.com', 'z80vvllica', 'successful', '2025-03-26 20:14:14'),
(8, 1, 5000.00, '0247698803', 'jonjaytron02@gmail.com', '99kkjo62u0', 'successful', '2025-03-26 20:22:52'),
(9, 1, 6000.00, '0247698803', 'jonjaytron02@gmail.com', '3tud2zjrcf', 'successful', '2025-03-26 20:23:40'),
(10, 1, 20000.00, '0247698803', 'jonjaytron02@gmail.com', 'oi6wvpc7j4', 'successful', '2025-03-26 20:28:57'),
(11, 1, 500000.00, '0247698803', 'jonjaytron02@gmail.com', 'd68fxaz716', 'successful', '2025-03-26 20:34:46'),
(12, 1, 100000.00, '0247698803', 'jonjaytron02@gmail.com', 'hbifvuzuw0', 'successful', '2025-03-26 20:39:31'),
(13, 1, 500000.00, '0247698803', 'jonjaytron02@gmail.com', 'jm31gbpgdt', 'successful', '2025-03-26 21:42:01'),
(14, 1, 700000.00, '0247698803', 'jonjaytron02@gmail.com', 'yi1x1tmc4o', 'successful', '2025-03-26 21:44:17'),
(15, 1, 100.00, '0247698803', 'jonjaytron02@gmail.com', 'vfckhl9g7y', 'successful', '2025-03-28 12:25:35'),
(16, 1, 100000.00, '0247698803', 'jonjaytron02@gmail.com', 'uf2mjbxrpz', 'successful', '2025-03-28 12:36:11'),
(17, 1, 50000.00, '0247698803', 'jonjaytron02@gmail.com', '5m04iam2nk', 'successful', '2025-03-30 21:59:48'),
(18, 2, 600000.00, '0202930986', 'neocr8vmedia@gmail.com', 'hsrzumgjjt', 'successful', '2025-03-30 23:47:26'),
(19, 1, 100000.00, '0247698803', 'jonjaytron02@gmail.com', 'm0xtbypg99', 'successful', '2025-03-31 01:42:45'),
(20, 2, 20000.00, '0202930986', 'neocr8vmedia@gmail.com', '3yrnu2m2s3', 'successful', '2025-03-31 01:46:16'),
(21, 2, 450000.00, '0202930986', 'neocr8vmedia@gmail.com', 'w2qjrwi6gg', 'successful', '2025-03-31 02:21:00'),
(22, 2, 10000.00, '0202930986', 'neocr8vmedia@gmail.com', 'if01qxhw0i', 'successful', '2025-03-31 15:29:02'),
(23, 4, 80000.00, '0241234567', 'kwekuayumu@gmail.com', '1jl2j9enhh', 'successful', '2025-04-01 09:08:07'),
(24, 4, 20000.00, '0241234567', 'kwekuayumu@gmail.com', 'iac7bozgyy', 'successful', '2025-04-01 09:19:52'),
(25, 4, 5000.00, '0241234567', 'kwekuayumu@gmail.com', 'jftjd7leik', 'successful', '2025-04-01 09:30:18'),
(26, 4, 50000.00, '0241234567', 'kwekuayumu@gmail.com', '105bo7rhiq', 'successful', '2025-04-01 09:46:05'),
(27, 2, 10000.00, '0202930986', 'neocr8vmedia@gmail.com', '2j5gk6pyvq', 'successful', '2025-04-01 09:48:07'),
(28, 2, 80000.00, '0202930986', 'neocr8vmedia@gmail.com', 'oqs9091cfh', 'successful', '2025-04-02 08:03:03'),
(29, 2, 25000.00, '0202930986', 'neocr8vmedia@gmail.com', 'i1vv82nd4r', 'successful', '2025-04-02 08:34:55'),
(30, 2, 500000.00, '0202930986', 'neocr8vmedia@gmail.com', 'fh9lkgmgyx', 'successful', '2025-04-02 08:39:52'),
(31, 1, 15000.00, '0247698803', 'jonjaytron02@gmail.com', 'dmw05g8pog', 'successful', '2025-04-02 08:42:02'),
(32, 1, 200000.00, '0247698803', 'jonjaytron02@gmail.com', 'x2cqyqxw85', 'successful', '2025-04-02 08:50:55');

-- --------------------------------------------------------

--
-- Table structure for table `tbl_payouts`
--

CREATE TABLE `tbl_payouts` (
  `id` int(11) NOT NULL,
  `admin_id` int(11) NOT NULL,
  `recipient_name` varchar(255) NOT NULL,
  `phone` varchar(20) NOT NULL,
  `amount` decimal(10,2) NOT NULL,
  `status` enum('pending','approved','failed') DEFAULT 'pending',
  `paystack_transfer_code` varchar(100) DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `approved_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `tbl_payouts`
--

INSERT INTO `tbl_payouts` (`id`, `admin_id`, `recipient_name`, `phone`, `amount`, `status`, `paystack_transfer_code`, `created_at`, `approved_at`) VALUES
(1, 4, 'Jonjay', '0202930986', 10000.00, 'pending', NULL, '2025-04-01 03:25:56', NULL),
(2, 4, 'Jonjay', '0202930986', 200000.00, 'pending', NULL, '2025-04-01 03:26:09', NULL),
(3, 4, 'Jonjay', '0202930986', 3000.00, 'pending', NULL, '2025-04-01 11:08:34', NULL),
(4, 4, 'Jonjay', '0202930986', 50000.00, 'failed', NULL, '2025-04-01 11:37:47', NULL),
(5, 4, 'Jonjay', '0202930986', 50000.00, 'failed', NULL, '2025-04-01 11:45:22', NULL),
(6, 4, 'Jonjay', '0202930986', 200000.00, 'failed', NULL, '2025-04-01 11:45:30', NULL),
(7, 4, 'Jonjay', '0202930986', 200000.00, 'pending', NULL, '2025-04-01 11:51:37', NULL),
(8, 4, 'Jonjay', '0202930986', 10000.00, 'pending', NULL, '2025-04-01 12:23:08', NULL),
(9, 4, 'Jonjay', '0202930986', 5000.00, 'pending', NULL, '2025-04-01 13:00:25', NULL),
(10, 4, 'Jonjay', '0202930986', 10000.00, 'pending', NULL, '2025-04-01 13:12:17', NULL),
(11, 4, 'Jonjay', '0202930986', 10000.00, 'pending', NULL, '2025-04-01 13:13:58', NULL),
(12, 4, 'Jonjay', '0202930986', 60000.00, 'pending', NULL, '2025-04-01 13:14:01', NULL),
(13, 4, 'Jonjay', '0202930986', 600.00, 'pending', NULL, '2025-04-01 13:52:11', NULL),
(14, 4, 'Jonjay', '0202930986', 6700.00, 'pending', NULL, '2025-04-01 14:06:12', NULL),
(15, 4, 'Jonjay', '0202930986', 20000.00, 'pending', NULL, '2025-04-01 14:23:40', NULL),
(16, 4, 'Bartels', '0247698803', 6000.00, 'pending', NULL, '2025-04-02 10:47:05', NULL);

-- --------------------------------------------------------

--
-- Table structure for table `tbl_withdrawals`
--

CREATE TABLE `tbl_withdrawals` (
  `id` int(11) NOT NULL,
  `user_id` int(11) NOT NULL,
  `amount` decimal(10,2) NOT NULL,
  `status` enum('pending','completed','failed','approved','rejected') NOT NULL DEFAULT 'pending',
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `approved_at` datetime DEFAULT NULL,
  `rejected_at` datetime DEFAULT NULL,
  `processed_by` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `tbl_withdrawals`
--

INSERT INTO `tbl_withdrawals` (`id`, `user_id`, `amount`, `status`, `created_at`, `approved_at`, `rejected_at`, `processed_by`) VALUES
(1, 2, 10000.00, 'failed', '2025-03-31 23:08:50', NULL, NULL, NULL),
(3, 2, 200000.00, 'failed', '2025-04-01 00:14:43', NULL, NULL, NULL),
(4, 2, 200000.00, 'failed', '2025-04-01 00:15:32', NULL, NULL, NULL),
(5, 2, 200000.00, 'approved', '2025-04-01 00:18:02', '2025-04-01 03:26:09', NULL, 4),
(6, 2, 10000.00, 'approved', '2025-04-01 00:20:11', '2025-04-01 03:25:56', NULL, 4),
(7, 2, 50000.00, 'rejected', '2025-04-01 00:20:24', NULL, '2025-04-01 03:10:07', 4),
(8, 2, 30000.00, 'approved', '2025-04-01 00:23:06', '2025-04-01 03:09:51', NULL, 4),
(9, 2, 50000.00, 'failed', '2025-04-01 09:47:04', NULL, NULL, NULL),
(10, 2, 3000.00, 'approved', '2025-04-01 11:08:16', '2025-04-01 11:08:34', NULL, 4),
(11, 2, 5000.00, 'failed', '2025-04-01 13:00:14', NULL, NULL, NULL),
(12, 2, 10000.00, 'failed', '2025-04-01 13:12:04', NULL, NULL, NULL),
(13, 2, 60000.00, 'failed', '2025-04-01 13:13:50', NULL, NULL, NULL),
(14, 2, 600.00, 'failed', '2025-04-01 13:52:03', NULL, NULL, NULL),
(15, 2, 6700.00, 'failed', '2025-04-01 14:06:03', NULL, NULL, NULL),
(16, 2, 20000.00, 'failed', '2025-04-01 14:17:47', NULL, NULL, NULL),
(17, 1, 6000.00, 'failed', '2025-04-02 10:46:51', NULL, NULL, NULL);

-- --------------------------------------------------------

--
-- Table structure for table `transactions`
--

CREATE TABLE `transactions` (
  `id` int(11) NOT NULL,
  `user_id` int(11) NOT NULL,
  `type` enum('deposit','withdrawal') NOT NULL,
  `amount` decimal(10,2) NOT NULL,
  `status` enum('pending','completed','failed') DEFAULT 'pending',
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- --------------------------------------------------------

--
-- Table structure for table `users`
--

CREATE TABLE `users` (
  `id` int(11) NOT NULL,
  `username` varchar(100) NOT NULL,
  `email` varchar(255) NOT NULL,
  `password` varchar(255) NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `balance` decimal(10,2) NOT NULL DEFAULT 0.00,
  `phone` varchar(15) NOT NULL,
  `otp_code` varchar(10) DEFAULT NULL,
  `otp_verified` tinyint(1) DEFAULT 0,
  `role` enum('user','super-admin') NOT NULL DEFAULT 'user'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `users`
--

INSERT INTO `users` (`id`, `username`, `email`, `password`, `created_at`, `balance`, `phone`, `otp_code`, `otp_verified`, `role`) VALUES
(1, 'Bartels', 'jonjaytron02@gmail.com', '$2y$10$ZvF4n1qW0RyWLZehTA7i2Oya96rUxQMHJ2cRwKO0jr0k4q9NQkhfG', '2025-03-25 18:59:31', 2298700.00, '0247698803', NULL, 0, 'user'),
(2, 'Jonjay', 'neocr8vmedia@gmail.com', '$2y$10$k.MQeu1itfsivUGSk5Hs4u3zWoVR1DXiw6maa9jPMdYD9wxyLXqfy', '2025-03-30 23:43:27', 829700.00, '0202930986', NULL, 0, 'user'),
(4, 'Super Admin', 'kwekuayumu@gmail.com', '$2y$10$4PrR.WMh14ZbI.OuZiwyNuAuYdkgonjcfL/Y6uFMC4dWSDZUS1Iq2', '2025-03-31 00:22:33', 1720000.00, '0241234567', NULL, 1, 'super-admin');

--
-- Indexes for dumped tables
--

--
-- Indexes for table `notifications`
--
ALTER TABLE `notifications`
  ADD PRIMARY KEY (`id`),
  ADD KEY `user_id` (`user_id`);

--
-- Indexes for table `tbl_deposits`
--
ALTER TABLE `tbl_deposits`
  ADD PRIMARY KEY (`id`),
  ADD KEY `user_id` (`user_id`);

--
-- Indexes for table `tbl_payouts`
--
ALTER TABLE `tbl_payouts`
  ADD PRIMARY KEY (`id`),
  ADD KEY `admin_id` (`admin_id`);

--
-- Indexes for table `tbl_withdrawals`
--
ALTER TABLE `tbl_withdrawals`
  ADD PRIMARY KEY (`id`),
  ADD KEY `user_id` (`user_id`);

--
-- Indexes for table `transactions`
--
ALTER TABLE `transactions`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `users`
--
ALTER TABLE `users`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `username` (`username`),
  ADD UNIQUE KEY `email` (`email`),
  ADD UNIQUE KEY `phone` (`phone`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `notifications`
--
ALTER TABLE `notifications`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=19;

--
-- AUTO_INCREMENT for table `tbl_deposits`
--
ALTER TABLE `tbl_deposits`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=33;

--
-- AUTO_INCREMENT for table `tbl_payouts`
--
ALTER TABLE `tbl_payouts`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=17;

--
-- AUTO_INCREMENT for table `tbl_withdrawals`
--
ALTER TABLE `tbl_withdrawals`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=18;

--
-- AUTO_INCREMENT for table `transactions`
--
ALTER TABLE `transactions`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;

--
-- Constraints for dumped tables
--

--
-- Constraints for table `notifications`
--
ALTER TABLE `notifications`
  ADD CONSTRAINT `notifications_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `tbl_deposits`
--
ALTER TABLE `tbl_deposits`
  ADD CONSTRAINT `tbl_deposits_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `tbl_payouts`
--
ALTER TABLE `tbl_payouts`
  ADD CONSTRAINT `tbl_payouts_ibfk_1` FOREIGN KEY (`admin_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `tbl_withdrawals`
--
ALTER TABLE `tbl_withdrawals`
  ADD CONSTRAINT `tbl_withdrawals_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;
COMMIT;

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
