+
Notes
+
+ {song.notes}
+
+ {/*
Public domain status
+
+ {song.claimedPublicDomain
+ ? "This song is considered in the public domain"
+ : "This song is not part of the public domain. Contact the writer, label, composer for use rights."}
+
*/}
+
diff --git a/package-lock.json b/package-lock.json
index dcee90e..5bcbf1a 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -18,6 +18,7 @@
"debounce": "^1.2.1",
"dotenv-cli": "^6.0.0",
"fuse.js": "^6.6.2",
+ "moment": "^2.28.0",
"qrcode": "^1.5.1",
"qs": "^6.11.0",
"react": "^18.2.0",
@@ -13958,6 +13959,14 @@
"integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==",
"dev": true
},
+ "node_modules/moment": {
+ "version": "2.29.4",
+ "resolved": "https://registry.npmjs.org/moment/-/moment-2.29.4.tgz",
+ "integrity": "sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w==",
+ "engines": {
+ "node": "*"
+ }
+ },
"node_modules/morgan": {
"version": "1.10.0",
"resolved": "https://registry.npmjs.org/morgan/-/morgan-1.10.0.tgz",
@@ -32109,6 +32118,11 @@
"integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==",
"dev": true
},
+ "moment": {
+ "version": "2.29.4",
+ "resolved": "https://registry.npmjs.org/moment/-/moment-2.29.4.tgz",
+ "integrity": "sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w=="
+ },
"morgan": {
"version": "1.10.0",
"resolved": "https://registry.npmjs.org/morgan/-/morgan-1.10.0.tgz",
diff --git a/package.json b/package.json
index e6062fc..d4a647b 100644
--- a/package.json
+++ b/package.json
@@ -10,6 +10,7 @@
"db:deploy": "npx prisma migrate deploy",
"db:push": "npx prisma db push",
"db:reset": "rm -r prisma/data.db && npm run db:push",
+ "db:hard-refresh": "rm -r prisma/data.db && npm run db:push && npm run db:seed",
"db:seed": "npx prisma db seed",
"db:studio": "npx prisma studio -p 7777 --browser none",
"dev": "concurrently \"npm run dev:css\" \"remix dev\"",
@@ -41,6 +42,7 @@
"debounce": "^1.2.1",
"dotenv-cli": "^6.0.0",
"fuse.js": "^6.6.2",
+ "moment": "^2.28.0",
"qrcode": "^1.5.1",
"qs": "^6.11.0",
"react": "^18.2.0",
diff --git a/prisma/schema.prisma b/prisma/schema.prisma
index c9ba939..5697865 100644
--- a/prisma/schema.prisma
+++ b/prisma/schema.prisma
@@ -11,14 +11,15 @@ datasource db {
}
model User {
- id Int @id @default(autoincrement())
- email String @unique
+ id Int @id @default(autoincrement())
+ email String @unique
name String?
// role Role @default(USER)
songs Song[]
profile Profile?
oAuthProvider String?
oAuthId String?
+ setlists Setlist[]
}
model Profile {
@@ -29,41 +30,42 @@ model Profile {
}
model Song {
- id Int @id @default(autoincrement())
- createdAt DateTime @default(now())
- updatedAt DateTime @updatedAt
- title String
- attribution String @default("")
- stanzas String
- published Boolean @default(false)
- author User @relation(fields: [authorId], references: [id])
- authorId Int
- categories Category[] //# @relation(references: [id])
- Setlist Setlist? @relation(fields: [setlistId], references: [id])
- setlistId String?
+ id Int @id @default(autoincrement())
+ createdAt DateTime @default(now())
+ updatedAt DateTime @updatedAt
+ title String
+ attribution String @default("")
+ stanzas String
+ published Boolean @default(false)
+ author User @relation(fields: [authorId], references: [id])
+ authorId Int
+ // time in seconds for the length of song
+ runtime Int @default(185) // bonus points if you know the reference
+ notes String @default("")
+ claimedPublicDomain Boolean @default(false)
+ categories Category[] //# @relation(references: [id])
+ setlists Setlist[] // @relation(fields: [setlistId], references: [id])
}
model Category {
id Int @id @default(autoincrement())
name String
- songs Song[] //@relation(references: [id])
+ songs Song[] // @relation(references: [id])
setlists Setlist[]
}
model Setlist {
- id String @id @default(uuid())
- name String @default("")
- description String @default("")
- // Json type not supported in SQLite
- createdAt DateTime @default(now())
- updatedAt DateTime @updatedAt
-
- qrcode String @default("")
-
- songs Song[]
- Category Category? @relation(fields: [categoryId], references: [id])
- categoryId Int?
+ id String @id @default(uuid())
+ name String @default("")
+ description String @default("")
+ author User @relation(fields: [authorId], references: [id])
+ authorId Int
+ createdAt DateTime @default(now())
+ updatedAt DateTime @updatedAt
+ qrcode String @default("")
+ songs Song[]
+ categories Category[]
}
// enum Role {
diff --git a/prisma/seed.ts b/prisma/seed.ts
index 2132e27..5508da7 100644
--- a/prisma/seed.ts
+++ b/prisma/seed.ts
@@ -1,4 +1,7 @@
import { PrismaClient } from "@prisma/client";
+
+import { createMockSong } from "@/test/factories/song.factory";
+
const prisma = new PrismaClient();
async function main() {
const keith = await prisma.user.upsert({
@@ -25,6 +28,25 @@ async function main() {
name: "Keith Full Auth Flow",
},
});
+ await prisma.category.create({ data: { name: "Sea Shanties" } });
+ await prisma.category.create({ data: { name: "New American Americana" } });
+ await prisma.category.create({ data: { name: "Folk" } });
+ await prisma.category.create({ data: { name: "Protest" } });
+ await prisma.category.create({
+ data: { name: "Really makes you go hmmmmm." },
+ });
+ await prisma.category.create({
+ data: { name: "Really makes you go hummmmm." },
+ });
+ const mockedSong = createMockSong();
+ await prisma.song.create({
+ data: {
+ ...mockedSong,
+ id: 1,
+ authorId: 3,
+ },
+ });
+ // await prisma.category.upsert
console.log({ keith, drew, keithFullAuth });
}
main()