|
|
@ -17,9 +17,9 @@ import { CreateOrderDto, UpdateOrderDto } from '@ghostfolio/common/dtos'; |
|
|
import { SubscriptionType } from '@ghostfolio/common/enums'; |
|
|
import { SubscriptionType } from '@ghostfolio/common/enums'; |
|
|
import { |
|
|
import { |
|
|
ActivitiesResponse, |
|
|
ActivitiesResponse, |
|
|
ActivityMutationResponse, |
|
|
|
|
|
ActivityResponse, |
|
|
ActivityResponse, |
|
|
CreateActivityResponse |
|
|
CreateActivityResponse, |
|
|
|
|
|
DeleteOrUpdateActivityResponse |
|
|
} from '@ghostfolio/common/interfaces'; |
|
|
} from '@ghostfolio/common/interfaces'; |
|
|
import { permissions } from '@ghostfolio/common/permissions'; |
|
|
import { permissions } from '@ghostfolio/common/permissions'; |
|
|
import { scopes } from '@ghostfolio/common/scopes'; |
|
|
import { scopes } from '@ghostfolio/common/scopes'; |
|
|
@ -105,7 +105,7 @@ export class ActivitiesController { |
|
|
public async deleteActivity( |
|
|
public async deleteActivity( |
|
|
@Impersonation() { userId }: ImpersonationContext, |
|
|
@Impersonation() { userId }: ImpersonationContext, |
|
|
@Param('id') id: string |
|
|
@Param('id') id: string |
|
|
): Promise<ActivityMutationResponse> { |
|
|
): Promise<DeleteOrUpdateActivityResponse> { |
|
|
const activity = await this.activitiesService.order({ |
|
|
const activity = await this.activitiesService.order({ |
|
|
id, |
|
|
id, |
|
|
userId |
|
|
userId |
|
|
@ -122,7 +122,7 @@ export class ActivitiesController { |
|
|
id |
|
|
id |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
return this.getActivityMutationResponse(deletedActivity); |
|
|
return this.getDeleteOrUpdateActivityResponse(deletedActivity); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Get() |
|
|
@Get() |
|
|
@ -331,7 +331,7 @@ export class ActivitiesController { |
|
|
@Body() data: UpdateOrderDto, |
|
|
@Body() data: UpdateOrderDto, |
|
|
@Impersonation() { userId }: ImpersonationContext, |
|
|
@Impersonation() { userId }: ImpersonationContext, |
|
|
@Param('id') id: string |
|
|
@Param('id') id: string |
|
|
): Promise<ActivityMutationResponse> { |
|
|
): Promise<DeleteOrUpdateActivityResponse> { |
|
|
const originalActivity = await this.activitiesService.order({ |
|
|
const originalActivity = await this.activitiesService.order({ |
|
|
id, |
|
|
id, |
|
|
userId |
|
|
userId |
|
|
@ -396,12 +396,12 @@ export class ActivitiesController { |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
return this.getActivityMutationResponse(activity); |
|
|
return this.getDeleteOrUpdateActivityResponse(activity); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private getActivityMutationResponse( |
|
|
private getDeleteOrUpdateActivityResponse( |
|
|
activity: Order |
|
|
activity: Order |
|
|
): ActivityMutationResponse { |
|
|
): DeleteOrUpdateActivityResponse { |
|
|
return pick(activity, [ |
|
|
return pick(activity, [ |
|
|
'accountId', |
|
|
'accountId', |
|
|
'accountUserId', |
|
|
'accountUserId', |
|
|
|