Commit 3a6737de authored by itzi Enriquez's avatar itzi Enriquez

Bd y postman

parent 1a9d19a6
{
"info": {
"_postman_id": "75e3ece4-e1b7-4208-bcce-aabff425c92a",
"name": "italika",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
"_exporter_id": "6244507",
"_collection_link": "https://orange-star-720077.postman.co/workspace/CEECI~033b1a61-e93b-4086-8fdb-229c17412248/collection/6244507-75e3ece4-e1b7-4208-bcce-aabff425c92a?action=share&source=collection_link&creator=6244507"
},
"item": [
{
"name": "login",
"event": [
{
"listen": "test",
"script": {
"exec": [
"var jsonData = JSON.parse(responseBody);\r",
"console.log(jsonData.data.token)\r",
"postman.setEnvironmentVariable(\"token\", jsonData.data.token);"
],
"type": "text/javascript",
"packages": {}
}
}
],
"request": {
"auth": {
"type": "noauth"
},
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\r\n \"username\": \"itzi\",\r\n \"password\": \"root\"\r\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "http://localhost:7854/auth/login",
"protocol": "http",
"host": [
"localhost"
],
"port": "7854",
"path": [
"auth",
"login"
]
}
},
"response": []
},
{
"name": "listarProductos",
"event": [
{
"listen": "test",
"script": {
"exec": [
""
],
"type": "text/javascript",
"packages": {}
}
}
],
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{token}}",
"type": "string"
}
]
},
"method": "GET",
"header": [],
"url": {
"raw": "http://localhost:7854/api/v1/productos",
"protocol": "http",
"host": [
"localhost"
],
"port": "7854",
"path": [
"api",
"v1",
"productos"
]
}
},
"response": []
},
{
"name": "crear",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{token}}",
"type": "string"
}
]
},
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\r\n \"nombre\": \"freno\",\r\n \"descripcion\": \"freno 23Q1\",\r\n \"precio\": 230.76,\r\n \"cantidad\": 1\r\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "http://localhost:7854/api/v1/productos/crear",
"protocol": "http",
"host": [
"localhost"
],
"port": "7854",
"path": [
"api",
"v1",
"productos",
"crear"
]
}
},
"response": []
},
{
"name": "UPDATE",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{token}}",
"type": "string"
}
]
},
"method": "PUT",
"header": [],
"body": {
"mode": "raw",
"raw": "{\r\n \"nombre\": \"update\",\r\n \"descripcion\": \"ringupdate\",\r\n \"precio\": 400.0,\r\n \"cantidad\": 1\r\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "http://localhost:7854/api/v1/productos/3",
"protocol": "http",
"host": [
"localhost"
],
"port": "7854",
"path": [
"api",
"v1",
"productos",
"3"
]
}
},
"response": []
},
{
"name": "delete",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{token}}",
"type": "string"
}
]
},
"method": "DELETE",
"header": [],
"url": {
"raw": "http://localhost:7854/api/v1/productos/4",
"protocol": "http",
"host": [
"localhost"
],
"port": "7854",
"path": [
"api",
"v1",
"productos",
"4"
]
}
},
"response": []
}
]
}
\ No newline at end of file
-- ----------------------------
-- Table structure for c_rol
-- ----------------------------
DROP TABLE IF EXISTS `c_rol`;
CREATE TABLE `c_rol` (
`id_rol` int NOT NULL AUTO_INCREMENT,
`clave` varchar(50) NOT NULL,
`nombre` varchar(150) NOT NULL,
`fecha_alta` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
`fecha_baja` timestamp NULL DEFAULT NULL,
`fecha_modifica` timestamp NULL DEFAULT NULL,
`es_global` tinyint(1) NULL DEFAULT NULL,
PRIMARY KEY (`id_rol`) USING BTREE,
UNIQUE INDEX `clave`(`clave` ASC) USING BTREE
) ;
-- ----------------------------
-- Records of c_rol
-- ----------------------------
INSERT INTO `c_rol` VALUES (1, 'ROLE_ADMIN', 'ADMINISTRACION', '2025-03-27 20:05:21', NULL, NULL, 1);
INSERT INTO `c_rol` VALUES (2, 'ROLE_USER', 'USER', '2025-03-27 20:05:21', NULL, NULL, 1);
INSERT INTO `c_rol` VALUES (10, 'ROLE_CAP', 'CAP', '2025-04-23 20:04:46', NULL, NULL, NULL);
-- ----------------------------
-- Table structure for productos
-- ----------------------------
DROP TABLE IF EXISTS `productos`;
CREATE TABLE `productos` (
`id_producto` int NOT NULL AUTO_INCREMENT,
`nombre` varchar(100) NOT NULL,
`descripcion` varchar(255) DEFAULT NULL,
`precio` decimal(10, 2) NOT NULL,
`cantidad` int NOT NULL,
`estatus` bit(1) NULL DEFAULT b'1',
PRIMARY KEY (`id_producto`) USING BTREE
) ;
-- ----------------------------
-- Records of productos
-- ----------------------------
INSERT INTO `productos` VALUES (1, 'update', 'ringupdate', 400.00, 1, b'1');
INSERT INTO `productos` VALUES (2, 'rin2', 'ring de222 moto 20', 2400.00, 6, b'1');
INSERT INTO `productos` VALUES (3, 'rin2', 'ring de222 moto 20', 2400.00, 6, b'0');
INSERT INTO `productos` VALUES (4, 'freno', 'freno 23Q1', 230.76, 1, b'0');
INSERT INTO `productos` VALUES (5, 'freno', 'freno 23Q1', 230.76, 1, b'1');
-- ----------------------------
-- Table structure for tbl_persona
-- ----------------------------
DROP TABLE IF EXISTS `tbl_persona`;
CREATE TABLE `tbl_persona` (
`id_persona` int NOT NULL AUTO_INCREMENT,
`nombres` varchar(255) DEFAULT NULL,
`a_paterno` varchar(255) DEFAULT NULL,
`a_materno` varchar(255) DEFAULT NULL,
`curp` varchar(255) DEFAULT NULL,
`direccion` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id_persona`) USING BTREE
) ;
-- ----------------------------
-- Records of tbl_persona
-- ----------------------------
INSERT INTO `tbl_persona` VALUES (1, 'itzi', 'enriquez', 'rosas', '176363', 'prueba allende');
-- ----------------------------
-- Table structure for tbl_usuario
-- ----------------------------
DROP TABLE IF EXISTS `tbl_usuario`;
CREATE TABLE `tbl_usuario` (
`id_persona` int NULL DEFAULT NULL,
`id_usuario` int NOT NULL AUTO_INCREMENT,
`correo` varchar(255) DEFAULT NULL,
`password` varchar(255) DEFAULT NULL,
`username` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id_usuario`) USING BTREE,
INDEX `FK2invwrnc1grlqw4oux5741udk`(`id_persona` ASC) USING BTREE,
CONSTRAINT `tbl_usuario_ibfk_1` FOREIGN KEY (`id_persona`) REFERENCES `tbl_persona` (`id_persona`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ;
-- ----------------------------
-- Records of tbl_usuario
-- ----------------------------
INSERT INTO `tbl_usuario` VALUES (1, 1, 'itzi@itlika.com', 'root', 'itzi');
-- ----------------------------
-- Table structure for tbl_usuario_rol
-- ----------------------------
DROP TABLE IF EXISTS `tbl_usuario_rol`;
CREATE TABLE `tbl_usuario_rol` (
`id_ususario_rol` int NOT NULL AUTO_INCREMENT,
`id_rol` int NULL DEFAULT NULL,
`id_usuario` int NULL DEFAULT NULL,
PRIMARY KEY (`id_ususario_rol`) USING BTREE,
INDEX `id_rol`(`id_rol` ASC) USING BTREE,
INDEX `id_usuario`(`id_usuario` ASC) USING BTREE,
CONSTRAINT `tbl_usuario_rol_ibfk_1` FOREIGN KEY (`id_rol`) REFERENCES `c_rol` (`id_rol`) ON DELETE RESTRICT ON UPDATE RESTRICT,
CONSTRAINT `tbl_usuario_rol_ibfk_2` FOREIGN KEY (`id_usuario`) REFERENCES `tbl_usuario` (`id_usuario`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ;
-- ----------------------------
-- Records of tbl_usuario_rol
-- ----------------------------
INSERT INTO `tbl_usuario_rol` VALUES (1, 2, 1);
-- ----------------------------
-- Procedure structure for sp_actualizar_producto
-- ----------------------------
DROP PROCEDURE IF EXISTS `sp_actualizar_producto`;
delimiter ;;
CREATE DEFINER=`root`@`%` PROCEDURE `sp_actualizar_producto`(
IN p_id_producto BIGINT,
IN p_nombre VARCHAR(100),
IN p_descripcion VARCHAR(255),
IN p_precio DECIMAL(10, 2),
IN p_cantidad INT
);
BEGIN
UPDATE productos
SET nombre = p_nombre,
descripcion = p_descripcion,
precio = p_precio,
cantidad = p_cantidad
WHERE id_producto = p_id_producto;
END
;;
delimiter ;
-- ----------------------------
-- Procedure structure for sp_crear_producto
-- ----------------------------
DROP PROCEDURE IF EXISTS `sp_crear_producto`;
delimiter ;;
CREATE DEFINER=`root`@`%` PROCEDURE `sp_crear_producto`(
IN p_nombre VARCHAR(100),
IN p_descripcion VARCHAR(255),
IN p_precio DECIMAL(10, 2),
IN p_cantidad INT
)
BEGIN
INSERT INTO productos (nombre, descripcion, precio, cantidad)
VALUES (p_nombre, p_descripcion, p_precio, p_cantidad);
END
;;
delimiter ;
-- ----------------------------
-- Procedure structure for sp_eliminar_producto
-- ----------------------------
DROP PROCEDURE IF EXISTS `sp_eliminar_producto`;
delimiter ;;
CREATE DEFINER=`root`@`%` PROCEDURE `sp_eliminar_producto`(
IN p_id_producto BIGINT
)
BEGIN
UPDATE productos
SET estatus = 0
WHERE id_producto = p_id_producto;
END
;;
delimiter ;
-- ----------------------------
-- Procedure structure for sp_obtener_productos
-- ----------------------------
DROP PROCEDURE IF EXISTS `sp_obtener_productos`;
delimiter ;;
CREATE DEFINER=`root`@`%` PROCEDURE `sp_obtener_productos`()
BEGIN
SELECT * FROM productos;
END
;;
delimiter ;
-- ----------------------------
-- Procedure structure for sp_obtener_producto_por_id
-- ----------------------------
DROP PROCEDURE IF EXISTS `sp_obtener_producto_por_id`;
delimiter ;;
CREATE DEFINER=`root`@`%` PROCEDURE `sp_obtener_producto_por_id`(IN p_id_producto BIGINT)
BEGIN
SELECT * FROM productos WHERE id_producto = p_id_producto;
END
;;
delimiter ;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment