From d1ea7c8b9b382a04eb06b73de745ca22ab1585d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=A7=89?= Date: Wed, 31 Jul 2024 16:26:34 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A1=A5=E5=85=85=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/graphql.go | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/api/graphql.go b/api/graphql.go index 4ac6543..f0690df 100644 --- a/api/graphql.go +++ b/api/graphql.go @@ -94,7 +94,8 @@ func NewSchema(config Config) (graphql.Schema, error) { schema, err := graphql.NewSchema(graphql.SchemaConfig{Query: graphql.NewObject(graphql.ObjectConfig{Name: "RootQuery", Fields: graphql.Fields{ "users": &graphql.Field{ Type: graphql.NewObject(graphql.ObjectConfig{ - Name: "UserConnection", + Name: "UserConnection", + Description: "条件筛选用户列表", Fields: graphql.Fields{ "list": &graphql.Field{Type: graphql.NewList(user), Description: "用户列表"}, "total": &graphql.Field{Type: graphql.Int, Description: "用户总数"}, @@ -168,7 +169,8 @@ func NewSchema(config Config) (graphql.Schema, error) { }, "images": &graphql.Field{ Type: graphql.NewObject(graphql.ObjectConfig{ - Name: "ImageConnection", + Name: "ImageConnection", + Description: "条件筛选图像列表", Fields: graphql.Fields{ "list": &graphql.Field{Type: graphql.NewList(image), Description: "图像列表"}, "total": &graphql.Field{Type: graphql.Int, Description: "图像总数"}, @@ -349,7 +351,8 @@ func NewSchema(config Config) (graphql.Schema, error) { }, "articles": &graphql.Field{ Type: graphql.NewObject(graphql.ObjectConfig{ - Name: "ArticleConnection", + Name: "ArticleConnection", + Description: "条件筛选文章列表", Fields: graphql.Fields{ "list": &graphql.Field{Type: graphql.NewList(article), Description: "文章列表"}, "total": &graphql.Field{Type: graphql.Int, Description: "文章总数"}, @@ -415,16 +418,18 @@ func NewSchema(config Config) (graphql.Schema, error) { }, "tags": &graphql.Field{ Type: graphql.NewObject(graphql.ObjectConfig{ - Name: "TagConnection", + Name: "TagConnection", + Description: "条件筛选标签列表", Fields: graphql.Fields{ - "list": &graphql.Field{Type: graphql.NewList(graphql.String)}, - "total": &graphql.Field{Type: graphql.Int}, + "list": &graphql.Field{Type: graphql.NewList(graphql.String), Description: "标签列表"}, + "total": &graphql.Field{Type: graphql.Int, Description: "标签总数"}, }, }), Args: graphql.FieldConfigArgument{ - "first": &graphql.ArgumentConfig{Type: graphql.Int, DefaultValue: 10}, - "after": &graphql.ArgumentConfig{Type: graphql.String, DefaultValue: "0"}, - "before": &graphql.ArgumentConfig{Type: graphql.String}, + "first": &graphql.ArgumentConfig{Type: graphql.Int, Description: "翻页参数(傳回清單中的前n個元素)"}, + "last": &graphql.ArgumentConfig{Type: graphql.Int, Description: "翻页参数(傳回清單中的最後n個元素)"}, + "after": &graphql.ArgumentConfig{Type: graphql.String, Description: "翻页参数(傳回清單中指定遊標之後的元素)"}, + "before": &graphql.ArgumentConfig{Type: graphql.String, Description: "翻页参数(傳回清單中指定遊標之前的元素)"}, }, Resolve: func(p graphql.ResolveParams) (interface{}, error) { var tags []string