fix question query load
This commit is contained in:
@@ -1,2 +1,4 @@
|
|||||||
GOOGLE_OAUTH_CLIENT_ID=
|
GOOGLE_OAUTH_CLIENT_ID=
|
||||||
GOOGLE_OAUTH_CLIENT_SECRET=
|
GOOGLE_OAUTH_CLIENT_SECRET=
|
||||||
|
|
||||||
|
WIRIS_PLUGIN_SRC=https://www.wiris.net/demo/plugins/app/WIRISplugins.js?viewer=image
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
class ProgressTestSchema < GraphQL::Schema
|
class ProgressTestSchema < GraphQL::Schema
|
||||||
DEFINITION_DUMP_PATH = "app/graphql/__generated__/schema.graphql"
|
DEFINITION_DUMP_PATH = "app/javascript/__generated__/schema.graphql"
|
||||||
|
|
||||||
mutation(Types::MutationType)
|
mutation(Types::MutationType)
|
||||||
query(Types::QueryType)
|
query(Types::QueryType)
|
||||||
@@ -30,11 +30,14 @@ class ProgressTestSchema < GraphQL::Schema
|
|||||||
|
|
||||||
# Return a string UUID for `object`
|
# Return a string UUID for `object`
|
||||||
def self.id_from_object(object, type_definition, query_ctx)
|
def self.id_from_object(object, type_definition, query_ctx)
|
||||||
object.to_gid_param
|
# object.to_gid_param
|
||||||
|
GraphQL::Schema::UniqueWithinType.encode(type_definition.name, object.id)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Given a string UUID, find the object
|
# Given a string UUID, find the object
|
||||||
def self.object_from_id(global_id, query_ctx)
|
def self.object_from_id(global_id, query_ctx)
|
||||||
GlobalID.find(global_id)
|
# GlobalID.find(global_id)
|
||||||
|
type_name, item_id = GraphQL::Schema::UniqueWithinType.decode(global_id)
|
||||||
|
type_name.constantize.model.find(item_id)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,6 +1,15 @@
|
|||||||
module Types
|
module Types
|
||||||
class BaseConnection < Types::BaseObject
|
class BaseConnection < Types::BaseObject
|
||||||
# add `nodes` and `pageInfo` fields, as well as `edge_type(...)` and `node_nullable(...)` overrides
|
|
||||||
include GraphQL::Types::Relay::ConnectionBehaviors
|
include GraphQL::Types::Relay::ConnectionBehaviors
|
||||||
|
|
||||||
|
edges_nullable(false)
|
||||||
|
edge_nullable(false)
|
||||||
|
node_nullable(false)
|
||||||
|
|
||||||
|
field :total_count, Integer, null: false
|
||||||
|
|
||||||
|
def total_count
|
||||||
|
object.items.count
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -7,8 +7,6 @@ module Types
|
|||||||
graphql_name 'Question'
|
graphql_name 'Question'
|
||||||
|
|
||||||
global_id_field :id
|
global_id_field :id
|
||||||
field :user_id, Integer, null: false
|
|
||||||
field :subject_id, Integer
|
|
||||||
field :authorship, String
|
field :authorship, String
|
||||||
field :authorship_year, String
|
field :authorship_year, String
|
||||||
field :body, String
|
field :body, String
|
||||||
@@ -17,6 +15,10 @@ module Types
|
|||||||
field :intention, String
|
field :intention, String
|
||||||
field :references, String
|
field :references, String
|
||||||
field :support, String
|
field :support, String
|
||||||
|
field :user, Types::UserType, null: false
|
||||||
|
field :subject, Types::SubjectType
|
||||||
|
field :reviewer, Types::UserType
|
||||||
|
field :review_messages, Types::ReviewMessageType.connection_type, null: false
|
||||||
field :alternatives, [Types::QuestionAlternativeType], null: false
|
field :alternatives, [Types::QuestionAlternativeType], null: false
|
||||||
field :bloom_taxonomy, Enums::QuestionBloomTaxonomyEnum
|
field :bloom_taxonomy, Enums::QuestionBloomTaxonomyEnum
|
||||||
field :check_type, Enums::QuestionCheckTypeEnum
|
field :check_type, Enums::QuestionCheckTypeEnum
|
||||||
@@ -24,5 +26,9 @@ module Types
|
|||||||
field :status, Enums::QuestionStatusEnum, null: false
|
field :status, Enums::QuestionStatusEnum, null: false
|
||||||
field :created_at, GraphQL::Types::ISO8601DateTime, null: false
|
field :created_at, GraphQL::Types::ISO8601DateTime, null: false
|
||||||
field :updated_at, GraphQL::Types::ISO8601DateTime, null: false
|
field :updated_at, GraphQL::Types::ISO8601DateTime, null: false
|
||||||
|
|
||||||
|
def self.model
|
||||||
|
Question
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
4716
app/javascript/__generated__/graphql-schema.json
generated
4716
app/javascript/__generated__/graphql-schema.json
generated
File diff suppressed because it is too large
Load Diff
256
app/javascript/__generated__/graphql-schema.ts
generated
256
app/javascript/__generated__/graphql-schema.ts
generated
@@ -1,4 +1,5 @@
|
|||||||
export type Maybe<T> = T | null;
|
export type Maybe<T> = T | null;
|
||||||
|
export type InputMaybe<T> = Maybe<T>;
|
||||||
export type Exact<T extends { [key: string]: unknown }> = { [K in keyof T]: T[K] };
|
export type Exact<T extends { [key: string]: unknown }> = { [K in keyof T]: T[K] };
|
||||||
export type MakeOptional<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]?: Maybe<T[SubKey]> };
|
export type MakeOptional<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]?: Maybe<T[SubKey]> };
|
||||||
export type MakeMaybe<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]: Maybe<T[SubKey]> };
|
export type MakeMaybe<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]: Maybe<T[SubKey]> };
|
||||||
@@ -31,9 +32,9 @@ export type Category = {
|
|||||||
|
|
||||||
/** Autogenerated input type of CreateQuestion */
|
/** Autogenerated input type of CreateQuestion */
|
||||||
export type CreateQuestionInput = {
|
export type CreateQuestionInput = {
|
||||||
question: QuestionCreateInput;
|
|
||||||
/** A unique identifier for the client performing the mutation. */
|
/** A unique identifier for the client performing the mutation. */
|
||||||
clientMutationId?: Maybe<Scalars['String']>;
|
clientMutationId?: InputMaybe<Scalars['String']>;
|
||||||
|
question: QuestionCreateInput;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Autogenerated return type of CreateQuestion */
|
/** Autogenerated return type of CreateQuestion */
|
||||||
@@ -48,9 +49,9 @@ export type CreateQuestionPayload = {
|
|||||||
|
|
||||||
/** Autogenerated input type of CreateReviewMessage */
|
/** Autogenerated input type of CreateReviewMessage */
|
||||||
export type CreateReviewMessageInput = {
|
export type CreateReviewMessageInput = {
|
||||||
message: ReviewMessageInput;
|
|
||||||
/** A unique identifier for the client performing the mutation. */
|
/** A unique identifier for the client performing the mutation. */
|
||||||
clientMutationId?: Maybe<Scalars['String']>;
|
clientMutationId?: InputMaybe<Scalars['String']>;
|
||||||
|
message: ReviewMessageInput;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Autogenerated return type of CreateReviewMessage */
|
/** Autogenerated return type of CreateReviewMessage */
|
||||||
@@ -64,15 +65,15 @@ export type CreateReviewMessagePayload = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export type DateRangeInput = {
|
export type DateRangeInput = {
|
||||||
startAt: Scalars['ISO8601Date'];
|
|
||||||
endAt: Scalars['ISO8601Date'];
|
endAt: Scalars['ISO8601Date'];
|
||||||
|
startAt: Scalars['ISO8601Date'];
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Autogenerated input type of DestroyQuestion */
|
/** Autogenerated input type of DestroyQuestion */
|
||||||
export type DestroyQuestionInput = {
|
export type DestroyQuestionInput = {
|
||||||
questionId: Scalars['ID'];
|
|
||||||
/** A unique identifier for the client performing the mutation. */
|
/** A unique identifier for the client performing the mutation. */
|
||||||
clientMutationId?: Maybe<Scalars['String']>;
|
clientMutationId?: InputMaybe<Scalars['String']>;
|
||||||
|
questionId: Scalars['ID'];
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Autogenerated return type of DestroyQuestion */
|
/** Autogenerated return type of DestroyQuestion */
|
||||||
@@ -87,9 +88,9 @@ export type DestroyQuestionPayload = {
|
|||||||
|
|
||||||
/** Autogenerated input type of FinishQuestion */
|
/** Autogenerated input type of FinishQuestion */
|
||||||
export type FinishQuestionInput = {
|
export type FinishQuestionInput = {
|
||||||
questionId: Scalars['ID'];
|
|
||||||
/** A unique identifier for the client performing the mutation. */
|
/** A unique identifier for the client performing the mutation. */
|
||||||
clientMutationId?: Maybe<Scalars['String']>;
|
clientMutationId?: InputMaybe<Scalars['String']>;
|
||||||
|
questionId: Scalars['ID'];
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Autogenerated return type of FinishQuestion */
|
/** Autogenerated return type of FinishQuestion */
|
||||||
@@ -102,8 +103,6 @@ export type FinishQuestionPayload = {
|
|||||||
question?: Maybe<Question>;
|
question?: Maybe<Question>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export type Mutation = {
|
export type Mutation = {
|
||||||
__typename?: 'Mutation';
|
__typename?: 'Mutation';
|
||||||
createQuestion?: Maybe<CreateQuestionPayload>;
|
createQuestion?: Maybe<CreateQuestionPayload>;
|
||||||
@@ -181,27 +180,27 @@ export type QueryNodesArgs = {
|
|||||||
|
|
||||||
|
|
||||||
export type QueryQuestionsArgs = {
|
export type QueryQuestionsArgs = {
|
||||||
after?: Maybe<Scalars['String']>;
|
after?: InputMaybe<Scalars['String']>;
|
||||||
before?: Maybe<Scalars['String']>;
|
before?: InputMaybe<Scalars['String']>;
|
||||||
first?: Maybe<Scalars['Int']>;
|
first?: InputMaybe<Scalars['Int']>;
|
||||||
last?: Maybe<Scalars['Int']>;
|
last?: InputMaybe<Scalars['Int']>;
|
||||||
where?: Maybe<QuestionWhereInput>;
|
where?: InputMaybe<QuestionWhereInput>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
export type QueryReviewersArgs = {
|
export type QueryReviewersArgs = {
|
||||||
after?: Maybe<Scalars['String']>;
|
after?: InputMaybe<Scalars['String']>;
|
||||||
before?: Maybe<Scalars['String']>;
|
before?: InputMaybe<Scalars['String']>;
|
||||||
first?: Maybe<Scalars['Int']>;
|
first?: InputMaybe<Scalars['Int']>;
|
||||||
last?: Maybe<Scalars['Int']>;
|
last?: InputMaybe<Scalars['Int']>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
export type QuerySubjectsArgs = {
|
export type QuerySubjectsArgs = {
|
||||||
after?: Maybe<Scalars['String']>;
|
after?: InputMaybe<Scalars['String']>;
|
||||||
before?: Maybe<Scalars['String']>;
|
before?: InputMaybe<Scalars['String']>;
|
||||||
first?: Maybe<Scalars['Int']>;
|
first?: InputMaybe<Scalars['Int']>;
|
||||||
last?: Maybe<Scalars['Int']>;
|
last?: InputMaybe<Scalars['Int']>;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type Question = Node & {
|
export type Question = Node & {
|
||||||
@@ -220,9 +219,8 @@ export type Question = Node & {
|
|||||||
intention?: Maybe<Scalars['String']>;
|
intention?: Maybe<Scalars['String']>;
|
||||||
references?: Maybe<Scalars['String']>;
|
references?: Maybe<Scalars['String']>;
|
||||||
reviewMessages: ReviewMessageConnection;
|
reviewMessages: ReviewMessageConnection;
|
||||||
reviewRequests: Array<ReviewRequest>;
|
|
||||||
reviewer?: Maybe<User>;
|
reviewer?: Maybe<User>;
|
||||||
status?: Maybe<QuestionStatus>;
|
status: QuestionStatus;
|
||||||
subject?: Maybe<Subject>;
|
subject?: Maybe<Subject>;
|
||||||
support?: Maybe<Scalars['String']>;
|
support?: Maybe<Scalars['String']>;
|
||||||
updatedAt: Scalars['ISO8601DateTime'];
|
updatedAt: Scalars['ISO8601DateTime'];
|
||||||
@@ -231,10 +229,10 @@ export type Question = Node & {
|
|||||||
|
|
||||||
|
|
||||||
export type QuestionReviewMessagesArgs = {
|
export type QuestionReviewMessagesArgs = {
|
||||||
after?: Maybe<Scalars['String']>;
|
after?: InputMaybe<Scalars['String']>;
|
||||||
before?: Maybe<Scalars['String']>;
|
before?: InputMaybe<Scalars['String']>;
|
||||||
first?: Maybe<Scalars['Int']>;
|
first?: InputMaybe<Scalars['Int']>;
|
||||||
last?: Maybe<Scalars['Int']>;
|
last?: InputMaybe<Scalars['Int']>;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type QuestionAlternative = {
|
export type QuestionAlternative = {
|
||||||
@@ -244,30 +242,30 @@ export type QuestionAlternative = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export type QuestionAlternativeInput = {
|
export type QuestionAlternativeInput = {
|
||||||
correct?: Maybe<Scalars['Boolean']>;
|
correct?: InputMaybe<Scalars['Boolean']>;
|
||||||
text?: Maybe<Scalars['String']>;
|
text?: InputMaybe<Scalars['String']>;
|
||||||
};
|
};
|
||||||
|
|
||||||
export enum QuestionBloomTaxonomy {
|
export enum QuestionBloomTaxonomy {
|
||||||
Remember = 'remember',
|
Analyze = 'ANALYZE',
|
||||||
Understand = 'understand',
|
Apply = 'APPLY',
|
||||||
Apply = 'apply',
|
Create = 'CREATE',
|
||||||
Analyze = 'analyze',
|
Evaluate = 'EVALUATE',
|
||||||
Evaluate = 'evaluate',
|
Remember = 'REMEMBER',
|
||||||
Create = 'create'
|
Understand = 'UNDERSTAND'
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum QuestionCheckType {
|
export enum QuestionCheckType {
|
||||||
UniqueAnswer = 'unique_answer',
|
AssertionAndReason = 'ASSERTION_AND_REASON',
|
||||||
IncompleteAffirmation = 'incomplete_affirmation',
|
Association = 'ASSOCIATION',
|
||||||
MultipleAnswer = 'multiple_answer',
|
ConstantAlternatives = 'CONSTANT_ALTERNATIVES',
|
||||||
NegativeFocus = 'negative_focus',
|
Gap = 'GAP',
|
||||||
AssertionAndReason = 'assertion_and_reason',
|
IncompleteAffirmation = 'INCOMPLETE_AFFIRMATION',
|
||||||
Gap = 'gap',
|
Interpretation = 'INTERPRETATION',
|
||||||
Interpretation = 'interpretation',
|
MultipleAnswer = 'MULTIPLE_ANSWER',
|
||||||
Association = 'association',
|
NegativeFocus = 'NEGATIVE_FOCUS',
|
||||||
OrderingOrRanking = 'ordering_or_ranking',
|
OrderingOrRanking = 'ORDERING_OR_RANKING',
|
||||||
ConstantAlternatives = 'constant_alternatives'
|
UniqueAnswer = 'UNIQUE_ANSWER'
|
||||||
}
|
}
|
||||||
|
|
||||||
/** The connection type for Question. */
|
/** The connection type for Question. */
|
||||||
@@ -283,27 +281,27 @@ export type QuestionConnection = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export type QuestionCreateInput = {
|
export type QuestionCreateInput = {
|
||||||
instruction: Scalars['String'];
|
|
||||||
support: Scalars['String'];
|
|
||||||
body: Scalars['String'];
|
|
||||||
alternatives: Array<QuestionAlternativeInput>;
|
alternatives: Array<QuestionAlternativeInput>;
|
||||||
explanation: Scalars['String'];
|
|
||||||
references: Scalars['String'];
|
|
||||||
authorshipYear: Scalars['String'];
|
|
||||||
authorship: Scalars['String'];
|
authorship: Scalars['String'];
|
||||||
intention?: Maybe<Scalars['String']>;
|
authorshipYear: Scalars['String'];
|
||||||
|
bloomTaxonomy?: InputMaybe<QuestionBloomTaxonomy>;
|
||||||
|
body: Scalars['String'];
|
||||||
|
checkType?: InputMaybe<QuestionCheckType>;
|
||||||
|
difficulty?: InputMaybe<QuestionDifficulty>;
|
||||||
|
explanation: Scalars['String'];
|
||||||
|
instruction: Scalars['String'];
|
||||||
|
intention?: InputMaybe<Scalars['String']>;
|
||||||
|
references: Scalars['String'];
|
||||||
|
reviewerUserId?: InputMaybe<Scalars['ID']>;
|
||||||
status: QuestionStatus;
|
status: QuestionStatus;
|
||||||
checkType?: Maybe<QuestionCheckType>;
|
subjectId?: InputMaybe<Scalars['ID']>;
|
||||||
difficulty?: Maybe<QuestionDifficulty>;
|
support: Scalars['String'];
|
||||||
bloomTaxonomy?: Maybe<QuestionBloomTaxonomy>;
|
|
||||||
subjectId?: Maybe<Scalars['ID']>;
|
|
||||||
reviewerUserId?: Maybe<Scalars['ID']>;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export enum QuestionDifficulty {
|
export enum QuestionDifficulty {
|
||||||
Easy = 'easy',
|
Easy = 'EASY',
|
||||||
Medium = 'medium',
|
Hard = 'HARD',
|
||||||
Hard = 'hard'
|
Medium = 'MEDIUM'
|
||||||
}
|
}
|
||||||
|
|
||||||
/** An edge in a connection. */
|
/** An edge in a connection. */
|
||||||
@@ -316,42 +314,42 @@ export type QuestionEdge = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export enum QuestionStatus {
|
export enum QuestionStatus {
|
||||||
Draft = 'DRAFT',
|
|
||||||
WaitingReview = 'WAITING_REVIEW',
|
|
||||||
WithRequestedChanges = 'WITH_REQUESTED_CHANGES',
|
|
||||||
Approved = 'APPROVED',
|
Approved = 'APPROVED',
|
||||||
Registered = 'REGISTERED'
|
Draft = 'DRAFT',
|
||||||
|
Registered = 'REGISTERED',
|
||||||
|
WaitingReview = 'WAITING_REVIEW',
|
||||||
|
WithRequestedChanges = 'WITH_REQUESTED_CHANGES'
|
||||||
}
|
}
|
||||||
|
|
||||||
export type QuestionUpdateInput = {
|
export type QuestionUpdateInput = {
|
||||||
instruction: Scalars['String'];
|
|
||||||
support: Scalars['String'];
|
|
||||||
body: Scalars['String'];
|
|
||||||
alternatives: Array<QuestionAlternativeInput>;
|
alternatives: Array<QuestionAlternativeInput>;
|
||||||
explanation: Scalars['String'];
|
|
||||||
references: Scalars['String'];
|
|
||||||
authorshipYear: Scalars['String'];
|
|
||||||
authorship: Scalars['String'];
|
authorship: Scalars['String'];
|
||||||
intention?: Maybe<Scalars['String']>;
|
authorshipYear: Scalars['String'];
|
||||||
status: QuestionStatus;
|
bloomTaxonomy?: InputMaybe<QuestionBloomTaxonomy>;
|
||||||
checkType?: Maybe<QuestionCheckType>;
|
body: Scalars['String'];
|
||||||
difficulty?: Maybe<QuestionDifficulty>;
|
checkType?: InputMaybe<QuestionCheckType>;
|
||||||
bloomTaxonomy?: Maybe<QuestionBloomTaxonomy>;
|
difficulty?: InputMaybe<QuestionDifficulty>;
|
||||||
subjectId?: Maybe<Scalars['ID']>;
|
explanation: Scalars['String'];
|
||||||
reviewerUserId?: Maybe<Scalars['ID']>;
|
|
||||||
id: Scalars['ID'];
|
id: Scalars['ID'];
|
||||||
|
instruction: Scalars['String'];
|
||||||
|
intention?: InputMaybe<Scalars['String']>;
|
||||||
|
references: Scalars['String'];
|
||||||
|
reviewerUserId?: InputMaybe<Scalars['ID']>;
|
||||||
|
status: QuestionStatus;
|
||||||
|
subjectId?: InputMaybe<Scalars['ID']>;
|
||||||
|
support: Scalars['String'];
|
||||||
};
|
};
|
||||||
|
|
||||||
export type QuestionWhereInput = {
|
export type QuestionWhereInput = {
|
||||||
checkType?: Maybe<Array<QuestionCheckType>>;
|
authorshipYear?: InputMaybe<Array<Scalars['String']>>;
|
||||||
status?: Maybe<Array<QuestionStatus>>;
|
bloomTaxonomy?: InputMaybe<Array<QuestionBloomTaxonomy>>;
|
||||||
difficulty?: Maybe<Array<QuestionDifficulty>>;
|
checkType?: InputMaybe<Array<QuestionCheckType>>;
|
||||||
bloomTaxonomy?: Maybe<Array<QuestionBloomTaxonomy>>;
|
createDate?: InputMaybe<DateRangeInput>;
|
||||||
authorshipYear?: Maybe<Array<Scalars['String']>>;
|
difficulty?: InputMaybe<Array<QuestionDifficulty>>;
|
||||||
subjectId?: Maybe<Scalars['ID']>;
|
status?: InputMaybe<Array<QuestionStatus>>;
|
||||||
userId?: Maybe<Scalars['ID']>;
|
subjectId?: InputMaybe<Scalars['ID']>;
|
||||||
createDate?: Maybe<DateRangeInput>;
|
unifesoAuthorship?: InputMaybe<Scalars['Boolean']>;
|
||||||
unifesoAuthorship?: Maybe<Scalars['Boolean']>;
|
userId?: InputMaybe<Scalars['ID']>;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type ReviewMessage = {
|
export type ReviewMessage = {
|
||||||
@@ -387,44 +385,15 @@ export type ReviewMessageEdge = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export enum ReviewMessageFeedbackType {
|
export enum ReviewMessageFeedbackType {
|
||||||
RequestChanges = 'REQUEST_CHANGES',
|
Answer = 'ANSWER',
|
||||||
Approve = 'APPROVE',
|
Approve = 'APPROVE',
|
||||||
Answer = 'ANSWER'
|
RequestChanges = 'REQUEST_CHANGES'
|
||||||
}
|
}
|
||||||
|
|
||||||
export type ReviewMessageInput = {
|
export type ReviewMessageInput = {
|
||||||
feedbackType: ReviewMessageFeedbackType;
|
feedbackType: ReviewMessageFeedbackType;
|
||||||
text: Scalars['String'];
|
|
||||||
questionId: Scalars['ID'];
|
questionId: Scalars['ID'];
|
||||||
};
|
text: Scalars['String'];
|
||||||
|
|
||||||
export type ReviewRequest = {
|
|
||||||
__typename?: 'ReviewRequest';
|
|
||||||
answered: Scalars['Boolean'];
|
|
||||||
id: Scalars['ID'];
|
|
||||||
question: Question;
|
|
||||||
user: User;
|
|
||||||
};
|
|
||||||
|
|
||||||
/** The connection type for ReviewRequest. */
|
|
||||||
export type ReviewRequestConnection = {
|
|
||||||
__typename?: 'ReviewRequestConnection';
|
|
||||||
/** A list of edges. */
|
|
||||||
edges: Array<ReviewRequestEdge>;
|
|
||||||
/** A list of nodes. */
|
|
||||||
nodes: Array<ReviewRequest>;
|
|
||||||
/** Information to aid in pagination. */
|
|
||||||
pageInfo: PageInfo;
|
|
||||||
totalCount: Scalars['Int'];
|
|
||||||
};
|
|
||||||
|
|
||||||
/** An edge in a connection. */
|
|
||||||
export type ReviewRequestEdge = {
|
|
||||||
__typename?: 'ReviewRequestEdge';
|
|
||||||
/** A cursor for use in pagination. */
|
|
||||||
cursor: Scalars['String'];
|
|
||||||
/** The item at the end of the edge. */
|
|
||||||
node?: Maybe<ReviewRequest>;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export type Subject = {
|
export type Subject = {
|
||||||
@@ -438,11 +407,11 @@ export type Subject = {
|
|||||||
|
|
||||||
|
|
||||||
export type SubjectQuestionsArgs = {
|
export type SubjectQuestionsArgs = {
|
||||||
after?: Maybe<Scalars['String']>;
|
after?: InputMaybe<Scalars['String']>;
|
||||||
before?: Maybe<Scalars['String']>;
|
before?: InputMaybe<Scalars['String']>;
|
||||||
first?: Maybe<Scalars['Int']>;
|
first?: InputMaybe<Scalars['Int']>;
|
||||||
last?: Maybe<Scalars['Int']>;
|
last?: InputMaybe<Scalars['Int']>;
|
||||||
where?: Maybe<QuestionWhereInput>;
|
where?: InputMaybe<QuestionWhereInput>;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** The connection type for Subject. */
|
/** The connection type for Subject. */
|
||||||
@@ -468,9 +437,9 @@ export type SubjectEdge = {
|
|||||||
|
|
||||||
/** Autogenerated input type of UpdateQuestion */
|
/** Autogenerated input type of UpdateQuestion */
|
||||||
export type UpdateQuestionInput = {
|
export type UpdateQuestionInput = {
|
||||||
question: QuestionUpdateInput;
|
|
||||||
/** A unique identifier for the client performing the mutation. */
|
/** A unique identifier for the client performing the mutation. */
|
||||||
clientMutationId?: Maybe<Scalars['String']>;
|
clientMutationId?: InputMaybe<Scalars['String']>;
|
||||||
|
question: QuestionUpdateInput;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Autogenerated return type of UpdateQuestion */
|
/** Autogenerated return type of UpdateQuestion */
|
||||||
@@ -485,31 +454,12 @@ export type UpdateQuestionPayload = {
|
|||||||
|
|
||||||
export type User = {
|
export type User = {
|
||||||
__typename?: 'User';
|
__typename?: 'User';
|
||||||
activeReviewRequests: ReviewRequestConnection;
|
|
||||||
avatarUrl?: Maybe<Scalars['String']>;
|
|
||||||
email: Scalars['String'];
|
email: Scalars['String'];
|
||||||
id: Scalars['ID'];
|
id: Scalars['ID'];
|
||||||
inactiveReviewRequests: ReviewRequestConnection;
|
|
||||||
name: Scalars['String'];
|
name: Scalars['String'];
|
||||||
roles: Array<UserRole>;
|
roles: Array<UserRole>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
export type UserActiveReviewRequestsArgs = {
|
|
||||||
after?: Maybe<Scalars['String']>;
|
|
||||||
before?: Maybe<Scalars['String']>;
|
|
||||||
first?: Maybe<Scalars['Int']>;
|
|
||||||
last?: Maybe<Scalars['Int']>;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
export type UserInactiveReviewRequestsArgs = {
|
|
||||||
after?: Maybe<Scalars['String']>;
|
|
||||||
before?: Maybe<Scalars['String']>;
|
|
||||||
first?: Maybe<Scalars['Int']>;
|
|
||||||
last?: Maybe<Scalars['Int']>;
|
|
||||||
};
|
|
||||||
|
|
||||||
/** The connection type for User. */
|
/** The connection type for User. */
|
||||||
export type UserConnection = {
|
export type UserConnection = {
|
||||||
__typename?: 'UserConnection';
|
__typename?: 'UserConnection';
|
||||||
@@ -532,10 +482,10 @@ export type UserEdge = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export enum UserRole {
|
export enum UserRole {
|
||||||
Admin = 'admin',
|
Admin = 'ADMIN',
|
||||||
Teacher = 'teacher',
|
CenterDirector = 'CENTER_DIRECTOR',
|
||||||
Nde = 'nde',
|
Coordinator = 'COORDINATOR',
|
||||||
Coordinator = 'coordinator',
|
Nde = 'NDE',
|
||||||
CenterDirector = 'center_director',
|
ProRector = 'PRO_RECTOR',
|
||||||
ProRector = 'pro_rector'
|
Teacher = 'TEACHER'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -133,11 +133,6 @@ An ISO 8601-encoded datetime
|
|||||||
"""
|
"""
|
||||||
scalar ISO8601DateTime
|
scalar ISO8601DateTime
|
||||||
|
|
||||||
"""
|
|
||||||
Represents untyped JSON
|
|
||||||
"""
|
|
||||||
scalar JSON
|
|
||||||
|
|
||||||
type Mutation {
|
type Mutation {
|
||||||
createQuestion(
|
createQuestion(
|
||||||
"""
|
"""
|
||||||
@@ -295,7 +290,7 @@ type Query {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Question implements Node {
|
type Question implements Node {
|
||||||
alternatives: JSON!
|
alternatives: [QuestionAlternative!]!
|
||||||
authorship: String
|
authorship: String
|
||||||
authorshipYear: String
|
authorshipYear: String
|
||||||
bloomTaxonomy: QuestionBloomTaxonomy
|
bloomTaxonomy: QuestionBloomTaxonomy
|
||||||
@@ -308,11 +303,38 @@ type Question implements Node {
|
|||||||
instruction: String
|
instruction: String
|
||||||
intention: String
|
intention: String
|
||||||
references: String
|
references: String
|
||||||
|
reviewMessages(
|
||||||
|
"""
|
||||||
|
Returns the elements in the list that come after the specified cursor.
|
||||||
|
"""
|
||||||
|
after: String
|
||||||
|
|
||||||
|
"""
|
||||||
|
Returns the elements in the list that come before the specified cursor.
|
||||||
|
"""
|
||||||
|
before: String
|
||||||
|
|
||||||
|
"""
|
||||||
|
Returns the first _n_ elements from the list.
|
||||||
|
"""
|
||||||
|
first: Int
|
||||||
|
|
||||||
|
"""
|
||||||
|
Returns the last _n_ elements from the list.
|
||||||
|
"""
|
||||||
|
last: Int
|
||||||
|
): ReviewMessageConnection!
|
||||||
|
reviewer: User
|
||||||
status: QuestionStatus!
|
status: QuestionStatus!
|
||||||
subjectId: Int
|
subject: Subject
|
||||||
support: String
|
support: String
|
||||||
updatedAt: ISO8601DateTime!
|
updatedAt: ISO8601DateTime!
|
||||||
userId: Int!
|
user: User!
|
||||||
|
}
|
||||||
|
|
||||||
|
type QuestionAlternative {
|
||||||
|
correct: Boolean!
|
||||||
|
text: String
|
||||||
}
|
}
|
||||||
|
|
||||||
input QuestionAlternativeInput {
|
input QuestionAlternativeInput {
|
||||||
@@ -349,17 +371,18 @@ type QuestionConnection {
|
|||||||
"""
|
"""
|
||||||
A list of edges.
|
A list of edges.
|
||||||
"""
|
"""
|
||||||
edges: [QuestionEdge]
|
edges: [QuestionEdge!]!
|
||||||
|
|
||||||
"""
|
"""
|
||||||
A list of nodes.
|
A list of nodes.
|
||||||
"""
|
"""
|
||||||
nodes: [Question]
|
nodes: [Question!]!
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Information to aid in pagination.
|
Information to aid in pagination.
|
||||||
"""
|
"""
|
||||||
pageInfo: PageInfo!
|
pageInfo: PageInfo!
|
||||||
|
totalCount: Int!
|
||||||
}
|
}
|
||||||
|
|
||||||
input QuestionCreateInput {
|
input QuestionCreateInput {
|
||||||
@@ -450,6 +473,42 @@ type ReviewMessage {
|
|||||||
user: User!
|
user: User!
|
||||||
}
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
The connection type for ReviewMessage.
|
||||||
|
"""
|
||||||
|
type ReviewMessageConnection {
|
||||||
|
"""
|
||||||
|
A list of edges.
|
||||||
|
"""
|
||||||
|
edges: [ReviewMessageEdge!]!
|
||||||
|
|
||||||
|
"""
|
||||||
|
A list of nodes.
|
||||||
|
"""
|
||||||
|
nodes: [ReviewMessage!]!
|
||||||
|
|
||||||
|
"""
|
||||||
|
Information to aid in pagination.
|
||||||
|
"""
|
||||||
|
pageInfo: PageInfo!
|
||||||
|
totalCount: Int!
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
An edge in a connection.
|
||||||
|
"""
|
||||||
|
type ReviewMessageEdge {
|
||||||
|
"""
|
||||||
|
A cursor for use in pagination.
|
||||||
|
"""
|
||||||
|
cursor: String!
|
||||||
|
|
||||||
|
"""
|
||||||
|
The item at the end of the edge.
|
||||||
|
"""
|
||||||
|
node: ReviewMessage
|
||||||
|
}
|
||||||
|
|
||||||
enum ReviewMessageFeedbackType {
|
enum ReviewMessageFeedbackType {
|
||||||
ANSWER
|
ANSWER
|
||||||
APPROVE
|
APPROVE
|
||||||
@@ -498,17 +557,18 @@ type SubjectConnection {
|
|||||||
"""
|
"""
|
||||||
A list of edges.
|
A list of edges.
|
||||||
"""
|
"""
|
||||||
edges: [SubjectEdge]
|
edges: [SubjectEdge!]!
|
||||||
|
|
||||||
"""
|
"""
|
||||||
A list of nodes.
|
A list of nodes.
|
||||||
"""
|
"""
|
||||||
nodes: [Subject]
|
nodes: [Subject!]!
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Information to aid in pagination.
|
Information to aid in pagination.
|
||||||
"""
|
"""
|
||||||
pageInfo: PageInfo!
|
pageInfo: PageInfo!
|
||||||
|
totalCount: Int!
|
||||||
}
|
}
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@@ -567,17 +627,18 @@ type UserConnection {
|
|||||||
"""
|
"""
|
||||||
A list of edges.
|
A list of edges.
|
||||||
"""
|
"""
|
||||||
edges: [UserEdge]
|
edges: [UserEdge!]!
|
||||||
|
|
||||||
"""
|
"""
|
||||||
A list of nodes.
|
A list of nodes.
|
||||||
"""
|
"""
|
||||||
nodes: [User]
|
nodes: [User!]!
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Information to aid in pagination.
|
Information to aid in pagination.
|
||||||
"""
|
"""
|
||||||
pageInfo: PageInfo!
|
pageInfo: PageInfo!
|
||||||
|
totalCount: Int!
|
||||||
}
|
}
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@@ -10,18 +10,12 @@ type Props = {
|
|||||||
export const UserAvatar: FC<Props> = ({user, className}) => {
|
export const UserAvatar: FC<Props> = ({user, className}) => {
|
||||||
return (
|
return (
|
||||||
<div className={`rounded-full border-2 border-primary-light shadow ${className || ''}`}>
|
<div className={`rounded-full border-2 border-primary-light shadow ${className || ''}`}>
|
||||||
{user.avatarUrl ?
|
<BoringAvatar
|
||||||
<img
|
size={"100%"}
|
||||||
src={`${process.env.REACT_APP_BACKEND_URL}/${user.avatarUrl}`}
|
name={user.name}
|
||||||
alt={`Avatar do usuário ${user.name}`}
|
variant="pixel"
|
||||||
/>
|
colors={["#595F72", "#575D90", "#84A07C", "#C3D350", "#E6F14A"]}
|
||||||
: <BoringAvatar
|
/>
|
||||||
size={"100%"}
|
|
||||||
name={user.name}
|
|
||||||
variant="pixel"
|
|
||||||
colors={["#595F72", "#575D90", "#84A07C", "#C3D350", "#E6F14A"]}
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -37,7 +37,6 @@ const CurrentUserQuery = gql`
|
|||||||
id
|
id
|
||||||
name
|
name
|
||||||
email
|
email
|
||||||
avatarUrl
|
|
||||||
roles
|
roles
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,12 +55,12 @@ export const QuestionByBloomTaxonomy: FC = () => {
|
|||||||
const {loading, data} = useQuery<QuestionsByBloomTaxonomyCountQuery>(
|
const {loading, data} = useQuery<QuestionsByBloomTaxonomyCountQuery>(
|
||||||
QuestionsByBloomTaxonomyCount, {
|
QuestionsByBloomTaxonomyCount, {
|
||||||
variables: {
|
variables: {
|
||||||
rememberWhere: {bloomTaxonomy: ['remember'], ...where},
|
rememberWhere: {bloomTaxonomy: ['REMEMBER'], ...where},
|
||||||
understandWhere: {bloomTaxonomy: ['understand'], ...where},
|
understandWhere: {bloomTaxonomy: ['UNDERSTAND'], ...where},
|
||||||
applyWhere: {bloomTaxonomy: ['apply'], ...where},
|
applyWhere: {bloomTaxonomy: ['APPLY'], ...where},
|
||||||
analyzeWhere: {bloomTaxonomy: ['analyze'], ...where},
|
analyzeWhere: {bloomTaxonomy: ['ANALYZE'], ...where},
|
||||||
evaluateWhere: {bloomTaxonomy: ['evaluate'], ...where},
|
evaluateWhere: {bloomTaxonomy: ['EVALUATE'], ...where},
|
||||||
createWhere: {bloomTaxonomy: ['create'], ...where},
|
createWhere: {bloomTaxonomy: ['CREATE'], ...where},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ export const TextEditor: FC<Props> = ({ name, defaultValue }) => {
|
|||||||
config={{
|
config={{
|
||||||
toolbar: toolbarOptions,
|
toolbar: toolbarOptions,
|
||||||
ckfinder: {
|
ckfinder: {
|
||||||
uploadUrl: `${process.env.REACT_APP_BACKEND_URL}/uploads`,
|
uploadUrl: `/uploads`,
|
||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
onChange={(_: any, editor: any) => onChange(editor.getData())}
|
onChange={(_: any, editor: any) => onChange(editor.getData())}
|
||||||
|
|||||||
@@ -42,7 +42,6 @@ export const ReviewMessagesFragments = gql`
|
|||||||
text
|
text
|
||||||
user {
|
user {
|
||||||
name
|
name
|
||||||
avatarUrl
|
|
||||||
}
|
}
|
||||||
createdAt
|
createdAt
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ import { gql } from "@apollo/client";
|
|||||||
|
|
||||||
import { Card } from "../../../components";
|
import { Card } from "../../../components";
|
||||||
import { Question } from "../../../__generated__/graphql-schema";
|
import { Question } from "../../../__generated__/graphql-schema";
|
||||||
import { loadWIRISplugin } from "../../../utils/plugins";
|
|
||||||
import { BLOOM_TAXONOMY, DIFFICULTY } from "../../../utils/types";
|
import { BLOOM_TAXONOMY, DIFFICULTY } from "../../../utils/types";
|
||||||
|
|
||||||
export const ViewModeFragments = gql`
|
export const ViewModeFragments = gql`
|
||||||
@@ -67,8 +66,6 @@ export const ViewMode: FC<Props> = ({ questionData: question }) => {
|
|||||||
const difficulty = DIFFICULTY.find((item) => question.difficulty === item.value)?.label
|
const difficulty = DIFFICULTY.find((item) => question.difficulty === item.value)?.label
|
||||||
const bloomTaxonomy = BLOOM_TAXONOMY.find((item) => question.bloomTaxonomy === item.value)?.label
|
const bloomTaxonomy = BLOOM_TAXONOMY.find((item) => question.bloomTaxonomy === item.value)?.label
|
||||||
|
|
||||||
loadWIRISplugin()
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="max-w-screen-lg">
|
<div className="max-w-screen-lg">
|
||||||
<Card className="mb-3" title="Características">
|
<Card className="mb-3" title="Características">
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
const host = process.env.REACT_APP_BACKEND_URL || "http://localhost:3000";
|
|
||||||
|
|
||||||
export type LoginCredentails = {
|
export type LoginCredentails = {
|
||||||
email: string;
|
email: string;
|
||||||
password: string;
|
password: string;
|
||||||
@@ -11,7 +9,7 @@ export const authentication = {
|
|||||||
user: credentails,
|
user: credentails,
|
||||||
};
|
};
|
||||||
|
|
||||||
const response = await fetch(`${host}/login`, {
|
const response = await fetch(`/login`, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
Accept: "application/json",
|
Accept: "application/json",
|
||||||
@@ -29,7 +27,7 @@ export const authentication = {
|
|||||||
resetPasswordEmail: async (email: string) => {
|
resetPasswordEmail: async (email: string) => {
|
||||||
const payload = { user: { email } };
|
const payload = { user: { email } };
|
||||||
|
|
||||||
const response = await fetch(`${host}/password`, {
|
const response = await fetch(`/password`, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
Accept: "application/json",
|
Accept: "application/json",
|
||||||
@@ -59,7 +57,7 @@ export const authentication = {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const response = await fetch(`${host}/password`, {
|
const response = await fetch(`/password`, {
|
||||||
method: "PUT",
|
method: "PUT",
|
||||||
headers: {
|
headers: {
|
||||||
Accept: "application/json",
|
Accept: "application/json",
|
||||||
|
|||||||
@@ -5,9 +5,7 @@ const SEPARATOR_TOKEN = "-";
|
|||||||
type Decoded = { typeName: string; id: string };
|
type Decoded = { typeName: string; id: string };
|
||||||
|
|
||||||
const decode = (id: Node["id"]): Decoded => {
|
const decode = (id: Node["id"]): Decoded => {
|
||||||
const raw = Buffer.from(id, "base64").toString("ascii");
|
const [nodeTypeName, nodeId] = atob(id).split(SEPARATOR_TOKEN);
|
||||||
|
|
||||||
const [nodeTypeName, nodeId] = raw.split(SEPARATOR_TOKEN);
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
id: nodeId,
|
id: nodeId,
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
export * from "./wiris";
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
export const loadWIRISplugin = () => {
|
|
||||||
const script = document.createElement("script");
|
|
||||||
script.src = process.env.REACT_APP_WIRIS_PLUGIN_URL ?? "";
|
|
||||||
script.async = true;
|
|
||||||
|
|
||||||
document.body.appendChild(script);
|
|
||||||
};
|
|
||||||
@@ -36,6 +36,8 @@ class Question < ApplicationRecord
|
|||||||
|
|
||||||
belongs_to :user
|
belongs_to :user
|
||||||
belongs_to :subject, optional: true
|
belongs_to :subject, optional: true
|
||||||
|
has_many :review_requests, dependent: :destroy
|
||||||
|
has_many :review_messages, dependent: :destroy
|
||||||
|
|
||||||
enumerize :status, in: %i[draft waiting_review with_requested_changes approved registered]
|
enumerize :status, in: %i[draft waiting_review with_requested_changes approved registered]
|
||||||
enumerize :difficulty, in: %i[easy medium hard]
|
enumerize :difficulty, in: %i[easy medium hard]
|
||||||
@@ -52,4 +54,8 @@ class Question < ApplicationRecord
|
|||||||
ordering_or_ranking
|
ordering_or_ranking
|
||||||
constant_alternatives
|
constant_alternatives
|
||||||
]
|
]
|
||||||
|
|
||||||
|
def reviewer
|
||||||
|
review_requests.last&.user
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
<%= stylesheet_link_tag "application", "data-turbo-track": "reload" %>
|
<%= stylesheet_link_tag "application", "data-turbo-track": "reload" %>
|
||||||
<%= javascript_include_tag "application", "data-turbo-track": "reload", defer: true %>
|
<%= javascript_include_tag "application", "data-turbo-track": "reload", defer: true %>
|
||||||
|
<script src="<%= ENV['WIRIS_PLUGIN_SRC'] %>" async=true></script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|||||||
Reference in New Issue
Block a user