We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Having two properties of type PK/id is not supported by the DefaultCrudRepository.
The specification of DefaultCrudRepository is:
export class DefaultCrudRepository< T extends Entity, ID, Relations extends object = {} > implements EntityCrudRepository<T, ID, Relations> { ... }
So the problem is that I can only specify the type of a single id and not of both as you can see in the example below.
Example Code:
@model() class UserHasPermission extends Entity { @property({id: true}) userId: number; @property({id: true}) permissionId: number; constructor(data: Partial<UserHasPermission>) { super(data); } }
class UserHasPermissionRepository extends DefaultCrudRepository< UserHasPermission, typeof UserHasPermission.prototype.id <<<<<----------- Here > { constructor(dataSource: juggler.DataSource) { super(UserHasPermission, dataSource); } }
Any solution?
Node: darwin x64 14.10.1
I have this in the loopback repository, in a test for a HasAndBelongsToMany relation
See Reporting Issues for more tips on writing good issues
The text was updated successfully, but these errors were encountered:
In this case, we should have the following id type:
type UserHasPermissionPK = Pick<UserHasPermission, 'userId' | 'permissionId>
But I don't think LoopBack 4 supports composite ids at runtime.
Sorry, something went wrong.
Would this be a duplicate of #1830?
Yes, I am going to close this issue and we move to that one
No branches or pull requests
Having two properties of type PK/id is not supported by the DefaultCrudRepository.
The specification of DefaultCrudRepository is:
So the problem is that I can only specify the type of a single id and not of both as you can see in the example below.
Example Code:
Any solution?
Additional information
Node: darwin x64 14.10.1
I have this in the loopback repository, in a test for a HasAndBelongsToMany relation
Related Issues
See Reporting Issues for more tips on writing good issues
The text was updated successfully, but these errors were encountered: