Spaces:
Running
Running
Update main.py
Browse files
main.py
CHANGED
@@ -39,8 +39,18 @@ c.execute('''CREATE TABLE IF NOT EXISTS users
|
|
39 |
(id INTEGER PRIMARY KEY AUTOINCREMENT, username TEXT UNIQUE, password TEXT)''')
|
40 |
|
41 |
c.execute('''CREATE TABLE IF NOT EXISTS user_details
|
42 |
-
(id INTEGER PRIMARY KEY AUTOINCREMENT,
|
43 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
|
45 |
c.execute('''CREATE TABLE IF NOT EXISTS user_mentor
|
46 |
(id INTEGER PRIMARY KEY AUTOINCREMENT, user_id INTEGER, mentor_name TEXT,
|
@@ -181,7 +191,7 @@ def add_mentor():
|
|
181 |
try:
|
182 |
with open("mentor.txt", "a") as file:
|
183 |
file.write(mentor_details)
|
184 |
-
return jsonify({"message": "Mentor added
|
185 |
except Exception as e:
|
186 |
return jsonify({"message": f"Failed to add mentor: {str(e)}"}), 500
|
187 |
|
|
|
39 |
(id INTEGER PRIMARY KEY AUTOINCREMENT, username TEXT UNIQUE, password TEXT)''')
|
40 |
|
41 |
c.execute('''CREATE TABLE IF NOT EXISTS user_details
|
42 |
+
(id INTEGER PRIMARY KEY AUTOINCREMENT,
|
43 |
+
user_id INTEGER UNIQUE,
|
44 |
+
first_name TEXT,
|
45 |
+
last_name TEXT,
|
46 |
+
school_name TEXT,
|
47 |
+
bachelors_degree TEXT,
|
48 |
+
masters_degree TEXT,
|
49 |
+
certification TEXT,
|
50 |
+
activity TEXT,
|
51 |
+
country TEXT,
|
52 |
+
FOREIGN KEY(user_id) REFERENCES users(id))''')
|
53 |
+
|
54 |
|
55 |
c.execute('''CREATE TABLE IF NOT EXISTS user_mentor
|
56 |
(id INTEGER PRIMARY KEY AUTOINCREMENT, user_id INTEGER, mentor_name TEXT,
|
|
|
191 |
try:
|
192 |
with open("mentor.txt", "a") as file:
|
193 |
file.write(mentor_details)
|
194 |
+
return jsonify({"message": "Mentor will added after verification"}), 201
|
195 |
except Exception as e:
|
196 |
return jsonify({"message": f"Failed to add mentor: {str(e)}"}), 500
|
197 |
|