Skip to content

Commit

Permalink
Revert "refactor: return target from decorator definition"
Browse files Browse the repository at this point in the history
This reverts commit 72c3ace.
  • Loading branch information
B4nan committed Sep 18, 2020
1 parent 72c3ace commit e021617
Show file tree
Hide file tree
Showing 11 changed files with 0 additions and 22 deletions.
2 changes: 0 additions & 2 deletions packages/core/src/decorators/Embedded.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ export function Embedded(options: EmbeddedOptions | (() => AnyEntity) = {}) {
Utils.defaultValue(options, 'prefix', true);
const property = { name: propertyName, reference: ReferenceType.EMBEDDED } as EntityProperty;
meta.properties[propertyName] = Object.assign(property, options);

return target;
};
}

Expand Down
2 changes: 0 additions & 2 deletions packages/core/src/decorators/Enum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ export function Enum(options: EnumOptions<AnyEntity> | (() => Dictionary) = {})
const meta = MetadataStorage.getMetadataFromDecorator(target.constructor);
options = options instanceof Function ? { items: options } : options;
meta.properties[propertyName] = Object.assign({ name: propertyName, reference: ReferenceType.SCALAR, enum: true }, options) as EntityProperty;

return target;
};
}

Expand Down
2 changes: 0 additions & 2 deletions packages/core/src/decorators/Indexed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ function createDecorator(options: IndexOptions | UniqueOptions, unique: boolean)
options.properties = options.properties || propertyName;
const key = unique ? 'uniques' : 'indexes';
meta[key].push(options as Required<IndexOptions | UniqueOptions>);

return target;
};
}

Expand Down
2 changes: 0 additions & 2 deletions packages/core/src/decorators/ManyToMany.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ export function ManyToMany<T, O>(
MetadataValidator.validateSingleDecorator(meta, propertyName, ReferenceType.MANY_TO_MANY);
const property = { name: propertyName, reference: ReferenceType.MANY_TO_MANY } as EntityProperty<T>;
meta.properties[propertyName] = Object.assign(meta.properties[propertyName] ?? {}, property, options);

return target;
};
}

Expand Down
2 changes: 0 additions & 2 deletions packages/core/src/decorators/ManyToOne.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ export function ManyToOne<T, O>(
MetadataValidator.validateSingleDecorator(meta, propertyName, ReferenceType.MANY_TO_ONE);
const property = { name: propertyName, reference: ReferenceType.MANY_TO_ONE } as EntityProperty;
meta.properties[propertyName] = Object.assign(meta.properties[propertyName] ?? {}, property, options);

return target;
};
}

Expand Down
2 changes: 0 additions & 2 deletions packages/core/src/decorators/OneToMany.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ export function createOneToDecorator<T, O>(
MetadataValidator.validateSingleDecorator(meta, propertyName, reference);
const property = { name: propertyName, reference } as EntityProperty<T>;
meta.properties[propertyName] = Object.assign(meta.properties[propertyName] ?? {}, property, options);

return target;
};
}

Expand Down
2 changes: 0 additions & 2 deletions packages/core/src/decorators/PrimaryKey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ function createDecorator<T>(options: PrimaryKeyOptions<T> | SerializedPrimaryKey
const k = serialized ? 'serializedPrimaryKey' as const : 'primary' as const;
options[k] = true;
meta.properties[propertyName] = Object.assign({ name: propertyName, reference: ReferenceType.SCALAR }, options) as EntityProperty;

return target;
};
}

Expand Down
2 changes: 0 additions & 2 deletions packages/core/src/decorators/Property.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ export function Property<T>(options: PropertyOptions<T> = {}) {
}

meta.properties[prop.name] = prop;

return target;
};
}

Expand Down
2 changes: 0 additions & 2 deletions packages/core/src/decorators/Repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,5 @@ export function Repository<T extends AnyEntity>(entity: EntityClass<T>) {
return function (target: Constructor<EntityRepository<T>>) {
const meta = MetadataStorage.getMetadata(entity.name, (entity as Dictionary).__path);
meta.customRepository = () => target;

return target;
};
}
2 changes: 0 additions & 2 deletions packages/core/src/decorators/Subscriber.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,5 @@ export function Subscriber() {
return function (target: Constructor<EventSubscriber>) {
const subscribers = MetadataStorage.getSubscriberMetadata();
subscribers[target.name] = new target();

return target;
};
}
2 changes: 0 additions & 2 deletions packages/core/src/decorators/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ function hook(type: EventType) {
}

meta.hooks[type]!.push(method);

return target;
};
}

Expand Down

0 comments on commit e021617

Please sign in to comment.