From 29d0b3fa45db4920aac0ab98db8916c6d546ef42 Mon Sep 17 00:00:00 2001 From: yunish-i Date: Tue, 8 Apr 2025 14:57:40 -0400 Subject: [PATCH 1/2] Update books.ts --- pages/books.ts | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/pages/books.ts b/pages/books.ts index 85829f9..a3103c6 100644 --- a/pages/books.ts +++ b/pages/books.ts @@ -1,32 +1,33 @@ -import Book from '../models/book'; -import Author from '../models/author'; -import express from 'express'; +import Book from "../models/book"; +import Author from "../models/author"; +import express from "express"; const router = express.Router(); - const showBooks = async (): Promise => { try { - const books = await Book.getAllBooksWithAuthors('title author', {title: 1}); + const books = await Book.getAllBooksWithAuthors("title author", { + title: 1, + }); return books.map((b) => { const authorName = new Author(b.author).name; // Assuming 'Author' returns the author's name return `${b._id} : ${b.title} : ${authorName}`; }); } catch (err) { - console.log('Could not get books ' + err); + console.log("Could not get books " + err); } -} +}; /** * @route GET /books * @returns an array of strings, where each string contains the book ID, title, and author name * @returns - a message indicating that no books were found if an error occurs */ -router.get('/', async (_, res) => { +router.get("/", async (_, res) => { try { const data = await showBooks(); res.send(data); } catch { - res.send('No books found'); + res.send("No books found"); } }); From 1248c3538fa34183d09c9d8ef50b3cfe85d88793 Mon Sep 17 00:00:00 2001 From: yunish-i Date: Tue, 8 Apr 2025 15:00:14 -0400 Subject: [PATCH 2/2] updated main yaml --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9877da5..d08913a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -11,7 +11,7 @@ on: jobs: "run-jest-tests": - runs-on: cs5500-self-hosted + runs-on: self-hosted steps: - name: Checkout Repository uses: actions/checkout@v3