# Mentorenwahl: A fullstack application for assigning mentors to students based on their whishes. # Copyright (C) 2022 Dominic Grimm # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . module Backend module Api module Schema @[GraphQL::Object] # Teacher vote model class TeacherVote < GraphQL::BaseObject include Helpers::DbObject db_object Db::TeacherVote @[GraphQL::Field] # Voted teacher def teacher : Teacher Teacher.new(find!.teacher.not_nil!) end @[GraphQL::Field] # Teacher vote's priority def priority : Int32 find!.priority end end @[GraphQL::InputObject] # Teacher vote creation input class TeacherVoteCreateInput < GraphQL::BaseInputObject # Teacher vote's vote ID getter vote_id # Teacher vote's teacher ID getter teacher_id # Teacher vote's priority getter priority @[GraphQL::Field] def initialize(@vote_id : Int32, @teacher_id : Int32, @priority : Int32) end end end end end