-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Correctly implement a subscription for pin updates, and removed the m…
…anual refresh button
- Loading branch information
Ben Lerner
committed
Nov 18, 2023
1 parent
05d0694
commit 637046b
Showing
5 changed files
with
92 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# frozen_string_literal: true | ||
|
||
module Subscriptions | ||
class PinWasUpdated < Subscriptions::BaseSubscription | ||
argument :exam_id, ID, required: true, loads: Types::ExamType | ||
|
||
field :registration, Types::RegistrationType, null: false | ||
|
||
def authorized?(exam:) | ||
return true if exam.proctors.exists? context[:current_user].id | ||
return true if exam.professors.exists? context[:current_user].id | ||
|
||
raise GraphQL::ExecutionError, 'You do not have permission.' | ||
end | ||
|
||
def update(exam:) | ||
{ | ||
registration: object, | ||
} | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters