A student portal project that acts as an online portal between students and the admin built using GraphQL with Django.
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
python manage.py makemigrations
python manage.py migrate
python manage.py runserver
query {
users {
id
email
username
isActive
isSuperuser
dateJoined
}
}
query user($userId: ID!) {
user(userId: $userId) {
id
email
username
isActive
isSuperuser
dateJoined
}
}
variables = {"userId": 1}
query {
courses {
id
name
description
}
}
query course($courseId: ID!) {
course(courseId: $courseId) {
id
name
description
}
}
variables = {"courseId": 1}
query {
students {
id
email
username
isActive
course {
id
name
description
}
}
}
query student($studentId: ID!) {
student(studentId:$studentId) {
id
email
username
isActive
course {
id
name
description
}
}
}
variables = {"studentId": 1}
mutation createCourse($name: String!, $description: String!) {
createCourse(name: $name, description: $description) {
course {
id
name
description
}
}
}
variables = {name:"course name", description:"course description"}
mutation createStudent($username: String!, $email: String!, $firstName: String!, $lastName: String!, $gender: String!,
$password: String!, courseId: Int!, isActive: String!) {
createStudent(username: $username, email: $email, firstName: $firstName, lastName: $lastName, gender: $gender,
password: $password, courseId: $courseId, isActive: $isActive) {
student {
id
username
email
firstName
lastName
gender
password
isActive
course {
id
name
description
}
}
}
}
variables = {
username:"tomas", email:"tomas@gmail.com", firstName:"dollar", lastName:"tomas", gender:"female",
password:"tomas123", courseId:1, isActive: "t"}
mutation updateCourse($pk: ID!, $name: String, $description: String) {
updateCourse(pk: $pk, name: $name, description: $description) {
course {
id
name
description
}
}
}
variables = {pk:2, name: "updated name", description: "updated description"}
mutation updateStudent($pk: ID!, $username: String, $email: String, $firstName: String, $lastName: String,
$gender: String, $password: String, courseId: Int, isActive: String) {
updateStudent(pk: $pk, username: $username, email: $email, firstName: $firstName, lastName: $lastName, gender: $gender,
password: $password, courseId: $courseId, isActive: $isActive) {
student {
id
username
email
firstName
lastName
gender
password
isActive
course {
id
name
description
}
}
}
}
variables = {
pk:1, username:"manuel", email:"manuel@gmail.com", firstName:"dollar", lastName:"dominic", gender:"male",
password:"Password123", courseId:1, isActive: "t"}
mutation deleteCourse($pk: ID!) {
deleteCourse(pk: $pk) {
message
}
}
variables = {"pk": 1}
mutation ($pk: ID!) {
deleteStudent(pk: $pk) {
message
}
}
variables = {"pk": 1}