This commit is contained in:
2026-02-27 16:56:41 -08:00
parent d52ba6e59c
commit 6de30bd77e
17 changed files with 508 additions and 50 deletions
@@ -0,0 +1,18 @@
DELIMITER ;;
CREATE DEFINER=`root`@`%` PROCEDURE `sp_Student_GetByProgram`(
IN p_id_program CHAR(36)
)
BEGIN
SELECT
id_student,
id_program,
identifier,
program_year,
enrollment_date,
expected_grad,
created_at
FROM student
WHERE id_program = p_id_program
ORDER BY id_student;
END;;
DELIMITER ;
@@ -0,0 +1,21 @@
DELIMITER ;;
CREATE DEFINER=`root`@`%` PROCEDURE `sp_Student_GetByUserAndProgram`(
IN p_id_user CHAR(36),
IN p_id_program CHAR(36)
)
BEGIN
SELECT
s.id_student,
s.id_program,
s.identifier,
s.program_year,
s.enrollment_date,
s.expected_grad,
s.created_at
FROM student s
JOIN user_student us ON us.id_student = s.id_student
WHERE us.id_user = p_id_user
AND s.id_program = p_id_program
ORDER BY s.id_student;
END;;
DELIMITER ;
@@ -28,6 +28,22 @@ BEGIN
p_expected_grad,
UTC_TIMESTAMP()
);
INSERT INTO user_student
(
id_user_student,
id_user,
id_student,
is_primary
)
VALUES
(
UUID(),
p_id_user,
p_id_student,
1
);
SELECT
id_student,
id_program,
@@ -1,7 +1,6 @@
DELIMITER ;;
CREATE DEFINER=`root`@`%` PROCEDURE `sp_Student_Update`(
IN p_id_student CHAR(36),
IN p_id_program CHAR(36),
IN p_identifier VARCHAR(50),
IN p_program_year INT,
IN p_enrollment_date DATE,
@@ -10,7 +9,6 @@ CREATE DEFINER=`root`@`%` PROCEDURE `sp_Student_Update`(
BEGIN
UPDATE student
SET
id_program = COALESCE(p_id_program, id_program),
identifier = COALESCE(p_identifier, identifier),
program_year = COALESCE(p_program_year, program_year),
enrollment_date = COALESCE(p_enrollment_date, enrollment_date),