fac26 / week2-database-nkndi

0 stars 0 forks source link

week2-database-nkndi

Dominic-Karol-Natalia-Niete-Iman-database

A library app where you can add in your favourite books as recommendations for others.

Setup

Make sure you have Git and Node (v18) installed.

  1. Clone this repo and cd into the directory

  2. Run npm install to install all the dependencies

  3. Run npm run seed to create the database. Run npm run seed-win if using Windows.

  4. Run npm run dev to start the server. Run npm run dev-win if using Windows.

This uses the nodemon library to auto-restart the server when you save changes.

Testing

:construction:

User stories

Core

Stretch goal:

Schema

Schema Code ```js BEGIN; CREATE TABLE IF NOT EXISTS genres ( id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT NOT NULL ); CREATE TABLE IF NOT EXISTS books ( id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT NOT NULL, author_id INTEGER REFERENCES authors(id), year INTEGER, genres_id INTEGER REFERENCES genres(id) ); CREATE TABLE IF NOT EXISTS authors ( id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT NOT NULL ); CREATE INDEX IF NOT EXISTS book_names ON books(name); COMMIT ```

genres DB:

id name
1 Fantasy
2 Horror
3 Science Fiction
4 Drama
5 Politics

books DB:

id name author_id year genres_id
1 The Lord of the Rings 1 1955 1
2 The Hobbit 1 1937 1
3 It 2 1986 2
4 The Stand 2 1978 2
5 2001: A Space Oddysey 3 1968 3
6 Rendezvous With Rama 3 1973 3
7 1984 4 1948 4
8 Homage to Catalonia 4 1938 5

authors DB:

id name
1 J.R.R. Tolkien
2 Stephen King
3 Arthur C. Clarke
4 George Orwell
5 Unknown

sqlite_sequence DB:

name seq
authors 5
genres 5
books 8

Acceptance Criteria

Stretch criteria