Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Would it be possible to customize the output directory of sea-orm entities command called by loco db entities? #1281

Open
brandonpollack23 opened this issue Mar 3, 2025 · 2 comments
Labels
enhancement New feature or request

Comments

@brandonpollack23
Copy link

Feature Request

Is your feature request related to a problem? Please describe.

Not a problem, simply would be nice to use the loco CLI to generate entities to a separate crate in teh workspace. The reason here is I'm trying to write a front end in Dioxus or some other wasm based front end system. I can already override the static server to be another folder in the workspace based on my research, but it'd be great to reuse the same entity structures on the front end!

I think I can do this if I just generate entities with the sea-orm cli, but the entities automatically created by the cli migrate command aren't included in that.

Describe the solution you'd like

just a CLI flag to specify an output directory so I can point it to my workspace (or a config file...I know I know convention over configuration, I'm open to any solution here).

Describe alternatives you've considered

I could manually manage this so my front end depends on a mutual crate as my backend, but it'd be great if loco knew about this potential use case :)

@brandonpollack23 brandonpollack23 added the enhancement New feature or request label Mar 3, 2025
@brandonpollack23
Copy link
Author

brandonpollack23 commented Mar 3, 2025

Side note:

I think this structure could also work for me and avoid needing this so I wonder what you think:

loco-app/
Cargo.toml
config/development.yml -- modified to point to target/dx/... for static serving
dioxus-frontend/
Cargo.toml
dioxus-server-fns/
Cargo.toml

  • Dioxus FE depends on Dioxus Server Fns
  • Dioxus Server Fns Depends on Loco App library (for entities) and injects its created routes/services somehow before initializers are called? (not sure this is actually possible).

Another solution is:
Make 3 crates:
loco
dioxus
main

Main also defineds a MainApp which wraps App and defines Hooks and adds the dioxus hook as well, not sure if this works but seems ok. This way loco can stay unchanged. If this works maybe it'd help someone else to document it. I'll check when i get a chance

@brandonpollack23
Copy link
Author

I also just realized I can likely create an initializer that is in a separate crate I depend on and depends on my front end for the routes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant