add: added routes and improved frontend

This commit is contained in:
Lukian 2025-04-27 18:23:16 +02:00
parent 37c96f5341
commit 94e4d5750f
15 changed files with 1039 additions and 172 deletions

View file

@ -2,8 +2,8 @@
-- version 5.2.1
-- https://www.phpmyadmin.net/
--
-- Host: leizour.fr
-- Generation Time: Apr 09, 2025 at 02:41 PM
-- Host: mysql
-- Generation Time: Apr 27, 2025 at 01:27 PM
-- Server version: 10.11.3-MariaDB-1:10.11.3+maria~ubu2204
-- PHP Version: 8.1.19
@ -20,6 +20,8 @@ SET time_zone = "+00:00";
--
-- Database: `bank`
--
CREATE DATABASE IF NOT EXISTS `bank` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
USE `bank`;
-- --------------------------------------------------------
@ -27,12 +29,14 @@ SET time_zone = "+00:00";
-- Table structure for table `accounts`
--
CREATE TABLE `accounts` (
`id` int(11) NOT NULL,
`balance` bigint(20) NOT NULL,
CREATE TABLE IF NOT EXISTS `accounts` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`balance` bigint(20) NOT NULL DEFAULT 0,
`client_id` int(11) NOT NULL,
`name` varchar(20) NOT NULL,
`interest` float NOT NULL DEFAULT 0
`interest` float NOT NULL DEFAULT 0,
PRIMARY KEY (`id`),
KEY `client_id` (`client_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
-- --------------------------------------------------------
@ -41,12 +45,14 @@ CREATE TABLE `accounts` (
-- Table structure for table `cards`
--
CREATE TABLE `cards` (
`id` int(11) NOT NULL,
CREATE TABLE IF NOT EXISTS `cards` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`account_id` int(11) NOT NULL,
`number` int(11) NOT NULL,
`expiration` timestamp NOT NULL,
`cvc` int(11) NOT NULL
`cvc` int(11) NOT NULL,
PRIMARY KEY (`id`),
KEY `account_id` (`account_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
-- --------------------------------------------------------
@ -55,12 +61,15 @@ CREATE TABLE `cards` (
-- Table structure for table `transfers`
--
CREATE TABLE `transfers` (
`id` int(11) NOT NULL,
CREATE TABLE IF NOT EXISTS `transfers` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`account_from_id` int(11) NOT NULL,
`account_to_id` int(11) NOT NULL,
`name` varchar(30) NOT NULL,
`value` int(11) NOT NULL
`value` int(11) NOT NULL,
PRIMARY KEY (`id`),
KEY `account_from_id` (`account_from_id`),
KEY `account_to_id` (`account_to_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
-- --------------------------------------------------------
@ -69,71 +78,39 @@ CREATE TABLE `transfers` (
-- Table structure for table `users`
--
CREATE TABLE `users` (
`id` int(11) NOT NULL,
CREATE TABLE IF NOT EXISTS `users` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(20) NOT NULL,
`lastname` varchar(20) NOT NULL,
`password` varchar(150) NOT NULL,
`email` varchar(100) NOT NULL,
`numero` varchar(20) NOT NULL,
`admin` tinyint(1) NOT NULL
`admin` tinyint(1) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
--
-- Indexes for dumped tables
-- Constraints for dumped tables
--
--
-- Indexes for table `accounts`
-- Constraints for table `accounts`
--
ALTER TABLE `accounts`
ADD PRIMARY KEY (`id`);
ADD CONSTRAINT `client_id` FOREIGN KEY (`client_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Indexes for table `cards`
-- Constraints for table `cards`
--
ALTER TABLE `cards`
ADD PRIMARY KEY (`id`);
ADD CONSTRAINT `account_id` FOREIGN KEY (`account_id`) REFERENCES `accounts` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Indexes for table `transfers`
-- Constraints for table `transfers`
--
ALTER TABLE `transfers`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `accounts`
--
ALTER TABLE `accounts`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `cards`
--
ALTER TABLE `cards`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `transfers`
--
ALTER TABLE `transfers`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
ADD CONSTRAINT `account_from_id` FOREIGN KEY (`account_from_id`) REFERENCES `accounts` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `account_to_id` FOREIGN KEY (`account_to_id`) REFERENCES `accounts` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;