type Category { id: Int! name: String! description: String! createAt: DateTime updateAt: DateTime } input CategoryInput { name: String! description: String! } type CategoryWithPagination { categories: [Category!]! total: Int! allCount: Int! } type Comment { id: Int! userId: Int! templateId: Int! parentCommentId: Int content: String! createAt: DateTime } input CommentInput { content: String! templateId: Int! parentCommentId: Int } type CommentWithUser { comment: Comment! user: User! } """ Implement the DateTime scalar The input/output is a string in RFC3339 format. """ scalar DateTime type Favorites { userId: Int! templateId: Int! createAt: DateTime } """ A scalar that can represent any JSON value. """ scalar JSON type Mutation { createCategory(category: CategoryInput!): Int! updateCategory(id: Int!, category: CategoryInput!): Category! deleteCategory(id: Int!): String! createTag(tag: TagInput!): Int! updateTag(id: Int!, tag: TagInput!): Tag! deleteTag(id: Int!): String! createTemplate(input: TemplateCreateInput!): Int! updateTemplate(id: Int!, input: TemplateUpdateInput!): Template! deleteTemplate(id: Int!): String! increaseDownloadCount(id: Int!): String! """ 添加标签 """ updateTags(input: TemplateTagInput!): String! favorite(templateId: Int!): String! disFavorite(templateId: Int!): String! """ 添加评论 """ addComment(input: CommentInput!): Int! """ 删除评论 """ deleteComment(id: Int!): String! } input Pagination { pageSize: Int! page: Int! } type Query { user: User! userById(id: Int!): User categories(pagination: Pagination, search: String): CategoryWithPagination! tags(pagination: Pagination, search: String): TagWithPagination! """ 查找关联这个标签的模版 """ tagByIdWithTemplates(id: Int!, pagination: Pagination, search: String): TagTemplates! """ 分页查找模版 """ templatesWithPagination(categoryId: Int, pagination: Pagination, search: String): TemplatesWithPagination! favoriteTemplates(pagination: Pagination, search: String): UserTemplates! """ 通过ID获取模版详情 """ templateById(id: Int!): Template! templateWithUser(id: Int!): TemplateWithUser! templateTags(id: Int!): [Tag!]! """ 需要权限 """ templatesByUser(pagination: Pagination, search: String): UserTemplates! """ 获取用户模版列表,不需要权限,但只能看到未公开的 """ templatesByUserId(userId: Int!, pagination: Pagination, search: String): UserTemplates! """ 获取模版下载次数 """ templateDownloadCount(id: Int!): Int! """ 获取模版收藏次数 """ templateFavoriteCount(id: Int!): Int! comments(id: Int!): [CommentWithUser!]! """ 获取模版评论次数 """ templateCommentCount(id: Int!): Int! } type Tag { id: Int! name: String! description: String! createAt: DateTime updateAt: DateTime } input TagInput { name: String! description: String! } type TagTemplates { tag: Tag! templates: [Template!]! total: Int! allCount: Int! } type TagWithPagination { tags: [Tag!]! total: Int! allCount: Int! } type Template { id: Int! name: String! config: String! template: String! userId: Int! categoryId: Int! readme: String sourceCodeUrl: String isPublic: Boolean! createAt: DateTime updateAt: DateTime } input TemplateCreateInput { name: String! config: JSON! template: String! userId: Int! categoryId: Int! readme: String sourceCodeUrl: String isPublic: Boolean! } input TemplateTagInput { tagId: [Int!]! templateId: Int! } input TemplateUpdateInput { name: String config: JSON template: String categoryId: Int readme: String sourceCodeUrl: String isPublic: Boolean } type TemplateWithUser { id: Int! username: String! avatarUrl: String! createAt: DateTime name: String! config: String! template: String! userId: Int! categoryId: Int! readme: String sourceCodeUrl: String isPublic: Boolean! updateAt: DateTime favorites: [Favorites!]! category: Category! tags: [Tag!]! } type TemplatesWithPagination { templates: [Template!]! total: Int! } type User { id: Int! username: String! avatarUrl: String! createAt: DateTime } type UserTemplates { templates: [Template!]! total: Int! allCount: Int! }