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

Problem on BossDB ORM Mapping #683

Open
freitzzz opened this issue Nov 28, 2018 · 0 comments
Open

Problem on BossDB ORM Mapping #683

freitzzz opened this issue Nov 28, 2018 · 0 comments

Comments

@freitzzz
Copy link

Good evening guys.

I'm fairly new to Erlang (literally started yesterday) and I'm currently trying to map two models using BossDB, which are AuthenticatedUser and ApiAuth.

Let's assume that ApiAuth is a simple API Token and AuthenticatedUser requires an ApiAuth, and an ApiAuth belongs to only one AuthenticatedUser.
So AuthenticatedUser -> ApiAuth, (One-To-One).

I mapped ApiAuth to belong to only one AuthenticatedUser:
-belongs_to(authenticateduser).

And AuthenticatedUser to require an ApiAuth:
-has({apiauth,1}).

These are the modules I'm working with:

AuthenticatedUser

% Maps an User Model
-module(authenticateduser,[Id,ApiAuthId]).
% An User model is associated to an auth model
-has({apiauth,1}).
-compile(export_all).

ApiAuth

% Maps an Auth Model
% An Auth model has a token which allows the access to the API
-module(apiauth, [Token]).
% An Auth model belongs to a User (1 - 1)
-belongs_to(authenticateduser).
-compile(export_all).

However, when I try to save a new AuthenticatedUser, it succeeds, even though that it's being created with an invalid ApiAuth persistence ID.
Shouldn't it fail due to not finding the respective ApiAuth ID?

Thanks in advance.

PS: Currently using BossDB integrated in-memory persistence provider

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

No branches or pull requests

1 participant