Skip to content

Instantly share code, notes, and snippets.

View JCJang's full-sized avatar

Jennifer Jang JCJang

View GitHub Profile
//adding a new shelf
app.post("/shelf", async(req,res)=>{
const shelfTitle = req.body.shelfTitle
const shelfLanguage = req.body.shelfLanguage
const bookTitle= req.body.bookTitle
const earliestPublicationYear = req.body.earliestPublicationYear
...
//for each author, scan their 'influenced' list for the opened author
app.post("/influences", async(req,res)=>{
const languageSetting = req.body.languageSetting
const authorToFind = req.body.authorWikiTitle
AuthorModel.find({"editions.language":languageSetting, "authorInfluenced":authorToFind},{"editions.details.authorWikiTitle":1,"_id":0}, (err,results)=>{
if(err){
res.send(err)
console.log(err)
}
//using authorInfluences as an example:
const [authorInfluenced, setAuthorInfluenced] = useState([])
const [authorInfluencedBooks, setAuthorInfluencedBooks] = useState([])
const openLinkedShelf = (shelfAndBook) =>{
setBookNumber(shelfAndBook.book[0].bookNumber)
setShelfId(shelfAndBook.shelfId)
setColumnFocus('shelfpanel')
}