Browse Source

Deprecate ITEM activity type in favor of BUY

pull/5093/head
Thomas Kaul 2 months ago
parent
commit
f1485f2449
  1. 13
      apps/api/src/app/order/order.service.ts
  2. 6
      apps/client/src/app/pages/portfolio/activities/create-or-update-activity-dialog/create-or-update-activity-dialog.component.ts

13
apps/api/src/app/order/order.service.ts

@ -652,11 +652,12 @@ export class OrderService {
(data.SymbolProfile.connect.dataSource_symbol.dataSource === 'MANUAL' &&
data.type === 'BUY')
) {
delete data.SymbolProfile.connect;
if (data.account?.connect?.id_userId?.id === null) {
data.account = { disconnect: true };
}
delete data.SymbolProfile.connect;
delete data.SymbolProfile.update.name;
} else {
delete data.SymbolProfile.update;
@ -685,11 +686,12 @@ export class OrderService {
// Remove existing tags
await this.prismaService.order.update({
data: { tags: { set: [] } },
where
where,
data: { tags: { set: [] } }
});
const order = await this.prismaService.order.update({
where,
data: {
...data,
isDraft,
@ -698,8 +700,7 @@ export class OrderService {
return { id };
})
}
},
where
}
});
this.eventEmitter.emit(

6
apps/client/src/app/pages/portfolio/activities/create-or-update-activity-dialog/create-or-update-activity-dialog.component.ts

@ -290,7 +290,11 @@ export class CreateOrUpdateActivityDialog implements OnDestroy {
.get('type')
.valueChanges.pipe(takeUntil(this.unsubscribeSubject))
.subscribe((type: Type) => {
if (type === 'ITEM') {
if (
type === 'ITEM' ||
(this.activityForm.get('dataSource').value === 'MANUAL' &&
type === 'BUY')
) {
this.activityForm
.get('accountId')
.removeValidators(Validators.required);

Loading…
Cancel
Save