Commit bea95e41 authored by ras19's avatar ras19
Browse files

Included get methods in assignment blueprint [RS, EW]

parent 4f12505c
Pipeline #202626 passed with stage
in 40 seconds
......@@ -5,6 +5,25 @@ from backend.models.user_model import User_project
user_project = Blueprint('user_project', __name__)
@user_project.route('/user_project', methods=['GET'])
def get_all_assignments():
project_query = User_project.query.all()
projects_list = [{"username" : x.username,
"project_id" : x.project_id,
"id" : x.id} for x in project_query]
return jsonify(projects_list)
@user_project.route('/user_project/<assignment_id>', methods=['GET'])
def get_project(assignment_id):
entry = User_project.query.get(assignment_id)
return jsonify(
username=entry.username,
project_id=entry.project_id,
id=entry.id
)
@user_project.route('/user_project', methods=['POST'])
def assign_project_to_user():
username, project_id = (request.json['username'], request.json['project_id'])
......
......@@ -9,6 +9,7 @@ const CreateProject = () => {
const [tag, setTag] = useState("Other");
const [location, setLocation] = useState("");
const [files, setFiles] = useState("");
const [selectUsers, setSelectUsers] = useState([]);
const [username, setUsername] = useState("");
const [pid, setPid] = useState("");
......
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