Commit 56c82b25 authored by ras19's avatar ras19
Browse files

Changed delete_user to remove dependencies in other tables. Added variable in...

Changed delete_user to remove dependencies in other tables. Added variable in forloop in get_projects_for_user for clarity [RS, EW]
parent f8c1b6e9
Pipeline #202932 passed with stage
in 1 minute and 5 seconds
......@@ -27,13 +27,13 @@ def get_users_for_project(project_id):
@user_project.route('/user_project/username/<username>', methods=['GET'])
def get_projects_for_user(username):
entries = User_project.query.filter_by(username=username)
project_list = [{"id" : Project.query.get(x.project_id).id,
"name" : Project.query.get(x.project_id).name,
"status" : Project.query.get(x.project_id).status,
"description" : Project.query.get(x.project_id).description,
"tag" : Project.query.get(x.project_id).tag,
"location" : Project.query.get(x.project_id).location,
"files" : Project.query.get(x.project_id).files} for x in entries]
project_list = [{"id" :,
"name" :,
"status" : query.status,
"description" : query.description,
"tag" : query.tag,
"location" : query.location,
"files" : query.files} for query in (Project.query.get(x.project_id) for x in entries)]
return jsonify(project_list)
@user_project.route('/user_project', methods=['POST'])
from flask import Blueprint, request, jsonify, Response
from backend.database_config.database import DB
from backend.models.user_model import User
from backend.models.user_model import User_project
import bcrypt
user = Blueprint('user', __name__)
......@@ -90,9 +91,14 @@ def update_user(username):
@user.route('/users/<username>', methods=['DELETE'])
def delete_user(username):
if username == "jaimeaguilera":
return ''
entries = User_project.query.filter_by(username=username)
for e in entries:
entry = User.query.get(username)
return ''
Supports Markdown
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