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