Skip to content
This repository has been archived by the owner on Dec 14, 2022. It is now read-only.

Commit

Permalink
fix(subcollection): subcollection registers as collection name under …
Browse files Browse the repository at this point in the history
…parent rather than field name
  • Loading branch information
lmcq committed Sep 9, 2019
1 parent 709a12e commit a1b7e10
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/decorators/subCollection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { getOrCreateRepository } from '../store';
* @param config The subcollection configuration.
*/
export default (config: ISubCollectionConfig): Function => {
return (target: IEntity, key: string): void => {
return (target: IEntity): void => {
// Get the parent based on the Entity class.
const parentRepository = getOrCreateRepository(target.constructor.name);
const { entity, name } = config;
Expand All @@ -16,6 +16,6 @@ export default (config: ISubCollectionConfig): Function => {
repository.collectionConfig = { entity, name };
repository.parent = parentRepository;
repository.entity = entity;
parentRepository.subcollections.set(key, repository);
parentRepository.subcollections.set(name, repository);
};
};

0 comments on commit a1b7e10

Please sign in to comment.