Skip to content

fac25/alex-abby-manoela-suraj-database-B

Repository files navigation

alex-abby-manoela-suraj-database

A music sharing app where you can share your favourite songs for your friends!

Have a look and post at music-app

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 dev to start the server. Run npm run dev-win if using Windows.

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

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

Test

Testing in windows:

    SET DB_FILE=test.sqlite & node -r ./src/database/seed.js --no-warnings --test

Test All:

npm run test
    DB_FILE=test.sqlite node -r ./src/database/seed.js --no-warnings --test

Test 1:

npm run test:1
    DB_FILE=test.sqlite node -r ./src/database/seed.js --no-warnings test/one.test.js

Test 2:

npm run test:2
    DB_FILE=test.sqlite node -r ./src/database/seed.js --no-warnings test/two.test.js

Test 3:

npm run test:3
    DB_FILE=test.sqlite node -r ./src/database/seed.js --no-warnings test/three.test.js

Test 4:

npm run test:4
    DB_FILE=test.sqlite node -r ./src/database/seed.js --no-warnings test/four.test.js

User stories

Core

  • As a friendly user I want to post a song that I like for anyone to see
  • As a curious user I want to see other people's favourite songs they posted about

Stretch goal:

  • As a selfish user, I want to filter by user so I can see a collection of one person's favourite songs
  • As an organised user, I want to sort all posted songs by rating

Schema

Our database contains two tables.

  1. Users - contains the usernames of everyone who has posted their favourite song so far
  2. Music - a list of all songs posted

The two tables follow the schema as shown below

Screenshot 2022-10-02 at 22 27 11

Example database:

image

image

Acceptance Criteria

  • A form for users to submit data
  • A page showing all the data
  • Semantic form elements with correctly associated labels
  • A SQLite database
  • A schema describing your database in your README
  • Tests for server routes and database access
  • Not process user input as SQL commands
  • Hidden environment variables (i.e. not on GitHub)

Stretch criteria

  • A way to view filtered/sorted data, instead of just all of it GitHub Actions CI setup to run your tests when you push