class Backend::Api::Context
- Backend::Api::Context
- GraphQL::Context
- Reference
- Object
Overview
GraphQL request context class
Defined in:
backend/api/context.crConstructors
- .new(status : Status, user : Db::User | Nil, admin : Bool | Nil, role : Schema::UserRole | Nil, external : Db::Teacher | Db::Student | Nil, jti : UUID | Nil)
- .new(headers : HTTP::Headers, status : Backend::Api::Context::Status = Status::OK, *rest)
Instance Method Summary
-
#admin : Bool?
User is admin
-
#admin! : Bool
User is admin
-
#admin? : Bool
User is admin
-
#authenticated! : Bool
User is authenticated
-
#authenticated? : Bool
User is authenticated
-
#external : Backend::Db::Student | Backend::Db::Teacher | Nil
User's external object
-
#handle_exception(ex : Exception) : String | Nil
Custom error handler
-
#jti : UUID?
JTI of request token
-
#loaders : Backend::Api::Loaders::DataLoaders
Dataloaders
- #on_development(&) : Nil
-
#role : Backend::Api::Schema::UserRole?
User's role
-
#role!(roles : Array(Schema::UserRole), external_check = true) : Bool
User's is one of roles
-
#role?(roles : Array(Schema::UserRole), external_check = true) : Bool
User's is one of roles
-
#status : Backend::Api::Context::Status
Request status
-
#student!(external_check = true) : Bool
User is student
-
#student?(external_check = true) : Bool
User is student
-
#teacher!(external_check = true) : Bool
User is teacher
-
#teacher?(external_check = true) : Bool
User is teacher
-
#user : Backend::Db::User?
Authenticated user
Constructor Detail
def self.new(status : Status, user : Db::User | Nil, admin : Bool | Nil, role : Schema::UserRole | Nil, external : Db::Teacher | Db::Student | Nil, jti : UUID | Nil)
#