Skip to content

Commit

Permalink
Mint document urls before attaching related container models
Browse files Browse the repository at this point in the history
  • Loading branch information
NoelDeMartin committed Jul 7, 2024
1 parent c31b5c2 commit 2714a33
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/models/relations/SolidContainsRelation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,13 @@ export default class SolidContainsRelation<
}

public async create(attributes: Attributes = {}): Promise<Related> {
return tap(this.attach(attributes), model => this.save(model));
const related = this.relatedClass.newInstance(attributes);

if (!related.url && related.static('mintsUrls')) {
related.mintUrl();
}

return tap(this.attach(related), model => this.save(model));
}

public async save(model: Related): Promise<Related> {
Expand Down

0 comments on commit 2714a33

Please sign in to comment.