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.SymbolProfile.connect.dataSource_symbol.dataSource === 'MANUAL' &&
data.type === 'BUY') data.type === 'BUY')
) { ) {
delete data.SymbolProfile.connect;
if (data.account?.connect?.id_userId?.id === null) { if (data.account?.connect?.id_userId?.id === null) {
data.account = { disconnect: true }; data.account = { disconnect: true };
} }
delete data.SymbolProfile.connect;
delete data.SymbolProfile.update.name;
} else { } else {
delete data.SymbolProfile.update; delete data.SymbolProfile.update;
@ -685,11 +686,12 @@ export class OrderService {
// Remove existing tags // Remove existing tags
await this.prismaService.order.update({ await this.prismaService.order.update({
data: { tags: { set: [] } }, where,
where data: { tags: { set: [] } }
}); });
const order = await this.prismaService.order.update({ const order = await this.prismaService.order.update({
where,
data: { data: {
...data, ...data,
isDraft, isDraft,
@ -698,8 +700,7 @@ export class OrderService {
return { id }; return { id };
}) })
} }
}, }
where
}); });
this.eventEmitter.emit( 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') .get('type')
.valueChanges.pipe(takeUntil(this.unsubscribeSubject)) .valueChanges.pipe(takeUntil(this.unsubscribeSubject))
.subscribe((type: Type) => { .subscribe((type: Type) => {
if (type === 'ITEM') { if (
type === 'ITEM' ||
(this.activityForm.get('dataSource').value === 'MANUAL' &&
type === 'BUY')
) {
this.activityForm this.activityForm
.get('accountId') .get('accountId')
.removeValidators(Validators.required); .removeValidators(Validators.required);

Loading…
Cancel
Save