diff --git a/API_Interfaces.txt b/API_Interfaces.txt index 0219930..2af2eaa 100644 --- a/API_Interfaces.txt +++ b/API_Interfaces.txt @@ -21,6 +21,6 @@ UserInfoAPI (api/userInfo) ####################### GET -> Get the current logged user, return None if no one is connected Out: - 200 -> USER = |None : Dictionnary containing user infos or None + 200 -> USER = |None : Dictionary containing user infos or None diff --git a/backend/OLA.mysql b/backend/OLA.mysql index e64984d..7d5ac6f 100644 --- a/backend/OLA.mysql +++ b/backend/OLA.mysql @@ -23,14 +23,15 @@ CREATE TABLE IF NOT EXISTS SETTINGS CREATE TABLE IF NOT EXISTS `GROUP` ( - id BIGINT NOT NULL AUTO_INCREMENT, - `name` VARCHAR(128) NOT NULL UNIQUE, - `year` CHARACTER(4) NOT NULL, - class_short VARCHAR(128) NOT NULL, - class_long VARCHAR(512), - department VARCHAR(256), - resp_id BIGINT, - ressources_dir VARCHAR(512), + id BIGINT NOT NULL AUTO_INCREMENT, + `name` VARCHAR(128) NOT NULL UNIQUE, + `year` CHARACTER(4) NOT NULL, + class_short VARCHAR(128) NOT NULL, + class_long VARCHAR(512), + department VARCHAR(256), + resp_id BIGINT, + sec_id BIGINT, + ressources_dir VARCHAR(512), PRIMARY KEY(id) ) ENGINE = INNODB; @@ -96,7 +97,11 @@ CREATE TABLE IF NOT EXISTS HASHTABLE # Create FKs ALTER TABLE `GROUP` ADD FOREIGN KEY (resp_id) - REFERENCES `USER`(id) + REFERENCES `USER`(id); + +ALTER TABLE `GROUP` + ADD FOREIGN KEY (sec_id) +REFERENCES `USER` (id) ; ALTER TABLE TUTORSHIP diff --git a/backend/tests/api/test_Auth.py b/backend/tests/api/test_Auth.py index f8a6b0a..b13869f 100644 --- a/backend/tests/api/test_Auth.py +++ b/backend/tests/api/test_Auth.py @@ -18,7 +18,8 @@ class AuthTestCase(unittest.TestCase): res = query.execute() cls.uid = res.lastrowid query = GROUP.insert().values(name="test", year="2017", class_long="classe toto", class_short="toto", - department="plop", ressources_dir="/plop/toto", resp_id=cls.uid) + department="plop", ressources_dir="/plop/toto", resp_id=cls.uid, + sec_id=cls.uid) res = query.execute() cls.gid = res.lastrowid query = TUTORSHIP.insert().values(student_id=cls.uid, ptutor_id=cls.uid, group_id=cls.gid)