-
Notifications
You must be signed in to change notification settings - Fork 0
new architecture #18
base: main
Are you sure you want to change the base?
new architecture #18
Conversation
You now can get you anime by ID and he's cached so we reduce the requests time. Same shit for episode videos.
Ex: "Status", is now "status" (snake_case for property in the where condition of findMany)
Adding-latest-feature
Enhanced the application's architecture by integrating Fastify for the web server framework, Prisma as the ORM for database interactions, and Redis for caching capabilities. This setup provides a robust foundation for building scalable web applications. - Initialized Fastify with custom configuration, disabling the logger by default for streamlined operation. - Established a PrismaClient instance for database interactions, enabling advanced data management and query capabilities. - Configured Redis client and implemented automatic connection logic, including environment-specific behavior (e.g., flushing the database in development mode for a clean slate). - Defined `AppOptions` interface to type-check application options, ensuring type safety across app components. - Set up graceful shutdown procedures to properly close database and Redis connections upon application termination, enhancing resource management and stability. - Refined the server's listen method to dynamically use environment variables for port and host settings, improving deployment flexibility. This commit lays the groundwork for a modular, efficient backend structure that leverages the strengths of each integrated technology.
This commit significantly refactors the animeService class to enhance readability, improve cache management, and remove unused imports and functions. Key changes include: - Removed unused imports such as `config`, `PrismaClient`, and various types from "@api/contracts/animesContract". - Simplified the `AnimeService` constructor to use `PrismaClient` and `CacheManager` directly, enhancing dependency injection and testing capabilities. - Optimized `getAnimeById` to better utilize caching for anime details, reducing unnecessary database queries. - Introduced `getAndEnrichAnimesList` to fetch and optionally enrich a list of animes with additional details, leveraging both database queries and cache for improved performance. - Removed outdated functions responsible for updating the anime database and fetching the latest episodes. This functionality is presumed to be handled elsewhere or refactored into a more appropriate service or scheduled task. - Updated routes in `animes.ts` to reflect changes in the animeService's API, ensuring compatibility with the refactored service methods. - Adjusted other service classes and route handlers to align with the refactoring, ensuring consistent use of `PrismaClient` and `CacheManager`. Overall, this commit aims to make the animeService more efficient, maintainable, and aligned with best practices in cache usage and data fetching.
…o use Timestamp in database)
- Set project to private in root `package.json` to avoid accidental publishing. - Introduced a `clean` script in root `package.json` for easier workspace cleanup. - Updated `fastify` dependency and added `@gazes/types` as a workspace dependency in `packages/api/package.json` to ensure consistency and leverage shared types. - Refined imports and simplified the structure in `packages/api/src/routes/animes.router.ts` by utilizing shared types from `@gazes/types`, demonstrating a move towards more modular and maintainable code. - Initialized `packages/types` with essential configurations and a basic README for better clarity and documentation. - Enhanced TypeScript configuration across packages to better support modular architecture and shared types, ensuring smoother development and integration across workspaces. Binary files `bun.lockb` updated to reflect new dependency resolutions and package updates.
- Deleted the `packages/types/types/types.d.ts` file to clean up unnecessary type declarations. This change streamlines the types package, removing a redundant declaration that may have been superseded by direct TypeScript configurations or internal type definitions within the `@gazes/types` package itself.
- Removed the `.gitignore` file from `packages/types`, aligning with a project-wide strategy to centralize ignore patterns and reduce redundancy. - Deleted `README.md` from `packages/types` to streamline documentation, focusing on a unified project documentation approach rather than package-specific instructions.
- 🎨 Improve code style in `app.ts` with better formatting and added comments for clarity. - 🔀 Rename `animes.router.ts` to `animeRouter.ts` and move to `routers` directory for consistent naming and organization. - 📝 Add `routeTypes.ts` for centralizing route-related type definitions, improving code maintainability.
- Correct the import path for `RouteOptions` to `@/types/routeTypes`, fixing a previously overlooked update. - Adjust the structure within `animeRouter.ts` for better readability.
- 🚫 Add `.gitignore` to exclude `node_modules` and `.env` files from version control. - 🗃️ Introduce Prisma schema for PostgreSQL integration with an initial `Anime` model definition. - ✏️ Minor adjustments in `animeRouter.ts` to enhance readability with added whitespace. - 🏗️ Create `animeService.ts` for future business logic related to anime entities.
- 🔄 Update `bun.lockb` to reflect changes in dependencies. - ➕ Add `prisma` version "^5.12.0" to `dependencies` in `package.json`, supporting enhanced database interactions. - 🗑️ Remove `.gitignore` in `packages/api` as part of reorganizing project configuration.
- Introduced `.env.example` for environment variable management. - Moved and updated `package.json` within the `apps/api` directory, adding new dependencies and scripts for development and build processes. - Created a new Prisma migration for the `Anime` table, outlining the structure for anime data storage. - Developed new services and routes for fetching, caching, and serving anime data. - Configured Docker Compose with PostgreSQL and Redis services to support local development. - Enhanced the codebase with TypeScript configurations and utility functions for environment variable and fetch operations.
Because they forgot it on the new branch, and also didn't use the valid filename. Signed-off-by: Nicolas Paul <[email protected]>
Please learn how to type Signed-off-by: Nicolas Paul <[email protected]>
Default documentation files
Signed-off-by: exatombe <[email protected]>
- Reformatted `package.json` for consistency in indentation. - Removed an outdated Prisma migration file, indicating a possible schema or database reorganization. - Updated Prisma schema to enable preview features like fullTextSearch and fullTextIndex, preparing the API for more advanced query capabilities. - Refined the structure and syntax across various service and utility files for improved readability and adherence to best practices. This includes minor adjustments like consistent use of semicolons, simplified import statements, and more descriptive typing for anime data. - Introduced a new type definition for fetched anime data, ensuring better type safety and clarity when handling anime information. - Adjusted route handling in `animeRouter.ts` to directly return fetched anime lists, enhancing the endpoint's functionality. - Made improvements to the caching service for more robust and clearer cache management. This commit significantly refactors the API's codebase for better maintainability, prepares the application for future feature expansions, and optimizes data handling and type safety.
…nto new-architecture
Potential issues, bugs, and flaws:
Code suggestions and improvements:
|
|
GitGuardian id | GitGuardian status | Secret | Commit | Filename | |
---|---|---|---|---|---|
10127395 | Triggered | Generic High Entropy Secret | 37a9f2f | nx.json | View secret |
10127395 | Triggered | Generic High Entropy Secret | a1a4091 | nx.json | View secret |
10127395 | Triggered | Generic High Entropy Secret | 37a9f2f | nx.json | View secret |
10127395 | Triggered | Generic High Entropy Secret | 5a3fa06 | nx.json | View secret |
10135732 | Triggered | Generic High Entropy Secret | d48c9c4 | apps/gazes-api/src/config.ts | View secret |
10135732 | Triggered | Generic High Entropy Secret | 7ff77d3 | apps/gazes-api/src/config.ts | View secret |
10251448 | Triggered | Generic Password | 8c9f51c | apps/api/docker-compose.yml | View secret |
🛠 Guidelines to remediate hardcoded secrets
- Understand the implications of revoking this secret by investigating where it is used in your code.
- Replace and store your secrets safely. Learn here the best practices.
- Revoke and rotate these secrets.
- If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.
To avoid such incidents in the future consider
- following these best practices for managing and storing secrets including API keys and other credentials
- install secret detection on pre-commit to catch secret before it leaves your machine and ease remediation.
🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.
Our GitHub checks need improvements? Share your feedbacks!
DO NOT PULL FOR THE MOMENT.
packages/types
directory