I’m trying to sort the date by timestamp, but I’m unable to perform the same using the resources given in the Dgraph docs.
Used below schema
type Post {
id: ID!
title: String!
timestamp: String!
username: UserName
isPrivate: Boolean!
avatar: String
body: String!
images: [Image]
commentsVisibility: Boolean!
isReplyEnabled: Boolean!
comments: [Comment]
tags: [Tag]
first: Int
offset: Int
hashtag: [String]
}
enum SortOrder {
ASC
DESC
}
enum SortableField {
title
timestamp
}
input Sort {
field:SortableField,
order:SortOrder = DESC
}
type AllPostResponse {
success: Boolean!
message: String
token: String
data: [Post]
}
Query:
getAllPost(sort: Sort,first: Int, offset: Int): AllPostResponse
Getting below mentioned error:
Error:
/home/yuvaraj/node_modules/graphql/language/lexer.js:360
throw (0, _syntaxError.syntaxError)(source, pos, unexpectedCharacterMessage(code));
^
GraphQLError [Object]: Syntax Error: Cannot parse the unexpected character "\u00A0".
at syntaxError (/home/yuvaraj/node_modules/graphql/error/syntaxError.js:15:10)
at readToken (/home/yuvaraj/node_modules/graphql/language/lexer.js:360:40)
at Lexer.lookahead (/home/yuvaraj/node_modules/graphql/language/lexer.js:75:108)
at Lexer.advance (/home/yuvaraj/node_modules/graphql/language/lexer.js:58:35)
at Parser.expectOptionalToken (/home/yuvaraj/node_modules/graphql/language/parser.js:1425:19)
at Parser.optionalMany (/home/yuvaraj/node_modules/graphql/language/parser.js:1499:14)
at Parser.parseInputFieldsDefinition (/home/yuvaraj/node_modules/graphql/language/parser.js:1065:17)
at Parser.parseInputObjectTypeDefinition (/home/yuvaraj/node_modules/graphql/language/parser.js:1049:23)
at Parser.parseTypeSystemDefinition (/home/yuvaraj/node_modules/graphql/language/parser.js:720:23)
at Parser.parseDefinition (/home/yuvaraj/node_modules/graphql/language/parser.js:150:23) {
locations: [ { line: 121, column: 1 } ]
}
Kindly help me out to fix this issue ASAP.
Thanks & regards
Yuvaraj