-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(CostSurface): Adds DELETE endpoint for Cost surfaces
- Loading branch information
1 parent
bb6847f
commit 4a9316a
Showing
24 changed files
with
738 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
api/apps/api/src/modules/cost-surface/delete-cost-surface/cost-surface-deleted.saga.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { Injectable } from '@nestjs/common'; | ||
import { ICommand, ofType, Saga } from '@nestjs/cqrs'; | ||
import { Observable } from 'rxjs'; | ||
import { map } from 'rxjs/operators'; | ||
import { ScheduleCleanupForCostSurfaceUnusedResources } from '@marxan-api/modules/cost-surface/delete-cost-surface/schedule-cost-surface-unused-resources-cleanup.command'; | ||
import { CostSurfaceDeleted } from '@marxan-api/modules/cost-surface/events/cost-surface-deleted.event'; | ||
|
||
@Injectable() | ||
export class CostSurfaceDeletedSaga { | ||
@Saga() | ||
costSurfaceDeletedDefault = ( | ||
events$: Observable<any>, | ||
): Observable<ICommand> => | ||
events$.pipe( | ||
ofType(CostSurfaceDeleted), | ||
map( | ||
(event) => | ||
new ScheduleCleanupForCostSurfaceUnusedResources(event.costSurfaceId), | ||
), | ||
); | ||
} |
14 changes: 14 additions & 0 deletions
14
api/apps/api/src/modules/cost-surface/delete-cost-surface/delete-cost-surface.command.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { Command } from '@nestjs-architects/typed-cqrs'; | ||
import { Either } from 'fp-ts/lib/Either'; | ||
|
||
export const deleteCostSurfaceFailed = Symbol('delete-cost-surface-failed'); | ||
|
||
export type DeleteCostSurfaceFailed = typeof deleteCostSurfaceFailed; | ||
|
||
export type DeleteCostSurfaceResponse = Either<DeleteCostSurfaceFailed, true>; | ||
|
||
export class DeleteCostSurfaceCommand extends Command<DeleteCostSurfaceResponse> { | ||
constructor(public readonly costSurfaceId: string) { | ||
super(); | ||
} | ||
} |
Oops, something went wrong.