diff --git a/src/db/ModelRelation.ts b/src/db/ModelRelation.ts index baa9a0e..1704ecb 100644 --- a/src/db/ModelRelation.ts +++ b/src/db/ModelRelation.ts @@ -113,6 +113,13 @@ export class OneModelRelation extends ModelRel this.cachedModels = models.filter(m => m[this.dbProperties.foreignKey] === this.getModelID())[0] || null; } + public async set(model: O): Promise { + (this.model as Model)[this.dbProperties.localKey] = model[this.dbProperties.foreignKey]; + } + + public async clear(): Promise { + (this.model as Model)[this.dbProperties.localKey] = undefined; + } } export class ManyModelRelation extends ModelRelation {