mentorenwahl/frontend/graphql/schema.graphql

98 lines
1.6 KiB
GraphQL

type Config {
minimumTeacherSelectionCount: Int!
}
type Query {
admins: [User!]
allStudentsVoted: Boolean
config: Config!
me: User
ok: Boolean!
student(id: Int!): Student
students: [Student!]
studentsCanVote: Boolean!
teacher(id: Int!): Teacher!
teacherVote(id: Int!): TeacherVote
teacherVotes: [TeacherVote!]
teachers: [Teacher!]!
user(id: Int!): User
userByUsername(username: String!): User
users: [User!]
vote(id: Int!): Vote
votes: [Vote!]
}
type Student {
id: Int!
user: User!
vote: Vote
}
type Teacher {
id: Int!
maxStudents: Int!
teacherVotes: [TeacherVote!]!
user: User!
}
type TeacherVote {
id: Int!
priority: Int!
teacher: Teacher!
vote: Vote!
}
type User {
admin: Boolean!
email: String!
externalId: Int!
firstName: String!
id: Int!
lastName: String!
name(formal: Boolean! = true): String!
role: UserRole!
student: Student
teacher: Teacher
username: String!
}
enum UserRole {
Student
Teacher
}
type Vote {
id: Int!
student: Student!
teacherVotes: [TeacherVote!]!
}
type LoginPayload {
bearer: String!
token: String!
user: User!
}
type Mutation {
assignStudents: Boolean
createUser(checkLdap: Boolean! = true, input: UserCreateInput!): User
createVote(input: VoteCreateInput!): Vote
deleteUser(id: Int!): Int
login(password: String!, username: String!): LoginPayload
registerTeacher(input: TeacherInput!): Teacher
}
input TeacherInput {
maxStudents: Int!
}
input UserCreateInput {
username: String!
role: UserRole!
admin: Boolean! = false
}
input VoteCreateInput {
teacherIds: [Int!]!
}