Spaces:
Build error
Build error
Upload 8 files
Browse files- package-lock.json +0 -0
- prisma/migrations/20260409152027_init_fix_rating/migration.sql +55 -0
- prisma/migrations/20260415141526_transform_to_watchlist_and_content/migration.sql +86 -0
- prisma/migrations/20260423144202_add_scrapelog_model/migration.sql +25 -0
- prisma/migrations/20260424144601_add_broken_links/migration.sql +19 -0
- prisma/migrations/migration_lock.toml +3 -0
- prisma/schema.prisma +129 -0
- prisma/seed.ts +232 -0
package-lock.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
prisma/migrations/20260409152027_init_fix_rating/migration.sql
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
-- CreateEnum
|
| 2 |
+
CREATE TYPE "PlanType" AS ENUM ('basico', 'estandar', 'premium');
|
| 3 |
+
|
| 4 |
+
-- CreateTable
|
| 5 |
+
CREATE TABLE "Movie" (
|
| 6 |
+
"id" SERIAL NOT NULL,
|
| 7 |
+
"tmdb_id" TEXT,
|
| 8 |
+
"imdb_id" TEXT,
|
| 9 |
+
"title" TEXT NOT NULL,
|
| 10 |
+
"description" TEXT,
|
| 11 |
+
"releaseDate" TEXT,
|
| 12 |
+
"imageUrl" TEXT,
|
| 13 |
+
"backdropUrl" TEXT,
|
| 14 |
+
"trailer_url" TEXT,
|
| 15 |
+
"category" TEXT,
|
| 16 |
+
"type" TEXT NOT NULL DEFAULT 'movie',
|
| 17 |
+
"rating" DOUBLE PRECISION NOT NULL DEFAULT 0.0,
|
| 18 |
+
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
| 19 |
+
"updatedAt" TIMESTAMP(3) NOT NULL,
|
| 20 |
+
|
| 21 |
+
CONSTRAINT "Movie_pkey" PRIMARY KEY ("id")
|
| 22 |
+
);
|
| 23 |
+
|
| 24 |
+
-- CreateTable
|
| 25 |
+
CREATE TABLE "User" (
|
| 26 |
+
"id" TEXT NOT NULL,
|
| 27 |
+
"email" TEXT NOT NULL,
|
| 28 |
+
"password" TEXT DEFAULT '123456',
|
| 29 |
+
"name" TEXT NOT NULL,
|
| 30 |
+
"profilePic" TEXT DEFAULT 'assets/avatars/usuario5.webp',
|
| 31 |
+
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
| 32 |
+
"plan" "PlanType" NOT NULL DEFAULT 'basico',
|
| 33 |
+
"isVerified" BOOLEAN NOT NULL DEFAULT false,
|
| 34 |
+
"pin" TEXT,
|
| 35 |
+
"pinExpiresAt" TIMESTAMP(3),
|
| 36 |
+
"language" TEXT NOT NULL DEFAULT 'es',
|
| 37 |
+
"parentalPin" TEXT,
|
| 38 |
+
"maturityLevel" TEXT NOT NULL DEFAULT '18+',
|
| 39 |
+
"subtitleSize" TEXT NOT NULL DEFAULT 'medium',
|
| 40 |
+
"autoPlay" BOOLEAN NOT NULL DEFAULT true,
|
| 41 |
+
|
| 42 |
+
CONSTRAINT "User_pkey" PRIMARY KEY ("id")
|
| 43 |
+
);
|
| 44 |
+
|
| 45 |
+
-- CreateIndex
|
| 46 |
+
CREATE UNIQUE INDEX "Movie_tmdb_id_key" ON "Movie"("tmdb_id");
|
| 47 |
+
|
| 48 |
+
-- CreateIndex
|
| 49 |
+
CREATE UNIQUE INDEX "Movie_imdb_id_key" ON "Movie"("imdb_id");
|
| 50 |
+
|
| 51 |
+
-- CreateIndex
|
| 52 |
+
CREATE INDEX "Movie_title_idx" ON "Movie"("title");
|
| 53 |
+
|
| 54 |
+
-- CreateIndex
|
| 55 |
+
CREATE UNIQUE INDEX "User_email_key" ON "User"("email");
|
prisma/migrations/20260415141526_transform_to_watchlist_and_content/migration.sql
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
Warnings:
|
| 3 |
+
|
| 4 |
+
- You are about to drop the `Movie` table. If the table is not empty, all the data it contains will be lost.
|
| 5 |
+
|
| 6 |
+
*/
|
| 7 |
+
-- DropTable
|
| 8 |
+
DROP TABLE "Movie";
|
| 9 |
+
|
| 10 |
+
-- CreateTable
|
| 11 |
+
CREATE TABLE "Content" (
|
| 12 |
+
"id" SERIAL NOT NULL,
|
| 13 |
+
"tmdb_id" TEXT,
|
| 14 |
+
"title" TEXT NOT NULL,
|
| 15 |
+
"description" TEXT,
|
| 16 |
+
"releaseDate" TEXT,
|
| 17 |
+
"imageUrl" TEXT,
|
| 18 |
+
"backdropUrl" TEXT,
|
| 19 |
+
"trailer_url" TEXT,
|
| 20 |
+
"category" TEXT,
|
| 21 |
+
"type" TEXT NOT NULL DEFAULT 'movie',
|
| 22 |
+
"rating" DOUBLE PRECISION NOT NULL DEFAULT 0.0,
|
| 23 |
+
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
| 24 |
+
"updatedAt" TIMESTAMP(3) NOT NULL,
|
| 25 |
+
|
| 26 |
+
CONSTRAINT "Content_pkey" PRIMARY KEY ("id")
|
| 27 |
+
);
|
| 28 |
+
|
| 29 |
+
-- CreateTable
|
| 30 |
+
CREATE TABLE "Watchlist" (
|
| 31 |
+
"id" SERIAL NOT NULL,
|
| 32 |
+
"userId" TEXT NOT NULL,
|
| 33 |
+
"contentId" INTEGER NOT NULL,
|
| 34 |
+
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
| 35 |
+
|
| 36 |
+
CONSTRAINT "Watchlist_pkey" PRIMARY KEY ("id")
|
| 37 |
+
);
|
| 38 |
+
|
| 39 |
+
-- CreateTable
|
| 40 |
+
CREATE TABLE "Season" (
|
| 41 |
+
"id" SERIAL NOT NULL,
|
| 42 |
+
"seasonNumber" INTEGER NOT NULL,
|
| 43 |
+
"title" TEXT,
|
| 44 |
+
"tmdb_id" TEXT,
|
| 45 |
+
"contentId" INTEGER NOT NULL,
|
| 46 |
+
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
| 47 |
+
|
| 48 |
+
CONSTRAINT "Season_pkey" PRIMARY KEY ("id")
|
| 49 |
+
);
|
| 50 |
+
|
| 51 |
+
-- CreateTable
|
| 52 |
+
CREATE TABLE "Episode" (
|
| 53 |
+
"id" SERIAL NOT NULL,
|
| 54 |
+
"episodeNumber" INTEGER NOT NULL,
|
| 55 |
+
"title" TEXT NOT NULL,
|
| 56 |
+
"description" TEXT,
|
| 57 |
+
"stillPath" TEXT,
|
| 58 |
+
"seasonId" INTEGER NOT NULL,
|
| 59 |
+
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
| 60 |
+
|
| 61 |
+
CONSTRAINT "Episode_pkey" PRIMARY KEY ("id")
|
| 62 |
+
);
|
| 63 |
+
|
| 64 |
+
-- CreateIndex
|
| 65 |
+
CREATE UNIQUE INDEX "Content_tmdb_id_key" ON "Content"("tmdb_id");
|
| 66 |
+
|
| 67 |
+
-- CreateIndex
|
| 68 |
+
CREATE INDEX "Content_title_idx" ON "Content"("title");
|
| 69 |
+
|
| 70 |
+
-- CreateIndex
|
| 71 |
+
CREATE UNIQUE INDEX "Watchlist_userId_contentId_key" ON "Watchlist"("userId", "contentId");
|
| 72 |
+
|
| 73 |
+
-- CreateIndex
|
| 74 |
+
CREATE UNIQUE INDEX "Season_tmdb_id_key" ON "Season"("tmdb_id");
|
| 75 |
+
|
| 76 |
+
-- AddForeignKey
|
| 77 |
+
ALTER TABLE "Watchlist" ADD CONSTRAINT "Watchlist_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
| 78 |
+
|
| 79 |
+
-- AddForeignKey
|
| 80 |
+
ALTER TABLE "Watchlist" ADD CONSTRAINT "Watchlist_contentId_fkey" FOREIGN KEY ("contentId") REFERENCES "Content"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
| 81 |
+
|
| 82 |
+
-- AddForeignKey
|
| 83 |
+
ALTER TABLE "Season" ADD CONSTRAINT "Season_contentId_fkey" FOREIGN KEY ("contentId") REFERENCES "Content"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
| 84 |
+
|
| 85 |
+
-- AddForeignKey
|
| 86 |
+
ALTER TABLE "Episode" ADD CONSTRAINT "Episode_seasonId_fkey" FOREIGN KEY ("seasonId") REFERENCES "Season"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
prisma/migrations/20260423144202_add_scrapelog_model/migration.sql
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
-- AlterTable
|
| 2 |
+
ALTER TABLE "Episode" ADD COLUMN "duration" TEXT,
|
| 3 |
+
ADD COLUMN "videoUrl" TEXT;
|
| 4 |
+
|
| 5 |
+
-- CreateTable
|
| 6 |
+
CREATE TABLE "ScrapeLog" (
|
| 7 |
+
"id" SERIAL NOT NULL,
|
| 8 |
+
"targetUrl" TEXT NOT NULL,
|
| 9 |
+
"success" BOOLEAN NOT NULL,
|
| 10 |
+
"streamUrl" TEXT,
|
| 11 |
+
"error" TEXT,
|
| 12 |
+
"duration" INTEGER,
|
| 13 |
+
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
| 14 |
+
|
| 15 |
+
CONSTRAINT "ScrapeLog_pkey" PRIMARY KEY ("id")
|
| 16 |
+
);
|
| 17 |
+
|
| 18 |
+
-- CreateIndex
|
| 19 |
+
CREATE INDEX "ScrapeLog_targetUrl_idx" ON "ScrapeLog"("targetUrl");
|
| 20 |
+
|
| 21 |
+
-- CreateIndex
|
| 22 |
+
CREATE INDEX "ScrapeLog_success_idx" ON "ScrapeLog"("success");
|
| 23 |
+
|
| 24 |
+
-- CreateIndex
|
| 25 |
+
CREATE INDEX "ScrapeLog_createdAt_idx" ON "ScrapeLog"("createdAt");
|
prisma/migrations/20260424144601_add_broken_links/migration.sql
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
-- CreateTable
|
| 2 |
+
CREATE TABLE "BrokenLink" (
|
| 3 |
+
"id" SERIAL NOT NULL,
|
| 4 |
+
"url" TEXT NOT NULL,
|
| 5 |
+
"error" TEXT,
|
| 6 |
+
"provider" TEXT,
|
| 7 |
+
"timestamp" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
| 8 |
+
|
| 9 |
+
CONSTRAINT "BrokenLink_pkey" PRIMARY KEY ("id")
|
| 10 |
+
);
|
| 11 |
+
|
| 12 |
+
-- CreateIndex
|
| 13 |
+
CREATE INDEX "BrokenLink_url_idx" ON "BrokenLink"("url");
|
| 14 |
+
|
| 15 |
+
-- CreateIndex
|
| 16 |
+
CREATE INDEX "BrokenLink_provider_idx" ON "BrokenLink"("provider");
|
| 17 |
+
|
| 18 |
+
-- CreateIndex
|
| 19 |
+
CREATE INDEX "BrokenLink_timestamp_idx" ON "BrokenLink"("timestamp");
|
prisma/migrations/migration_lock.toml
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Please do not edit this file manually
|
| 2 |
+
# It should be added in your version-control system (e.g., Git)
|
| 3 |
+
provider = "postgresql"
|
prisma/schema.prisma
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
generator client {
|
| 2 |
+
provider = "prisma-client-js"
|
| 3 |
+
}
|
| 4 |
+
|
| 5 |
+
datasource db {
|
| 6 |
+
provider = "postgresql"
|
| 7 |
+
url = env("DATABASE_URL")
|
| 8 |
+
}
|
| 9 |
+
|
| 10 |
+
model Content {
|
| 11 |
+
id Int @id @default(autoincrement())
|
| 12 |
+
tmdbId String? @unique @map("tmdb_id")
|
| 13 |
+
title String
|
| 14 |
+
description String? @db.Text
|
| 15 |
+
releaseDate String?
|
| 16 |
+
|
| 17 |
+
// Visuales
|
| 18 |
+
imageUrl String?
|
| 19 |
+
backdropUrl String?
|
| 20 |
+
trailerUrl String? @map("trailer_url")
|
| 21 |
+
|
| 22 |
+
// Clasificación y Tipo
|
| 23 |
+
category String?
|
| 24 |
+
type String @default("movie") // "movie" o "tv"
|
| 25 |
+
rating Float @default(0.0)
|
| 26 |
+
|
| 27 |
+
// Relaciones
|
| 28 |
+
seasons Season[]
|
| 29 |
+
watchlist Watchlist[] // Relación con "Mi Lista"
|
| 30 |
+
|
| 31 |
+
createdAt DateTime @default(now())
|
| 32 |
+
updatedAt DateTime @updatedAt
|
| 33 |
+
|
| 34 |
+
@@index([title])
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
// Modelo para "Mi Lista" (Antes Favoritos)
|
| 38 |
+
model Watchlist {
|
| 39 |
+
id Int @id @default(autoincrement())
|
| 40 |
+
userId String
|
| 41 |
+
user User @relation(fields: [userId], references: [id])
|
| 42 |
+
contentId Int
|
| 43 |
+
content Content @relation(fields: [contentId], references: [id])
|
| 44 |
+
|
| 45 |
+
createdAt DateTime @default(now())
|
| 46 |
+
|
| 47 |
+
@@unique([userId, contentId]) // Evita duplicados en la lista
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
model Season {
|
| 51 |
+
id Int @id @default(autoincrement())
|
| 52 |
+
seasonNumber Int
|
| 53 |
+
title String?
|
| 54 |
+
tmdbId String? @unique @map("tmdb_id")
|
| 55 |
+
|
| 56 |
+
contentId Int
|
| 57 |
+
content Content @relation(fields: [contentId], references: [id], onDelete: Cascade)
|
| 58 |
+
episodes Episode[]
|
| 59 |
+
|
| 60 |
+
createdAt DateTime @default(now())
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
model Episode {
|
| 64 |
+
id Int @id @default(autoincrement())
|
| 65 |
+
episodeNumber Int
|
| 66 |
+
title String
|
| 67 |
+
description String? @db.Text
|
| 68 |
+
stillPath String?
|
| 69 |
+
videoUrl String?
|
| 70 |
+
duration String?
|
| 71 |
+
|
| 72 |
+
seasonId Int
|
| 73 |
+
season Season @relation(fields: [seasonId], references: [id], onDelete: Cascade)
|
| 74 |
+
|
| 75 |
+
createdAt DateTime @default(now())
|
| 76 |
+
}
|
| 77 |
+
|
| 78 |
+
enum PlanType {
|
| 79 |
+
basico
|
| 80 |
+
estandar
|
| 81 |
+
premium
|
| 82 |
+
}
|
| 83 |
+
|
| 84 |
+
model User {
|
| 85 |
+
id String @id @default(uuid())
|
| 86 |
+
email String @unique
|
| 87 |
+
password String? @default("123456")
|
| 88 |
+
name String
|
| 89 |
+
profilePic String? @default("assets/avatars/usuario5.webp")
|
| 90 |
+
createdAt DateTime @default(now())
|
| 91 |
+
plan PlanType @default(basico)
|
| 92 |
+
isVerified Boolean @default(false)
|
| 93 |
+
pin String?
|
| 94 |
+
pinExpiresAt DateTime?
|
| 95 |
+
language String @default("es")
|
| 96 |
+
parentalPin String?
|
| 97 |
+
maturityLevel String @default("18+")
|
| 98 |
+
subtitleSize String @default("medium")
|
| 99 |
+
autoPlay Boolean @default(true)
|
| 100 |
+
myList Watchlist[]
|
| 101 |
+
}
|
| 102 |
+
|
| 103 |
+
// Modelo para logs de scraping
|
| 104 |
+
model ScrapeLog {
|
| 105 |
+
id Int @id @default(autoincrement())
|
| 106 |
+
targetUrl String @db.Text
|
| 107 |
+
success Boolean
|
| 108 |
+
streamUrl String? @db.Text
|
| 109 |
+
error String? @db.Text
|
| 110 |
+
duration Int? // Duración en milisegundos
|
| 111 |
+
createdAt DateTime @default(now())
|
| 112 |
+
|
| 113 |
+
@@index([targetUrl])
|
| 114 |
+
@@index([success])
|
| 115 |
+
@@index([createdAt])
|
| 116 |
+
}
|
| 117 |
+
|
| 118 |
+
// Modelo para enlaces rotos detectados por el scraper
|
| 119 |
+
model BrokenLink {
|
| 120 |
+
id Int @id @default(autoincrement())
|
| 121 |
+
url String @db.Text
|
| 122 |
+
error String? @db.Text
|
| 123 |
+
provider String?
|
| 124 |
+
timestamp DateTime @default(now())
|
| 125 |
+
|
| 126 |
+
@@index([url])
|
| 127 |
+
@@index([provider])
|
| 128 |
+
@@index([timestamp])
|
| 129 |
+
}
|
prisma/seed.ts
ADDED
|
@@ -0,0 +1,232 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { PrismaClient } from '@prisma/client'
|
| 2 |
+
|
| 3 |
+
const prisma = new PrismaClient()
|
| 4 |
+
|
| 5 |
+
// Función para generar episodios con títulos dinámicos
|
| 6 |
+
const generateEpisodes = (count: number, prefix: string) => {
|
| 7 |
+
return Array.from({ length: count }, (_, i) => ({
|
| 8 |
+
episodeNumber: i + 1,
|
| 9 |
+
title: `${prefix} - Ep. ${i + 1}`,
|
| 10 |
+
videoUrl: "https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8",
|
| 11 |
+
duration: "24m"
|
| 12 |
+
}));
|
| 13 |
+
};
|
| 14 |
+
|
| 15 |
+
async function main() {
|
| 16 |
+
console.log('--- Iniciando limpieza total ---')
|
| 17 |
+
await prisma.content.deleteMany()
|
| 18 |
+
console.log('✅ Base de datos limpiada.')
|
| 19 |
+
|
| 20 |
+
const series = [
|
| 21 |
+
{
|
| 22 |
+
tmdbId: "209867",
|
| 23 |
+
title: "Frieren: Beyond Journey's End",
|
| 24 |
+
description: "La maga elfa Frieren y su viaje para entender el corazón humano.",
|
| 25 |
+
imageUrl: "https://image.tmdb.org/t/p/w500/dqZENchTd7lp5zht7BdlqM7RBhD.jpg",
|
| 26 |
+
backdropUrl: "https://image.tmdb.org/t/p/original/rBOnrVlck7BIlGeWVlzYiZeg4l2.jpg",
|
| 27 |
+
type: "tv",
|
| 28 |
+
category: "Animation",
|
| 29 |
+
releaseDate: "2023-09-29",
|
| 30 |
+
rating: 8.9,
|
| 31 |
+
seasons: {
|
| 32 |
+
create: [
|
| 33 |
+
{ seasonNumber: 1, title: "Temporada 1", episodes: { create: generateEpisodes(28, "Frieren T1") } }
|
| 34 |
+
]
|
| 35 |
+
}
|
| 36 |
+
},
|
| 37 |
+
{
|
| 38 |
+
tmdbId: "65942",
|
| 39 |
+
title: "Re:ZERO -Starting Life in Another World-",
|
| 40 |
+
description: "Subaru Natsuki jura salvar a la chica que ama volviendo de la muerte.",
|
| 41 |
+
imageUrl: "https://image.tmdb.org/t/p/w500/aRwmcX36r1ZpR5Xq5mmFcpUDQ8J.jpg",
|
| 42 |
+
type: "tv",
|
| 43 |
+
category: "Animation",
|
| 44 |
+
releaseDate: "2016-04-04",
|
| 45 |
+
rating: 8.3,
|
| 46 |
+
seasons: {
|
| 47 |
+
create: [
|
| 48 |
+
{ seasonNumber: 1, title: "Temporada 1", episodes: { create: generateEpisodes(25, "Re:Zero T1") } },
|
| 49 |
+
{ seasonNumber: 2, title: "Temporada 2", episodes: { create: generateEpisodes(25, "Re:Zero T2") } },
|
| 50 |
+
{ seasonNumber: 3, title: "Temporada 3", episodes: { create: generateEpisodes(16, "Re:Zero T3") } }
|
| 51 |
+
]
|
| 52 |
+
}
|
| 53 |
+
},
|
| 54 |
+
{
|
| 55 |
+
tmdbId: "37854",
|
| 56 |
+
title: "One Piece",
|
| 57 |
+
description: "La gran era de los piratas y la búsqueda del tesoro legendario.",
|
| 58 |
+
imageUrl: "https://image.tmdb.org/t/p/w500/uiIB9ctqZFbfRXXimtpmZb5dusi.jpg",
|
| 59 |
+
type: "tv",
|
| 60 |
+
category: "Animation",
|
| 61 |
+
releaseDate: "1999-10-20",
|
| 62 |
+
rating: 8.7,
|
| 63 |
+
seasons: {
|
| 64 |
+
create: [
|
| 65 |
+
{ seasonNumber: 1, title: "East Blue a Egghead", episodes: { create: generateEpisodes(1120, "One Piece") } }
|
| 66 |
+
]
|
| 67 |
+
}
|
| 68 |
+
},
|
| 69 |
+
{
|
| 70 |
+
tmdbId: "76479",
|
| 71 |
+
title: "The Boys",
|
| 72 |
+
description: "A group of vigilantes set out to take down corrupt superheroes.",
|
| 73 |
+
imageUrl: "https://image.tmdb.org/t/p/w500/in1R2dDc421JxsoRWaIIAqVI2KE.jpg",
|
| 74 |
+
backdropUrl: "https://image.tmdb.org/t/p/original/bq28ajZaoMyzEIm6REelqyqtEDZ.jpg",
|
| 75 |
+
type: "tv",
|
| 76 |
+
category: "Sci-Fi",
|
| 77 |
+
releaseDate: "2019-07-25",
|
| 78 |
+
rating: 8.4,
|
| 79 |
+
seasons: {
|
| 80 |
+
create: [
|
| 81 |
+
{ seasonNumber: 1, title: "Season 1", episodes: { create: generateEpisodes(8, "The Boys S1") } },
|
| 82 |
+
{ seasonNumber: 2, title: "Season 2", episodes: { create: generateEpisodes(8, "The Boys S2") } },
|
| 83 |
+
{ seasonNumber: 3, title: "Season 3", episodes: { create: generateEpisodes(8, "The Boys S3") } },
|
| 84 |
+
{ seasonNumber: 4, title: "Season 4", episodes: { create: generateEpisodes(8, "The Boys S4") } }
|
| 85 |
+
]
|
| 86 |
+
}
|
| 87 |
+
},
|
| 88 |
+
{
|
| 89 |
+
tmdbId: "95557",
|
| 90 |
+
title: "Invincible",
|
| 91 |
+
description: "Mark comienza a desarrollar poderes propios bajo la tutela de su padre.",
|
| 92 |
+
imageUrl: "https://image.tmdb.org/t/p/w500/4tblBrslcKSifMVZ3TmtT2ukMor.jpg",
|
| 93 |
+
backdropUrl: "https://image.tmdb.org/t/p/original/9qrroces8C6R9aKr08hACNPVXdZ.jpg",
|
| 94 |
+
type: "tv",
|
| 95 |
+
category: "Animation",
|
| 96 |
+
releaseDate: "2021-03-25",
|
| 97 |
+
rating: 8.6,
|
| 98 |
+
seasons: {
|
| 99 |
+
create: [
|
| 100 |
+
{ seasonNumber: 1, title: "Temporada 1", episodes: { create: generateEpisodes(8, "Invincible T1") } },
|
| 101 |
+
{ seasonNumber: 2, title: "Temporada 2", episodes: { create: generateEpisodes(8, "Invincible T2") } },
|
| 102 |
+
{ seasonNumber: 3, title: "Temporada 3", episodes: { create: generateEpisodes(8, "Invincible T3") } },
|
| 103 |
+
{ seasonNumber: 4, title: "Temporada 4", episodes: { create: generateEpisodes(8, "Invincible T4") } }
|
| 104 |
+
]
|
| 105 |
+
}
|
| 106 |
+
},
|
| 107 |
+
{
|
| 108 |
+
tmdbId: "85552",
|
| 109 |
+
title: "Euphoria",
|
| 110 |
+
description: "Drama juvenil sobre amor, drogas y redes sociales.",
|
| 111 |
+
imageUrl: "https://image.tmdb.org/t/p/w500/aJrG7OkoTMPWG5c8opz8a93AZPY.jpg",
|
| 112 |
+
backdropUrl: "https://image.tmdb.org/t/p/original/GN2KFXiHPVV6sIw4v2P2pqCJty.jpg",
|
| 113 |
+
type: "tv",
|
| 114 |
+
category: "Drama",
|
| 115 |
+
releaseDate: "2019-06-16",
|
| 116 |
+
rating: 8.3,
|
| 117 |
+
seasons: {
|
| 118 |
+
create: [
|
| 119 |
+
{ seasonNumber: 1, title: "Season 1", episodes: { create: generateEpisodes(8, "Euphoria S1") } },
|
| 120 |
+
{ seasonNumber: 2, title: "Season 2", episodes: { create: generateEpisodes(8, "Euphoria S2") } }
|
| 121 |
+
]
|
| 122 |
+
}
|
| 123 |
+
},
|
| 124 |
+
{
|
| 125 |
+
tmdbId: "79744",
|
| 126 |
+
title: "The Rookie",
|
| 127 |
+
description: "El novato más viejo del LAPD enfrenta nuevos retos.",
|
| 128 |
+
imageUrl: "https://image.tmdb.org/t/p/w500/70kTz0OmjjZe7zHvIDrq2iKW7PJ.jpg",
|
| 129 |
+
type: "tv",
|
| 130 |
+
category: "Crime",
|
| 131 |
+
releaseDate: "2018-10-16",
|
| 132 |
+
rating: 8.5,
|
| 133 |
+
seasons: {
|
| 134 |
+
create: [
|
| 135 |
+
{ seasonNumber: 1, title: "Season 1", episodes: { create: generateEpisodes(20, "Rookie S1") } },
|
| 136 |
+
{ seasonNumber: 2, title: "Season 2", episodes: { create: generateEpisodes(20, "Rookie S2") } },
|
| 137 |
+
{ seasonNumber: 3, title: "Season 3", episodes: { create: generateEpisodes(14, "Rookie S3") } },
|
| 138 |
+
{ seasonNumber: 4, title: "Season 4", episodes: { create: generateEpisodes(22, "Rookie S4") } },
|
| 139 |
+
{ seasonNumber: 5, title: "Season 5", episodes: { create: generateEpisodes(22, "Rookie S5") } },
|
| 140 |
+
{ seasonNumber: 6, title: "Season 6", episodes: { create: generateEpisodes(10, "Rookie S6") } }
|
| 141 |
+
]
|
| 142 |
+
}
|
| 143 |
+
},
|
| 144 |
+
{
|
| 145 |
+
tmdbId: "95479",
|
| 146 |
+
title: "JUJUTSU KAISEN",
|
| 147 |
+
description: "Yuji Itadori se adentra en el mundo de las maldiciones.",
|
| 148 |
+
imageUrl: "https://image.tmdb.org/t/p/w500/6qQzMJG27XOJsyAEEIisoJB45j2.jpg",
|
| 149 |
+
type: "tv",
|
| 150 |
+
category: "Animation",
|
| 151 |
+
releaseDate: "2020-10-03",
|
| 152 |
+
rating: 8.6,
|
| 153 |
+
seasons: {
|
| 154 |
+
create: [
|
| 155 |
+
{ seasonNumber: 1, title: "Season 1", episodes: { create: generateEpisodes(24, "JJK S1") } },
|
| 156 |
+
{ seasonNumber: 2, title: "Season 2", episodes: { create: generateEpisodes(23, "JJK S2") } }
|
| 157 |
+
]
|
| 158 |
+
}
|
| 159 |
+
}
|
| 160 |
+
];
|
| 161 |
+
|
| 162 |
+
const peliculas = [
|
| 163 |
+
{
|
| 164 |
+
tmdbId: "687163",
|
| 165 |
+
title: "Project Hail Mary",
|
| 166 |
+
description: "Ryland Grace despierta en una nave espacial para salvar la Tierra.",
|
| 167 |
+
imageUrl: "https://image.tmdb.org/t/p/w500/yihdXomYb5kTeSivtFndMy5iDmf.jpg",
|
| 168 |
+
type: "movie",
|
| 169 |
+
category: "Sci-Fi",
|
| 170 |
+
releaseDate: "2026-03-15",
|
| 171 |
+
rating: 8.2
|
| 172 |
+
},
|
| 173 |
+
{
|
| 174 |
+
tmdbId: "1226863",
|
| 175 |
+
title: "The Super Mario Galaxy Movie",
|
| 176 |
+
description: "Mario y Luigi viajan por las estrellas para detener a Bowser Jr.",
|
| 177 |
+
imageUrl: "https://image.tmdb.org/t/p/w500/eJGWx219ZcEMVQJhAgMiqo8tYY.jpg",
|
| 178 |
+
type: "movie",
|
| 179 |
+
category: "Adventure",
|
| 180 |
+
releaseDate: "2026-04-01",
|
| 181 |
+
rating: 6.8
|
| 182 |
+
},
|
| 183 |
+
{
|
| 184 |
+
tmdbId: "936075",
|
| 185 |
+
title: "Michael",
|
| 186 |
+
description: "La biografía definitiva de Michael Jackson.",
|
| 187 |
+
imageUrl: "https://image.tmdb.org/t/p/w500/3Qud19bBUrrJAzy0Ilm8gRJlJXP.jpg",
|
| 188 |
+
type: "movie",
|
| 189 |
+
category: "Music",
|
| 190 |
+
releaseDate: "2026-04-22",
|
| 191 |
+
rating: 8.5
|
| 192 |
+
},
|
| 193 |
+
{
|
| 194 |
+
tmdbId: "980431",
|
| 195 |
+
title: "Avatar: Aang, The Last Airbender",
|
| 196 |
+
description: "El último Maestro del Aire busca salvar su cultura.",
|
| 197 |
+
imageUrl: "https://image.tmdb.org/t/p/w500/gPiyTLo5GGwtJl0L8TlaJF9r0KE.jpg",
|
| 198 |
+
type: "movie",
|
| 199 |
+
category: "Animation",
|
| 200 |
+
releaseDate: "2026-10-09",
|
| 201 |
+
rating: 7.0
|
| 202 |
+
},
|
| 203 |
+
{
|
| 204 |
+
tmdbId: "1314481",
|
| 205 |
+
title: "The Devil Wears Prada 2",
|
| 206 |
+
description: "Miranda Priestly navega el declive de las revistas tradicionales.",
|
| 207 |
+
imageUrl: "https://image.tmdb.org/t/p/w500/p35IoKfBtJDNiWJMO8ZEtIMZSfW.jpg",
|
| 208 |
+
type: "movie",
|
| 209 |
+
category: "Comedy",
|
| 210 |
+
releaseDate: "2026-04-29",
|
| 211 |
+
rating: 6.5
|
| 212 |
+
}
|
| 213 |
+
];
|
| 214 |
+
|
| 215 |
+
console.log('--- Insertando Series ---')
|
| 216 |
+
for (const s of series) {
|
| 217 |
+
await prisma.content.create({ data: s });
|
| 218 |
+
console.log(`✅ Serie: ${s.title}`);
|
| 219 |
+
}
|
| 220 |
+
|
| 221 |
+
console.log('--- Insertando Películas ---')
|
| 222 |
+
for (const p of peliculas) {
|
| 223 |
+
await prisma.content.create({ data: p });
|
| 224 |
+
console.log(`✅ Película: ${p.title}`);
|
| 225 |
+
}
|
| 226 |
+
|
| 227 |
+
console.log('--- SEED FINALIZADO CON ÉXITO ---')
|
| 228 |
+
}
|
| 229 |
+
|
| 230 |
+
main()
|
| 231 |
+
.catch((e) => { console.error(e); process.exit(1); })
|
| 232 |
+
.finally(async () => { await prisma.$disconnect(); })
|