Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions ent/gql_mutation_input.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ent/internal/schema.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion ent/migrate/schema.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

44 changes: 44 additions & 0 deletions ent/question_update.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 9 additions & 1 deletion ent/schema/question.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"entgo.io/ent/schema"
"entgo.io/ent/schema/edge"
"entgo.io/ent/schema/field"
"entgo.io/ent/schema/index"
)

type Question struct {
Expand All @@ -14,7 +15,7 @@ type Question struct {

func (Question) Fields() []ent.Field {
return []ent.Field{
field.String("category").NotEmpty().Unique().Immutable().Comment("Question category, e.g. 'query'").Annotations(
field.String("category").NotEmpty().Comment("Question category, e.g. 'query'").Annotations(
entgql.OrderField("CATEGORY"),
),
field.Enum("difficulty").NamedValues(
Expand Down Expand Up @@ -48,6 +49,13 @@ func (Question) Edges() []ent.Edge {
}
}

func (Question) Indexes() []ent.Index {
return []ent.Index{
index.Fields("category"),
index.Fields("difficulty"),
}
}

func (Question) Annotations() []schema.Annotation {
return []schema.Annotation{
entgql.QueryField().Directives(
Expand Down
4 changes: 4 additions & 0 deletions graph/ent.graphqls
Original file line number Diff line number Diff line change
Expand Up @@ -1224,6 +1224,10 @@ UpdateQuestionInput is used for update Question object.
Input was generated by ent.
"""
input UpdateQuestionInput {
"""
Question category, e.g. 'query'
"""
category: String
"""
Question difficulty, e.g. 'easy'
"""
Expand Down