-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22 from Open-Webtoon-Reader/improvement/route-sep…
…aration Merge route separation to Main
- Loading branch information
Showing
9 changed files
with
185 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
42 changes: 42 additions & 0 deletions
42
prisma/migrations/20240518080728_delete_cascade/migration.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
-- RedefineTables | ||
PRAGMA foreign_keys=OFF; | ||
CREATE TABLE "new_webtoon_genres" ( | ||
"webtoon_id" INTEGER NOT NULL, | ||
"genre_id" INTEGER NOT NULL, | ||
|
||
PRIMARY KEY ("webtoon_id", "genre_id"), | ||
CONSTRAINT "webtoon_genres_webtoon_id_fkey" FOREIGN KEY ("webtoon_id") REFERENCES "webtoons" ("id") ON DELETE CASCADE ON UPDATE CASCADE, | ||
CONSTRAINT "webtoon_genres_genre_id_fkey" FOREIGN KEY ("genre_id") REFERENCES "genres" ("id") ON DELETE RESTRICT ON UPDATE CASCADE | ||
); | ||
INSERT INTO "new_webtoon_genres" ("genre_id", "webtoon_id") SELECT "genre_id", "webtoon_id" FROM "webtoon_genres"; | ||
DROP TABLE "webtoon_genres"; | ||
ALTER TABLE "new_webtoon_genres" RENAME TO "webtoon_genres"; | ||
CREATE TABLE "new_episode_images" ( | ||
"number" INTEGER NOT NULL, | ||
"episode_id" INTEGER NOT NULL, | ||
"image_id" INTEGER NOT NULL, | ||
|
||
PRIMARY KEY ("episode_id", "number"), | ||
CONSTRAINT "episode_images_episode_id_fkey" FOREIGN KEY ("episode_id") REFERENCES "episodes" ("id") ON DELETE CASCADE ON UPDATE CASCADE, | ||
CONSTRAINT "episode_images_image_id_fkey" FOREIGN KEY ("image_id") REFERENCES "images" ("id") ON DELETE RESTRICT ON UPDATE CASCADE | ||
); | ||
INSERT INTO "new_episode_images" ("episode_id", "image_id", "number") SELECT "episode_id", "image_id", "number" FROM "episode_images"; | ||
DROP TABLE "episode_images"; | ||
ALTER TABLE "new_episode_images" RENAME TO "episode_images"; | ||
CREATE TABLE "new_episodes" ( | ||
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, | ||
"title" TEXT NOT NULL, | ||
"number" INTEGER NOT NULL, | ||
"webtoon_id" INTEGER NOT NULL, | ||
"thumbnail_id" INTEGER NOT NULL, | ||
CONSTRAINT "episodes_webtoon_id_fkey" FOREIGN KEY ("webtoon_id") REFERENCES "webtoons" ("id") ON DELETE CASCADE ON UPDATE CASCADE, | ||
CONSTRAINT "episodes_thumbnail_id_fkey" FOREIGN KEY ("thumbnail_id") REFERENCES "images" ("id") ON DELETE RESTRICT ON UPDATE CASCADE | ||
); | ||
INSERT INTO "new_episodes" ("id", "number", "thumbnail_id", "title", "webtoon_id") SELECT "id", "number", "thumbnail_id", "title", "webtoon_id" FROM "episodes"; | ||
DROP TABLE "episodes"; | ||
ALTER TABLE "new_episodes" RENAME TO "episodes"; | ||
CREATE UNIQUE INDEX "episodes_webtoon_id_number_key" ON "episodes"("webtoon_id", "number"); | ||
PRAGMA foreign_key_check("webtoon_genres"); | ||
PRAGMA foreign_key_check("episode_images"); | ||
PRAGMA foreign_key_check("episodes"); | ||
PRAGMA foreign_keys=ON; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...toon/models/responses/webtoon.response.ts → ...odels/responses/light-webtoon-response.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 8 additions & 15 deletions
23
...oon/models/responses/episodes.response.ts → ...toon/models/responses/webtoon-response.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,27 @@ | ||
import EpisodeLineModel from "../models/episode-line.model"; | ||
import {ApiProperty} from "@nestjs/swagger"; | ||
import LightWebtoonResponse from "./light-webtoon-response"; | ||
|
||
export default class EpisodesResponse{ | ||
@ApiProperty() | ||
episodes: EpisodeLineModel[]; | ||
export default class WebtoonResponse extends LightWebtoonResponse{ | ||
@ApiProperty() | ||
backgroundBanner: string; | ||
@ApiProperty() | ||
topBanner: string; | ||
@ApiProperty() | ||
mobileBanner: string; | ||
@ApiProperty() | ||
title: string; | ||
@ApiProperty() | ||
author: string; | ||
|
||
constructor( | ||
episodes: EpisodeLineModel[], | ||
id: number, | ||
title: string, | ||
language: string, | ||
thumbnail: string, | ||
author: string, | ||
backgroundBanner: string, | ||
topBanner: string, | ||
mobileBanner: string, | ||
title: string, | ||
author: string | ||
){ | ||
this.episodes = episodes; | ||
super(id, title, language, thumbnail, author); | ||
this.backgroundBanner = backgroundBanner; | ||
this.topBanner = topBanner; | ||
this.mobileBanner = mobileBanner; | ||
this.title = title; | ||
this.author = author; | ||
} | ||
|
||
} |
Oops, something went wrong.