Giter Club home page Giter Club logo

Comments (3)

wojtekmach avatar wojtekmach commented on May 25, 2024

Hey @benrom, thanks for bringing this up! I think you're right, at this moment (and taking different auth providers into account) moving foreign key to the auth_accounts makes a lot of sense.

What I was thinking at the time was that there might be an additional user-like record in the backoffice app, in which case there would need to be auth_accounts.{customer_id, backoffice_user_id} which I didn't like (N-colums for N apps). However, I never added it and I'm not sure if that was ever a good idea :-) I specifically wanted to keep is simple. Yet another approach, that I got from @chrismccord, is to have auth_accounts.{app_id, user_id} and that's probably the way to go for multiple apps.

from acme_bank.

benrom avatar benrom commented on May 25, 2024

Ok, thanks for your feedback there!
Yeah, using the same table as customers for authenticating backoffice users is generally not a recommended approach for security reasons anyway.
Thank you for having this project there, it's me a lot for elixir app design!

from acme_bank.

benrom avatar benrom commented on May 25, 2024

Sadly having played a bit with Ecto, it seems like it only allows the owning side of the relationship to be the belongs_to (child) and not the has_* (parent) : whenever you want to preload the associated value it automatically looks for the foreign key on the belongs_to table.
So it looks like your implementation there is the only way to do it with Ecto.

from acme_bank.

Related Issues (16)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.