Skip to content

Commit e901b5d

Browse files
authored
Initial commit
0 parents  commit e901b5d

File tree

5 files changed

+64
-0
lines changed

5 files changed

+64
-0
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules
2+
# Keep environment variables out of version control
3+
.env

README.md

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Jukebox Mini
2+
3+
You've been hired to create the backend for a digital music service. The team's still working on getting access to tracks, but for now, you can get started on the playlist functionality.
4+
5+
## Database
6+
7+
![Visual representation of the database schema linked below](/docs/schema.svg)\
8+
_[textual representation of the database schema in DBML](/docs/schema.dbml)_
9+
10+
1. Create a new Postgres database named `jukebox-mini`.
11+
2. Initialize Prisma and connect it to the database.
12+
3. Define the models according to the schema above. One User has many Playlists. Each Playlist has one User as its owner.
13+
4. Seed the database with at least 3 users. Each user should be seeded with at least 5 playlists.
14+
15+
## API
16+
17+
Once your database is properly seeded, build an Express app that serves the following routes. Use the appropriate body-parsing and error-handling middleware!
18+
19+
- `GET /users` sends array of all users
20+
- `GET /users/:id` sends the user specified by id.
21+
- The response should include all playlists owned by the user.
22+
- `POST /users/:id/playlists` creates a new playlist owned by the user specified by id

docs/schema.dbml

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Table User {
2+
id Int [pk, increment]
3+
username String
4+
}
5+
6+
Table Playlist {
7+
id Int [pk, increment]
8+
name String
9+
description String
10+
ownerId Int
11+
}
12+
13+
Ref: Playlist.ownerId > User.id

docs/schema.svg

+12
Loading

package.json

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"name": "36-jukebox_mini",
3+
"version": "1.0.0",
4+
"main": "index.js",
5+
"directories": {
6+
"doc": "docs"
7+
},
8+
"scripts": {
9+
"test": "echo \"Error: no test specified\" && exit 1"
10+
},
11+
"author": "",
12+
"license": "ISC",
13+
"description": ""
14+
}

0 commit comments

Comments
 (0)