Skip to content

CLI generates DatabaseModule with PostgresService even when selecting "in-memory" #103

Open
@btd1337

Description

@btd1337

Describe the bug
When creating a new project using the danet CLI and selecting "in-memory" as the database provider, the generated DatabaseModule still references PostgresService, which does not exist in the project, causing a runtime error.

To Reproduce
Steps to reproduce the behavior:

  1. Run the following command:
    danet new danet-in-memory
  2. Select "in-memory" as the database provider.
  3. After project creation, check the file src/database/module.ts.
  4. The file contains an import and injection for PostgresService, which does not exist.
  5. Running the application results in the following error:
    ERROR: src/database/postgres.service.ts File not found. Please check the file path
    

Expected behavior
When selecting "in-memory" as the database provider, the generated DatabaseModule should correctly use an in-memory repository instead of referencing PostgresService.

Screenshots
N/A

Desktop (please complete the following information):

  • OS: MacOS Ventura
  • Deno: 2.2.4
  • v8: 13.4.114.11-rusty
  • Typescript: 5.7.3
  • Danet CLI Version: 0.10.0

Smartphone (please complete the following information, if applicable):
N/A

Additional context
The TodoModule correctly references InMemoryTodoRepository, but DatabaseModule does not reflect the selected database provider. It still attempts to import and inject PostgresService, leading to a missing file error.

Possible fix: Adjust the CLI project generator to properly configure the DatabaseModule based on the selected database provider.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions