TG-104 : Ajout sec_id dans la BDD
This commit is contained in:
parent
28ae3bf218
commit
dc8b8a4bda
@ -21,6 +21,6 @@ UserInfoAPI (api/userInfo)
|
||||
#######################
|
||||
GET -> Get the current logged user, return None if no one is connected
|
||||
Out:
|
||||
200 -> USER = <USER_OBJECT>|None : Dictionnary containing user infos or None
|
||||
200 -> USER = <USER_OBJECT>|None : Dictionary containing user infos or None
|
||||
|
||||
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
Reference in New Issue
Block a user