removed relation options from tree decorators too

This commit is contained in:
Umed Khudoiberdiev 2017-01-14 14:58:34 +05:00
parent 11817adc2e
commit ff539c4564
4 changed files with 3 additions and 5 deletions

View File

@ -16,7 +16,7 @@ export class Category {
@TreeParent()
parentCategory: Category;
@TreeChildren({ cascadeAll: true })
@TreeChildren({ cascadeInsert: true, cascadeUpdate: true })
childCategories: Category[];
@TreeLevelColumn()

View File

@ -6,7 +6,7 @@ import {RelationMetadataArgs} from "../../metadata-args/RelationMetadataArgs";
/**
* Marks a specific property of the class as a children of the tree.
*/
export function TreeChildren(options?: RelationOptions): Function {
export function TreeChildren(options?: { cascadeInsert?: boolean, cascadeUpdate?: boolean }): Function {
return function (object: Object, propertyName: string) {
if (!options) options = {} as RelationOptions;

View File

@ -6,10 +6,9 @@ import {RelationMetadataArgs} from "../../metadata-args/RelationMetadataArgs";
/**
* Marks a specific property of the class as a parent of the tree.
*/
export function TreeParent(options?: RelationOptions): Function {
export function TreeParent(options?: { cascadeInsert?: boolean, cascadeUpdate?: boolean }): Function {
return function (object: Object, propertyName: string) {
if (!options) options = {} as RelationOptions;
const reflectedType = (Reflect as any).getMetadata("design:type", object, propertyName);
const isLazy = reflectedType && typeof reflectedType.name === "string" && reflectedType.name.toLowerCase() === "promise";

View File

@ -382,7 +382,6 @@ export class SubjectBuilder<Entity extends ObjectLiteral> {
if (alreadyLoadedRelatedDatabaseSubject.mustBeRemoved)
return;
console.log("marked as removed: ", alreadyLoadedRelatedDatabaseSubject);
alreadyLoadedRelatedDatabaseSubject.mustBeRemoved = true;
await this.buildCascadeRemovedAndRelationUpdateOperateSubjects(alreadyLoadedRelatedDatabaseSubject);
}