Skip to content

Commit

Permalink
refactor(clone): replace hardcoded project export
Browse files Browse the repository at this point in the history
  • Loading branch information
kgajowy committed Oct 19, 2021
1 parent 96ee57e commit 2082b21
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ export class RequestExport {
) {}

async export(id: ResourceId, kind: ResourceKind): Promise<ExportId> {
const parts: ExportComponent[] = await this.resourcePieces.resolveFor(
const pieces: ExportComponent[] = await this.resourcePieces.resolveFor(
id,
kind,
);
const exportInstance = this.eventPublisher.mergeObjectContext(
Export.project(id, parts),
Export.newOne(id, kind, pieces),
);
await this.exportRepository.save(exportInstance);

Expand Down
13 changes: 6 additions & 7 deletions api/apps/api/src/modules/clone/export/domain/export/export.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,12 @@ export class Export extends AggregateRoot {
super();
}

static project(id: ResourceId, parts: ExportComponent[]): Export {
const exportRequest = new Export(
new ExportId(v4()),
id,
ResourceKind.Project,
parts,
);
static newOne(
id: ResourceId,
kind: ResourceKind,
parts: ExportComponent[],
): Export {
const exportRequest = new Export(new ExportId(v4()), id, kind, parts);

exportRequest.apply(
parts
Expand Down

0 comments on commit 2082b21

Please sign in to comment.