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

32 lines
669 B
Crystal

module Backend
module API
module Schema
@[GraphQL::Object]
class Vote < GraphQL::BaseObject
include Helpers::DbObject
db_object Db::Vote
@[GraphQL::Field]
def student : Student
Student.new(find!.student)
end
@[GraphQL::Field]
def teacher_votes : Array(TeacherVote)
find!.teacher_votes.map { |tv| TeacherVote.new(tv) }
end
end
@[GraphQL::InputObject]
class VoteCreateInput < GraphQL::BaseInputObject
getter teacher_ids
@[GraphQL::Field]
def initialize(@teacher_ids : Array(Int32))
end
end
end
end
end