mentorenwahl/docker/backend/src/backend/api/schema/teacher.cr
Dominic Grimm 5bc10f8aaf
Some checks failed
continuous-integration/drone/push Build is failing
Added worker
2022-01-23 09:12:57 +01:00

48 lines
986 B
Crystal

module Backend
module API
module Schema
@[GraphQL::Object]
class Teacher < GraphQL::BaseObject
include Helpers::DbObject
db_object Db::Teacher
@[GraphQL::Field]
def user : User
User.new(find!.user)
end
@[GraphQL::Field]
def max_students : Int32
find!.max_students
end
@[GraphQL::Field]
def skif : Bool
find!.skif
end
end
@[GraphQL::InputObject]
class TeacherInput < GraphQL::BaseInputObject
getter max_students
getter skif
@[GraphQL::Field]
def initialize(@max_students : Int32, @skif : Bool)
end
end
@[GraphQL::InputObject]
class TeacherCreateInput < TeacherInput
getter user_id
@[GraphQL::Field]
def initialize(@user_id : Int32, max_students : Int32, skif : Bool)
super(max_students, skif)
end
end
end
end
end