34 lines
666 B
Crystal
34 lines
666 B
Crystal
require "graphql"
|
|
|
|
module API
|
|
module Schema
|
|
@[GraphQL::Object]
|
|
class TeacherVote < GraphQL::BaseObject
|
|
include Helpers::DbObject
|
|
|
|
db_object Db::TeacherVote
|
|
|
|
@[GraphQL::Field]
|
|
def teacher : Teacher
|
|
Teacher.new(find!.teacher.not_nil!)
|
|
end
|
|
|
|
@[GraphQL::Field]
|
|
def priority : Int32
|
|
find!.priority
|
|
end
|
|
end
|
|
|
|
@[GraphQL::InputObject]
|
|
class TeacherVoteCreateInput < GraphQL::BaseInputObject
|
|
getter vote_id
|
|
getter teacher_id
|
|
getter priority
|
|
|
|
@[GraphQL::Field]
|
|
def initialize(@vote_id : Int32, @teacher_id : Int32, @priority : Int32)
|
|
end
|
|
end
|
|
end
|
|
end
|