hwakabh / 6ow3idgirl.com

Official Homepage of 6ow3idgirl
https://6ow3idgirl.com/
MIT License
0 stars 0 forks source link

refactor(views): implemented loop rendering #103

Closed hwakabh closed 2 months ago

hwakabh commented 2 months ago

Issue link

closes: #80

What does this PR do?

(Optional) Additional Contexts for PR Reviews

N/A

Summary by CodeRabbit

coderabbitai[bot] commented 2 months ago

Walkthrough

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.

Changes

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.

Assessment against linked issues

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?

Share - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)
Tips ### Chat There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai): - Review comments: Directly reply to a review comment made by CodeRabbit. Example: - `I pushed a fix in commit .` - `Generate unit testing code for this file.` - `Open a follow-up GitHub issue for this discussion.` - Files and specific lines of code (under the "Files changed" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples: - `@coderabbitai generate unit testing code for this file.` - `@coderabbitai modularize this function.` - PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples: - `@coderabbitai generate interesting stats about this repository and render them as a table.` - `@coderabbitai show all the console.log statements in this repository.` - `@coderabbitai read src/utils.ts and generate unit testing code.` - `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.` - `@coderabbitai help me debug CodeRabbit configuration file.` Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. ### CodeRabbit Commands (invoked as PR comments) - `@coderabbitai pause` to pause the reviews on a PR. - `@coderabbitai resume` to resume the paused reviews. - `@coderabbitai review` to trigger an incremental review. This is useful when automatic reviews are disabled for the repository. - `@coderabbitai full review` to do a full review from scratch and review all the files again. - `@coderabbitai summary` to regenerate the summary of the PR. - `@coderabbitai resolve` resolve all the CodeRabbit review comments. - `@coderabbitai configuration` to show the current CodeRabbit configuration for the repository. - `@coderabbitai help` to get help. Additionally, you can add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed. ### CodeRabbit Configuration File (`.coderabbit.yaml`) - You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository. - Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information. - If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json` ### Documentation and Community - Visit our [Documentation](https://coderabbit.ai/docs) for detailed information on how to use CodeRabbit. - Join our [Discord Community](https://discord.com/invite/GsXnASn26c) to get help, request features, and share feedback. - Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.
hwakabh commented 2 months ago

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