AWS amplify DynamoDB Graph QL filter by book title and author name
I want to search for books by book title and author name but my schema allows me to search books by book title and author ID, not author name how I can achieve this.
Following is my graphql schema
type Author
@model(subscriptions: null)
@auth(
rules: [#allow admins to create, update and delete books {
allow: groups,
groups: ["owner"]
}#
allow all authenticated users to view books {
allow: private,
operations: [read]
}
]
)
@key(name: "authorByCreatedAt", fields: ["isDeleted", "createdAt"], queryField: "authorByCreatedAt") {
id: ID!
name: String!
description: String!
status: Boolean!
createdAt: String!
image: String!
isDeleted: Int!
books: [Book] @connection(keyName: "byAuthor", fields: ["id"])
}
type Book
@model(subscriptions: null)
@auth(
rules: [#allow admins to create, update and delete books {
allow: groups,
groups: ["owner"]
}#
allow all authenticated users to view books {
allow: private,
operations: [read]
}
]
)
@key(name: "bookByCreatedAt", fields: ["isDeleted", "createdAt"], queryField: "bookByCreatedAt")
@key(name: "byAuthor", fields: ["authorId"]) {
id: ID!
title: String!
description: String!
image: String!
age: Int!
region: String!
isbn: String
narrator: String
status: Boolean!
createdAt: String!
isDeleted: Int!
book: String!
bookType: BookType!
authorId: ID!
authors: Author @connection(fields: ["authorId"])
}
enum BookType {
AUDIO
EPUB
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…