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

49 lines
924 B
Crystal

module Backend
module API
module Schema
@[GraphQL::Object]
class Student < GraphQL::BaseObject
include Helpers::DbObject
db_object Db::Student
@[GraphQL::Field]
def user : User
User.new(find!.user)
end
@[GraphQL::Field]
def skif : Bool
find!.skif
end
@[GraphQL::Field]
def vote : Vote?
vote = find!.vote
Vote.new(vote) if vote
end
end
@[GraphQL::InputObject]
class StudentInput < GraphQL::BaseInputObject
getter skif
@[GraphQL::Field]
def initialize(@skif : Bool)
end
end
@[GraphQL::InputObject]
class StudentCreateInput < StudentInput
getter user_id
@[GraphQL::Field]
def initialize(@user_id : Int32, skif : Bool)
super(skif)
end
end
end
end
end