Compare commits
8 Commits
Author | SHA1 | Date | |
---|---|---|---|
993a491d24 | |||
631efff7ae | |||
a3d1ac2ce4 | |||
4484c21757 | |||
87cd3ef33f | |||
163f4a3d3f | |||
a84256dc03 | |||
cf82066976 |
21
CHANGELOG.md
21
CHANGELOG.md
@ -5,6 +5,27 @@ All notable changes to this project will be documented in this file.
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## 1.0.0 - 05.05.2021
|
||||
|
||||
### Added
|
||||
|
||||
- Added the functionality to clone a transaction
|
||||
- Added a _Google Play_ badge on the landing page
|
||||
|
||||
### Changed
|
||||
|
||||
- Changed to maskable icons
|
||||
|
||||
## 0.99.0 - 03.05.2021
|
||||
|
||||
### Added
|
||||
|
||||
- Added support for deleting users in the admin control panel
|
||||
|
||||
### Changed
|
||||
|
||||
- Eliminated the platform attribute from the transaction model
|
||||
|
||||
## 0.98.0 - 02.05.2021
|
||||
|
||||
### Added
|
||||
|
@ -17,10 +17,6 @@ export class CreateOrderDto {
|
||||
@IsNumber()
|
||||
fee: number;
|
||||
|
||||
@IsString()
|
||||
@ValidateIf((object, value) => value !== null)
|
||||
platformId: string | null;
|
||||
|
||||
@IsNumber()
|
||||
quantity: number;
|
||||
|
||||
|
@ -125,41 +125,19 @@ export class OrderController {
|
||||
const accountId = data.accountId;
|
||||
delete data.accountId;
|
||||
|
||||
if (data.platformId) {
|
||||
const platformId = data.platformId;
|
||||
delete data.platformId;
|
||||
|
||||
return this.orderService.createOrder(
|
||||
{
|
||||
...data,
|
||||
date,
|
||||
Account: {
|
||||
connect: {
|
||||
id_userId: { id: accountId, userId: this.request.user.id }
|
||||
}
|
||||
},
|
||||
Platform: { connect: { id: platformId } },
|
||||
User: { connect: { id: this.request.user.id } }
|
||||
return this.orderService.createOrder(
|
||||
{
|
||||
...data,
|
||||
date,
|
||||
Account: {
|
||||
connect: {
|
||||
id_userId: { id: accountId, userId: this.request.user.id }
|
||||
}
|
||||
},
|
||||
this.request.user.id
|
||||
);
|
||||
} else {
|
||||
delete data.platformId;
|
||||
|
||||
return this.orderService.createOrder(
|
||||
{
|
||||
...data,
|
||||
date,
|
||||
Account: {
|
||||
connect: {
|
||||
id_userId: { id: accountId, userId: this.request.user.id }
|
||||
}
|
||||
},
|
||||
User: { connect: { id: this.request.user.id } }
|
||||
},
|
||||
this.request.user.id
|
||||
);
|
||||
}
|
||||
User: { connect: { id: this.request.user.id } }
|
||||
},
|
||||
this.request.user.id
|
||||
);
|
||||
}
|
||||
|
||||
@Put(':id')
|
||||
@ -196,60 +174,26 @@ export class OrderController {
|
||||
const accountId = data.accountId;
|
||||
delete data.accountId;
|
||||
|
||||
if (data.platformId) {
|
||||
const platformId = data.platformId;
|
||||
delete data.platformId;
|
||||
|
||||
return this.orderService.updateOrder(
|
||||
{
|
||||
data: {
|
||||
...data,
|
||||
date,
|
||||
Account: {
|
||||
connect: {
|
||||
id_userId: { id: accountId, userId: this.request.user.id }
|
||||
}
|
||||
},
|
||||
Platform: { connect: { id: platformId } },
|
||||
User: { connect: { id: this.request.user.id } }
|
||||
},
|
||||
where: {
|
||||
id_userId: {
|
||||
id,
|
||||
userId: this.request.user.id
|
||||
return this.orderService.updateOrder(
|
||||
{
|
||||
data: {
|
||||
...data,
|
||||
date,
|
||||
Account: {
|
||||
connect: {
|
||||
id_userId: { id: accountId, userId: this.request.user.id }
|
||||
}
|
||||
}
|
||||
},
|
||||
this.request.user.id
|
||||
);
|
||||
} else {
|
||||
// platformId is null, remove it
|
||||
delete data.platformId;
|
||||
|
||||
return this.orderService.updateOrder(
|
||||
{
|
||||
data: {
|
||||
...data,
|
||||
date,
|
||||
Account: {
|
||||
connect: {
|
||||
id_userId: { id: accountId, userId: this.request.user.id }
|
||||
}
|
||||
},
|
||||
Platform: originalOrder.platformId
|
||||
? { disconnect: true }
|
||||
: undefined,
|
||||
User: { connect: { id: this.request.user.id } }
|
||||
},
|
||||
where: {
|
||||
id_userId: {
|
||||
id,
|
||||
userId: this.request.user.id
|
||||
}
|
||||
}
|
||||
User: { connect: { id: this.request.user.id } }
|
||||
},
|
||||
this.request.user.id
|
||||
);
|
||||
}
|
||||
where: {
|
||||
id_userId: {
|
||||
id,
|
||||
userId: this.request.user.id
|
||||
}
|
||||
}
|
||||
},
|
||||
this.request.user.id
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -17,10 +17,6 @@ export class UpdateOrderDto {
|
||||
@IsNumber()
|
||||
fee: number;
|
||||
|
||||
@IsString()
|
||||
@ValidateIf((object, value) => value !== null)
|
||||
platformId: string | null;
|
||||
|
||||
@IsString()
|
||||
id: string;
|
||||
|
||||
|
@ -3,6 +3,7 @@ import { getPermissions, hasPermission, permissions } from '@ghostfolio/helper';
|
||||
import {
|
||||
Body,
|
||||
Controller,
|
||||
Delete,
|
||||
Get,
|
||||
HttpException,
|
||||
Inject,
|
||||
@ -15,6 +16,7 @@ import { REQUEST } from '@nestjs/core';
|
||||
import { JwtService } from '@nestjs/jwt';
|
||||
import { AuthGuard } from '@nestjs/passport';
|
||||
import { Provider } from '@prisma/client';
|
||||
import { User as UserModel } from '@prisma/client';
|
||||
import { StatusCodes, getReasonPhrase } from 'http-status-codes';
|
||||
|
||||
import { UserItem } from './interfaces/user-item.interface';
|
||||
@ -30,6 +32,27 @@ export class UserController {
|
||||
private readonly userService: UserService
|
||||
) {}
|
||||
|
||||
@Delete(':id')
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
public async deleteUser(@Param('id') id: string): Promise<UserModel> {
|
||||
if (
|
||||
!hasPermission(
|
||||
getPermissions(this.request.user.role),
|
||||
permissions.deleteUser
|
||||
) ||
|
||||
id === this.request.user.id
|
||||
) {
|
||||
throw new HttpException(
|
||||
getReasonPhrase(StatusCodes.FORBIDDEN),
|
||||
StatusCodes.FORBIDDEN
|
||||
);
|
||||
}
|
||||
|
||||
return this.userService.deleteUser({
|
||||
id
|
||||
});
|
||||
}
|
||||
|
||||
@Get()
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
public async getUser(@Param('id') id: string): Promise<User> {
|
||||
|
@ -163,6 +163,28 @@ export class UserService {
|
||||
}
|
||||
|
||||
public async deleteUser(where: Prisma.UserWhereUniqueInput): Promise<User> {
|
||||
await this.prisma.access.deleteMany({
|
||||
where: { OR: [{ granteeUserId: where.id }, { userId: where.id }] }
|
||||
});
|
||||
|
||||
await this.prisma.account.deleteMany({
|
||||
where: { userId: where.id }
|
||||
});
|
||||
|
||||
await this.prisma.analytics.delete({
|
||||
where: { userId: where.id }
|
||||
});
|
||||
|
||||
await this.prisma.order.deleteMany({
|
||||
where: { userId: where.id }
|
||||
});
|
||||
|
||||
try {
|
||||
await this.prisma.settings.delete({
|
||||
where: { userId: where.id }
|
||||
});
|
||||
} catch {}
|
||||
|
||||
return this.prisma.user.delete({
|
||||
where
|
||||
});
|
||||
|
@ -149,7 +149,6 @@ describe('Portfolio', () => {
|
||||
fee: 0,
|
||||
date: new Date(),
|
||||
id: '8d999347-dee2-46ee-88e1-26b344e71fcc',
|
||||
platformId: null,
|
||||
quantity: 1,
|
||||
symbol: 'BTCUSD',
|
||||
type: Type.BUY,
|
||||
@ -170,19 +169,7 @@ describe('Portfolio', () => {
|
||||
const details = await portfolio.getDetails('1d');
|
||||
expect(details).toMatchObject({
|
||||
BTCUSD: {
|
||||
currency: Currency.USD,
|
||||
exchange: 'Other',
|
||||
grossPerformance: 0,
|
||||
grossPerformancePercent: 0,
|
||||
investment: exchangeRateDataService.toCurrency(
|
||||
1 * 49631.24,
|
||||
Currency.USD,
|
||||
baseCurrency
|
||||
),
|
||||
// marketPrice: 57973.008,
|
||||
marketState: MarketState.open,
|
||||
name: 'Bitcoin USD',
|
||||
platforms: {
|
||||
accounts: {
|
||||
Other: {
|
||||
/*current: exchangeRateDataService.toCurrency(
|
||||
1 * 49631.24,
|
||||
@ -196,11 +183,23 @@ describe('Portfolio', () => {
|
||||
)
|
||||
}
|
||||
},
|
||||
currency: Currency.USD,
|
||||
exchange: 'Other',
|
||||
grossPerformance: 0,
|
||||
grossPerformancePercent: 0,
|
||||
investment: exchangeRateDataService.toCurrency(
|
||||
1 * 49631.24,
|
||||
Currency.USD,
|
||||
baseCurrency
|
||||
),
|
||||
// marketPrice: 57973.008,
|
||||
marketState: MarketState.open,
|
||||
name: 'Bitcoin USD',
|
||||
quantity: 1,
|
||||
// shareCurrent: 0.9999999559148652,
|
||||
shareInvestment: 1,
|
||||
symbol: 'BTCUSD',
|
||||
transactionCount: 0,
|
||||
transactionCount: 1,
|
||||
type: 'Cryptocurrency'
|
||||
}
|
||||
});
|
||||
@ -251,7 +250,6 @@ describe('Portfolio', () => {
|
||||
fee: 0,
|
||||
date: new Date(getUtc('2018-01-05')),
|
||||
id: '4a5a5c6e-659d-45cc-9fd4-fd6c873b50fb',
|
||||
platformId: null,
|
||||
quantity: 0.2,
|
||||
symbol: 'ETHUSD',
|
||||
type: Type.BUY,
|
||||
@ -272,18 +270,7 @@ describe('Portfolio', () => {
|
||||
const details = await portfolio.getDetails('1d');
|
||||
expect(details).toMatchObject({
|
||||
ETHUSD: {
|
||||
currency: Currency.USD,
|
||||
exchange: 'Other',
|
||||
// grossPerformance: 0,
|
||||
// grossPerformancePercent: 0,
|
||||
investment: exchangeRateDataService.toCurrency(
|
||||
0.2 * 991.49,
|
||||
Currency.USD,
|
||||
baseCurrency
|
||||
),
|
||||
// marketPrice: 57973.008,
|
||||
name: 'Ethereum USD',
|
||||
platforms: {
|
||||
accounts: {
|
||||
Other: {
|
||||
/*current: exchangeRateDataService.toCurrency(
|
||||
0.2 * 991.49,
|
||||
@ -297,6 +284,17 @@ describe('Portfolio', () => {
|
||||
)
|
||||
}
|
||||
},
|
||||
currency: Currency.USD,
|
||||
exchange: 'Other',
|
||||
// grossPerformance: 0,
|
||||
// grossPerformancePercent: 0,
|
||||
investment: exchangeRateDataService.toCurrency(
|
||||
0.2 * 991.49,
|
||||
Currency.USD,
|
||||
baseCurrency
|
||||
),
|
||||
// marketPrice: 57973.008,
|
||||
name: 'Ethereum USD',
|
||||
quantity: 0.2,
|
||||
// shareCurrent: 1,
|
||||
shareInvestment: 1,
|
||||
@ -347,7 +345,6 @@ describe('Portfolio', () => {
|
||||
fee: 0,
|
||||
date: new Date(getUtc('2018-01-05')),
|
||||
id: '4a5a5c6e-659d-45cc-9fd4-fd6c873b50fb',
|
||||
platformId: null,
|
||||
quantity: 0.2,
|
||||
symbol: 'ETHUSD',
|
||||
type: Type.BUY,
|
||||
@ -364,7 +361,6 @@ describe('Portfolio', () => {
|
||||
fee: 0,
|
||||
date: new Date(getUtc('2018-01-28')),
|
||||
id: '4a5a5c6e-659d-45cc-9fd4-fd6c873b50fc',
|
||||
platformId: null,
|
||||
quantity: 0.3,
|
||||
symbol: 'ETHUSD',
|
||||
type: Type.BUY,
|
||||
@ -425,7 +421,6 @@ describe('Portfolio', () => {
|
||||
date: new Date(getUtc('2017-08-16')),
|
||||
fee: 2.99,
|
||||
id: 'd96795b2-6ae6-420e-aa21-fabe5e45d475',
|
||||
platformId: null,
|
||||
quantity: 0.05614682,
|
||||
symbol: 'BTCUSD',
|
||||
type: Type.BUY,
|
||||
@ -442,7 +437,6 @@ describe('Portfolio', () => {
|
||||
fee: 2.99,
|
||||
date: new Date(getUtc('2018-01-05')),
|
||||
id: '4a5a5c6e-659d-45cc-9fd4-fd6c873b50fb',
|
||||
platformId: null,
|
||||
quantity: 0.2,
|
||||
symbol: 'ETHUSD',
|
||||
type: Type.BUY,
|
||||
@ -516,7 +510,6 @@ describe('Portfolio', () => {
|
||||
fee: 1.0,
|
||||
date: new Date(getUtc('2018-01-05')),
|
||||
id: '4a5a5c6e-659d-45cc-9fd4-fd6c873b50fb',
|
||||
platformId: null,
|
||||
quantity: 0.2,
|
||||
symbol: 'ETHUSD',
|
||||
type: Type.BUY,
|
||||
@ -533,7 +526,6 @@ describe('Portfolio', () => {
|
||||
fee: 1.0,
|
||||
date: new Date(getUtc('2018-01-28')),
|
||||
id: '4a5a5c6e-659d-45cc-9fd4-fd6c873b50fc',
|
||||
platformId: null,
|
||||
quantity: 0.1,
|
||||
symbol: 'ETHUSD',
|
||||
type: Type.SELL,
|
||||
@ -550,7 +542,6 @@ describe('Portfolio', () => {
|
||||
fee: 1.0,
|
||||
date: new Date(getUtc('2018-01-31')),
|
||||
id: '4a5a5c6e-659d-45cc-9fd4-fd6c873b50fc',
|
||||
platformId: null,
|
||||
quantity: 0.2,
|
||||
symbol: 'ETHUSD',
|
||||
type: Type.BUY,
|
||||
|
@ -177,6 +177,9 @@
|
||||
<button i18n mat-menu-item (click)="onUpdateTransaction(element)">
|
||||
Edit
|
||||
</button>
|
||||
<button i18n mat-menu-item (click)="onCloneTransaction(element)">
|
||||
Clone
|
||||
</button>
|
||||
<button i18n mat-menu-item (click)="onDeleteTransaction(element.id)">
|
||||
Delete
|
||||
</button>
|
||||
|
@ -35,6 +35,7 @@ export class TransactionsTableComponent
|
||||
@Input() transactions: OrderModel[];
|
||||
|
||||
@Output() transactionDeleted = new EventEmitter<string>();
|
||||
@Output() transactionToClone = new EventEmitter<OrderModel>();
|
||||
@Output() transactionToUpdate = new EventEmitter<OrderModel>();
|
||||
|
||||
@ViewChild(MatSort) sort: MatSort;
|
||||
@ -123,6 +124,10 @@ export class TransactionsTableComponent
|
||||
this.transactionToUpdate.emit(aTransaction);
|
||||
}
|
||||
|
||||
public onCloneTransaction(aTransaction: OrderModel) {
|
||||
this.transactionToClone.emit(aTransaction);
|
||||
}
|
||||
|
||||
public openPositionDialog({
|
||||
symbol,
|
||||
title
|
||||
|
@ -1,8 +1,10 @@
|
||||
import { ChangeDetectorRef, Component, OnInit } from '@angular/core';
|
||||
import { AdminData } from '@ghostfolio/api/app/admin/interfaces/admin-data.interface';
|
||||
import { User } from '@ghostfolio/api/app/user/interfaces/user.interface';
|
||||
import { AdminService } from '@ghostfolio/client/services/admin.service';
|
||||
import { CacheService } from '@ghostfolio/client/services/cache.service';
|
||||
import { DataService } from '@ghostfolio/client/services/data.service';
|
||||
import { TokenStorageService } from '@ghostfolio/client/services/token-storage.service';
|
||||
import { DEFAULT_DATE_FORMAT } from '@ghostfolio/helper';
|
||||
import { formatDistanceToNow, isValid, parseISO, sub } from 'date-fns';
|
||||
import { Subject } from 'rxjs';
|
||||
@ -20,6 +22,7 @@ export class AdminPageComponent implements OnInit {
|
||||
public lastDataGathering: string;
|
||||
public transactionCount: number;
|
||||
public userCount: number;
|
||||
public user: User;
|
||||
public users: AdminData['users'];
|
||||
|
||||
private unsubscribeSubject = new Subject<void>();
|
||||
@ -31,46 +34,24 @@ export class AdminPageComponent implements OnInit {
|
||||
private adminService: AdminService,
|
||||
private cacheService: CacheService,
|
||||
private cd: ChangeDetectorRef,
|
||||
private dataService: DataService
|
||||
private dataService: DataService,
|
||||
private tokenStorageService: TokenStorageService
|
||||
) {}
|
||||
|
||||
/**
|
||||
* Initializes the controller
|
||||
*/
|
||||
public ngOnInit() {
|
||||
this.dataService
|
||||
.fetchAdminData()
|
||||
this.fetchAdminData();
|
||||
|
||||
this.tokenStorageService
|
||||
.onChangeHasToken()
|
||||
.pipe(takeUntil(this.unsubscribeSubject))
|
||||
.subscribe(
|
||||
({
|
||||
exchangeRates,
|
||||
lastDataGathering,
|
||||
transactionCount,
|
||||
userCount,
|
||||
users
|
||||
}) => {
|
||||
this.exchangeRates = exchangeRates;
|
||||
this.users = users;
|
||||
|
||||
if (isValid(parseISO(lastDataGathering?.toString()))) {
|
||||
this.lastDataGathering = formatDistanceToNow(
|
||||
new Date(lastDataGathering),
|
||||
{
|
||||
addSuffix: true
|
||||
}
|
||||
);
|
||||
} else if (lastDataGathering === 'IN_PROGRESS') {
|
||||
this.dataGatheringInProgress = true;
|
||||
} else {
|
||||
this.lastDataGathering = '-';
|
||||
}
|
||||
|
||||
this.transactionCount = transactionCount;
|
||||
this.userCount = userCount;
|
||||
|
||||
this.cd.markForCheck();
|
||||
}
|
||||
);
|
||||
.subscribe(() => {
|
||||
this.dataService.fetchUser().subscribe((user) => {
|
||||
this.user = user;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
public onFlushCache() {
|
||||
@ -112,8 +93,56 @@ export class AdminPageComponent implements OnInit {
|
||||
return '';
|
||||
}
|
||||
|
||||
public onDeleteUser(aId: string) {
|
||||
const confirmation = confirm('Do you really want to delete this user?');
|
||||
|
||||
if (confirmation) {
|
||||
this.dataService.deleteUser(aId).subscribe({
|
||||
next: () => {
|
||||
this.fetchAdminData();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public ngOnDestroy() {
|
||||
this.unsubscribeSubject.next();
|
||||
this.unsubscribeSubject.complete();
|
||||
}
|
||||
|
||||
private fetchAdminData() {
|
||||
this.dataService
|
||||
.fetchAdminData()
|
||||
.pipe(takeUntil(this.unsubscribeSubject))
|
||||
.subscribe(
|
||||
({
|
||||
exchangeRates,
|
||||
lastDataGathering,
|
||||
transactionCount,
|
||||
userCount,
|
||||
users
|
||||
}) => {
|
||||
this.exchangeRates = exchangeRates;
|
||||
this.users = users;
|
||||
|
||||
if (isValid(parseISO(lastDataGathering?.toString()))) {
|
||||
this.lastDataGathering = formatDistanceToNow(
|
||||
new Date(lastDataGathering),
|
||||
{
|
||||
addSuffix: true
|
||||
}
|
||||
);
|
||||
} else if (lastDataGathering === 'IN_PROGRESS') {
|
||||
this.dataGatheringInProgress = true;
|
||||
} else {
|
||||
this.lastDataGathering = '-';
|
||||
}
|
||||
|
||||
this.transactionCount = transactionCount;
|
||||
this.userCount = userCount;
|
||||
|
||||
this.cd.markForCheck();
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -82,6 +82,7 @@
|
||||
<th class="mat-header-cell pr-2 py-2" i18n>Transactions</th>
|
||||
<th class="mat-header-cell pr-2 py-2" i18n>Engagement</th>
|
||||
<th class="mat-header-cell pr-3 py-2" i18n>Last Activitiy</th>
|
||||
<th class="mat-header-cell pr-3 py-2"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@ -102,6 +103,26 @@
|
||||
<td class="mat-cell pr-3 py-2">
|
||||
{{ formatDistanceToNow(userItem.Analytics?.updatedAt) }}
|
||||
</td>
|
||||
<td class="mat-cell pr-3 py-2">
|
||||
<button
|
||||
class="mx-1 no-min-width px-2"
|
||||
mat-button
|
||||
[matMenuTriggerFor]="accountMenu"
|
||||
(click)="$event.stopPropagation()"
|
||||
>
|
||||
<ion-icon name="ellipsis-vertical"></ion-icon>
|
||||
</button>
|
||||
<mat-menu #accountMenu="matMenu" xPosition="before">
|
||||
<button
|
||||
i18n
|
||||
mat-menu-item
|
||||
[disabled]="userItem.id === user?.id"
|
||||
(click)="onDeleteUser(userItem.id)"
|
||||
>
|
||||
Delete
|
||||
</button>
|
||||
</mat-menu>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
@ -2,6 +2,7 @@ import { CommonModule } from '@angular/common';
|
||||
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { MatCardModule } from '@angular/material/card';
|
||||
import { MatMenuModule } from '@angular/material/menu';
|
||||
import { CacheService } from '@ghostfolio/client/services/cache.service';
|
||||
|
||||
import { AdminPageRoutingModule } from './admin-page-routing.module';
|
||||
@ -14,7 +15,8 @@ import { AdminPageComponent } from './admin-page.component';
|
||||
AdminPageRoutingModule,
|
||||
CommonModule,
|
||||
MatButtonModule,
|
||||
MatCardModule
|
||||
MatCardModule,
|
||||
MatMenuModule
|
||||
],
|
||||
providers: [CacheService],
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA]
|
||||
|
@ -156,4 +156,13 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="downloads my-5 row justify-content-center">
|
||||
<a
|
||||
href="https://play.google.com/store/apps/details?id=ch.dotsilver.ghostfolio.twa"
|
||||
title="Get Ghostfolio on Google Play"
|
||||
>
|
||||
<img alt="Google Play Badge" src="assets/badge-en-google-play.png" />
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -18,6 +18,12 @@
|
||||
background-color: var(--light-background);
|
||||
}
|
||||
}
|
||||
|
||||
.downloads {
|
||||
img {
|
||||
height: 2.5rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
:host-context(.is-dark-theme) {
|
||||
|
@ -109,6 +109,10 @@ export class TransactionsPageComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
public onCloneTransaction(aTransaction: OrderModel) {
|
||||
this.openCreateTransactionDialog(aTransaction);
|
||||
}
|
||||
|
||||
public onDeleteTransaction(aId: string) {
|
||||
this.dataService.deleteOrder(aId).subscribe({
|
||||
next: () => {
|
||||
@ -130,7 +134,6 @@ export class TransactionsPageComponent implements OnInit {
|
||||
date,
|
||||
fee,
|
||||
id,
|
||||
platformId,
|
||||
quantity,
|
||||
symbol,
|
||||
type,
|
||||
@ -146,7 +149,6 @@ export class TransactionsPageComponent implements OnInit {
|
||||
date,
|
||||
fee,
|
||||
id,
|
||||
platformId,
|
||||
quantity,
|
||||
symbol,
|
||||
type,
|
||||
@ -177,21 +179,21 @@ export class TransactionsPageComponent implements OnInit {
|
||||
this.unsubscribeSubject.complete();
|
||||
}
|
||||
|
||||
private openCreateTransactionDialog(): void {
|
||||
private openCreateTransactionDialog(aTransaction?: OrderModel): void {
|
||||
const dialogRef = this.dialog.open(CreateOrUpdateTransactionDialog, {
|
||||
data: {
|
||||
accounts: this.user?.accounts,
|
||||
transaction: {
|
||||
accountId: this.user?.accounts.find((account) => {
|
||||
accountId: aTransaction?.accountId ?? this.user?.accounts.find((account) => {
|
||||
return account.isDefault;
|
||||
})?.id,
|
||||
currency: null,
|
||||
currency: aTransaction?.currency ?? null,
|
||||
dataSource: aTransaction?.dataSource ?? null,
|
||||
date: new Date(),
|
||||
fee: 0,
|
||||
platformId: null,
|
||||
quantity: null,
|
||||
symbol: null,
|
||||
type: 'BUY',
|
||||
symbol: aTransaction?.symbol ?? null,
|
||||
type: aTransaction?.type ?? 'BUY',
|
||||
unitPrice: null
|
||||
}
|
||||
},
|
||||
|
@ -9,6 +9,7 @@
|
||||
[showActions]="!hasImpersonationId && hasPermissionToDeleteOrder"
|
||||
[transactions]="transactions"
|
||||
(transactionDeleted)="onDeleteTransaction($event)"
|
||||
(transactionToClone)="onCloneTransaction($event)"
|
||||
(transactionToUpdate)="onUpdateTransaction($event)"
|
||||
></gf-transactions-table>
|
||||
</div>
|
||||
|
@ -48,6 +48,10 @@ export class DataService {
|
||||
return this.http.delete<any>(`/api/order/${aId}`);
|
||||
}
|
||||
|
||||
public deleteUser(aId: string) {
|
||||
return this.http.delete<any>(`/api/user/${aId}`);
|
||||
}
|
||||
|
||||
public fetchAccesses() {
|
||||
return this.http.get<Access[]>('/api/access');
|
||||
}
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 3.9 KiB |
Binary file not shown.
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 14 KiB |
BIN
apps/client/src/assets/badge-en-google-play.png
Normal file
BIN
apps/client/src/assets/badge-en-google-play.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 13 KiB |
@ -12,6 +12,7 @@ export const permissions = {
|
||||
createUserAccount: 'createUserAccount',
|
||||
deleteAccount: 'deleteAcccount',
|
||||
deleteOrder: 'deleteOrder',
|
||||
deleteUser: 'deleteUser',
|
||||
enableSocialLogin: 'enableSocialLogin',
|
||||
enableSubscription: 'enableSubscription',
|
||||
readForeignPortfolio: 'readForeignPortfolio',
|
||||
@ -36,6 +37,7 @@ export function getPermissions(aRole: Role): string[] {
|
||||
permissions.createOrder,
|
||||
permissions.deleteAccount,
|
||||
permissions.deleteOrder,
|
||||
permissions.deleteUser,
|
||||
permissions.readForeignPortfolio,
|
||||
permissions.updateAccount,
|
||||
permissions.updateOrder,
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "ghostfolio",
|
||||
"version": "0.98.0",
|
||||
"version": "1.0.0",
|
||||
"homepage": "https://ghostfol.io",
|
||||
"license": "AGPL-3.0",
|
||||
"scripts": {
|
||||
|
@ -68,8 +68,6 @@ model Order {
|
||||
date DateTime
|
||||
fee Float
|
||||
id String @default(uuid())
|
||||
Platform Platform? @relation(fields: [platformId], references: [id])
|
||||
platformId String?
|
||||
quantity Float
|
||||
symbol String
|
||||
type Type
|
||||
@ -85,7 +83,6 @@ model Platform {
|
||||
Account Account[]
|
||||
id String @id @default(uuid())
|
||||
name String?
|
||||
Order Order[]
|
||||
url String @unique
|
||||
}
|
||||
|
||||
|
@ -144,7 +144,6 @@ async function main() {
|
||||
date: new Date(Date.UTC(2017, 0, 3, 0, 0, 0)),
|
||||
fee: 30,
|
||||
id: 'cf7c0418-8535-4089-ae3d-5dbfa0aec2e1',
|
||||
platformId: platformDegiro.id,
|
||||
quantity: 50,
|
||||
symbol: 'TSLA',
|
||||
type: Type.BUY,
|
||||
@ -158,7 +157,6 @@ async function main() {
|
||||
date: new Date(Date.UTC(2017, 7, 16, 0, 0, 0)),
|
||||
fee: 29.9,
|
||||
id: 'a1c5d73a-8631-44e5-ac44-356827a5212c',
|
||||
platformId: platformCoinbase.id,
|
||||
quantity: 0.5614682,
|
||||
symbol: 'BTCUSD',
|
||||
type: Type.BUY,
|
||||
@ -172,7 +170,6 @@ async function main() {
|
||||
date: new Date(Date.UTC(2018, 9, 1, 0, 0, 0)),
|
||||
fee: 80.79,
|
||||
id: '71c08e2a-4a86-44ae-a890-c337de5d5f9b',
|
||||
platformId: platformInteractiveBrokers.id,
|
||||
quantity: 5,
|
||||
symbol: 'AMZN',
|
||||
type: Type.BUY,
|
||||
@ -186,7 +183,6 @@ async function main() {
|
||||
date: new Date(Date.UTC(2019, 2, 1, 0, 0, 0)),
|
||||
fee: 19.9,
|
||||
id: '385f2c2c-d53e-4937-b0e5-e92ef6020d4e',
|
||||
platformId: platformInteractiveBrokers.id,
|
||||
quantity: 10,
|
||||
symbol: 'VTI',
|
||||
type: Type.BUY,
|
||||
@ -200,7 +196,6 @@ async function main() {
|
||||
date: new Date(Date.UTC(2019, 8, 3, 0, 0, 0)),
|
||||
fee: 19.9,
|
||||
id: '185f2c2c-d53e-4937-b0e5-a93ef6020d4e',
|
||||
platformId: platformInteractiveBrokers.id,
|
||||
quantity: 10,
|
||||
symbol: 'VTI',
|
||||
type: Type.BUY,
|
||||
@ -214,7 +209,6 @@ async function main() {
|
||||
date: new Date(Date.UTC(2020, 2, 2, 0, 0, 0)),
|
||||
fee: 19.9,
|
||||
id: '347b0430-a84f-4031-a0f9-390399066ad6',
|
||||
platformId: platformInteractiveBrokers.id,
|
||||
quantity: 10,
|
||||
symbol: 'VTI',
|
||||
type: Type.BUY,
|
||||
@ -228,7 +222,6 @@ async function main() {
|
||||
date: new Date(Date.UTC(2020, 8, 1, 0, 0, 0)),
|
||||
fee: 19.9,
|
||||
id: '67ec3f47-3189-4b63-ba05-60d3a06b302f',
|
||||
platformId: platformInteractiveBrokers.id,
|
||||
quantity: 10,
|
||||
symbol: 'VTI',
|
||||
type: Type.BUY,
|
||||
@ -242,7 +235,6 @@ async function main() {
|
||||
date: new Date(Date.UTC(2020, 2, 1, 0, 0, 0)),
|
||||
fee: 19.9,
|
||||
id: 'd01c6fbc-fa8d-47e6-8e80-66f882d2bfd2',
|
||||
platformId: platformInteractiveBrokers.id,
|
||||
quantity: 10,
|
||||
symbol: 'VTI',
|
||||
type: Type.BUY,
|
||||
|
Reference in New Issue
Block a user