Closed hwakabh closed 2 months ago
This update refactors the NestJS application to enhance the handling of HTTP requests, specifically in managing music and movie data. The AppController
has been introduced to centralize routing, while the ReleaseController
has been expanded to handle new movie-related endpoints. Additionally, the application's response models have been updated to include collections of music and movie data, and the views have been refactored to dynamically render content without hardcoding. These changes improve modularity, maintainability, and scalability.
Files | Change Summary |
---|---|
src/app.controller.ts , src/models/app.model.ts , src/services/movie.db.service.ts , src/controllers/release.controller.ts , src/views/home.pug |
Introduced AppController for routing, added health check and root routes, updated AppRootResponse model, and enhanced MovieService with new methods. Dynamic rendering of music and movie data in home.pug replaces hardcoded entries. |
src/app.module.ts , src/controllers/mail.controller.ts |
Modified import path for AppController and removed a TODO comment in MailController . |
Objective | Addressed | Explanation |
---|---|---|
Remove hardcoded music/movies entities and enable fetching via services (#[80], #[21]) | ✅ | |
Render with loop in views (#[80]) | ✅ | |
UI would not be changed after running npm run start |
❌ | No explicit validation of UI stability provided. |
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
Evidences. Note that when we hit /
endpoint from browser, the SQL had been called to fetch data via calling internal APIs.
24-08-21 1:08:07 git/6ow3idGirl [refactor/80/views] % npm run start
> 6ow3idgirl@1.2.0 start
> nest start
[Nest] 94992 - 08/21/2024, 1:08:11 AM LOG [NestFactory] Starting Nest application...
[Nest] 94992 - 08/21/2024, 1:08:11 AM LOG [InstanceLoader] TypeOrmModule dependencies initialized +40ms
[Nest] 94992 - 08/21/2024, 1:08:11 AM LOG [InstanceLoader] HttpModule dependencies initialized +0ms
[Nest] 94992 - 08/21/2024, 1:08:11 AM LOG [InstanceLoader] ConfigHostModule dependencies initialized +0ms
[Nest] 94992 - 08/21/2024, 1:08:11 AM LOG [InstanceLoader] ConfigModule dependencies initialized +0ms
query: SELECT VERSION() AS `version`
[Nest] 94992 - 08/21/2024, 1:08:11 AM LOG [InstanceLoader] TypeOrmCoreModule dependencies initialized +25ms
[Nest] 94992 - 08/21/2024, 1:08:11 AM LOG [InstanceLoader] TypeOrmModule dependencies initialized +0ms
[Nest] 94992 - 08/21/2024, 1:08:11 AM LOG [InstanceLoader] AppModule dependencies initialized +0ms
[Nest] 94992 - 08/21/2024, 1:08:11 AM LOG [RoutesResolver] AppController {/}: +3ms
[Nest] 94992 - 08/21/2024, 1:08:11 AM LOG [RouterExplorer] Mapped {/, GET} route +1ms
[Nest] 94992 - 08/21/2024, 1:08:11 AM LOG [RouterExplorer] Mapped {/healthz, GET} route +0ms
[Nest] 94992 - 08/21/2024, 1:08:11 AM LOG [RoutesResolver] MailController {/}: +0ms
[Nest] 94992 - 08/21/2024, 1:08:11 AM LOG [RouterExplorer] Mapped {/mail, POST} route +1ms
[Nest] 94992 - 08/21/2024, 1:08:11 AM LOG [RoutesResolver] ReleaseController {/}: +0ms
[Nest] 94992 - 08/21/2024, 1:08:11 AM LOG [RouterExplorer] Mapped {/music, GET} route +0ms
[Nest] 94992 - 08/21/2024, 1:08:11 AM LOG [RouterExplorer] Mapped {/music/:id, GET} route +0ms
[Nest] 94992 - 08/21/2024, 1:08:11 AM LOG [RouterExplorer] Mapped {/movie, GET} route +0ms
[Nest] 94992 - 08/21/2024, 1:08:11 AM LOG [RouterExplorer] Mapped {/movie/:id, GET} route +0ms
[Nest] 94992 - 08/21/2024, 1:08:11 AM LOG [NestApplication] Nest application successfully started +1ms
query: SELECT `Music`.`id` AS `Music_id`, `Music`.`title` AS `Music_title`, `Music`.`url_local` AS `Music_url_local`, `Music`.`url_spotify` AS `Music_url_spotify`, `Music`.`url_apple` AS `Music_url_apple`, `Music`.`url_line` AS `Music_url_line`, `Music`.`url_amazon` AS `Music_url_amazon`, `Music`.`url_bigup` AS `Music_url_bigup`, `Music`.`created_at` AS `Music_created_at`, `Music`.`updated_at` AS `Music_updated_at` FROM `music` `Music`
GET /music 200 16.375 ms - 3627
query: SELECT `Movie`.`id` AS `Movie_id`, `Movie`.`title` AS `Movie_title`, `Movie`.`descriptions` AS `Movie_descriptions`, `Movie`.`url_local` AS `Movie_url_local`, `Movie`.`url_youtube` AS `Movie_url_youtube`, `Movie`.`created_at` AS `Movie_created_at`, `Movie`.`updated_at` AS `Movie_updated_at` FROM `movie` `Movie`
GET /movie 200 5.057 ms - 1814
GET / 200 217.830 ms - 17396
Issue link
closes: #80
What does this PR do?
app.controller.ts
fromsrc/controller/
to application rootmovie.db.services.ts
src/views/home.pug
/music
and/movie
endpoints(Optional) Additional Contexts for PR Reviews
N/A
Summary by CodeRabbit
New Features
AppController
for handling root and health check routes.AppRootResponse
interface to include collections of music and movie data.Bug Fixes
MailController
andReleaseController
.Refactor