Feature/add alias to access (#1193)

* Add alias to access

* Update changelog
pull/1198/head
Thomas Kaul 2 years ago committed by GitHub
parent 2db46e5bbf
commit 0e29278e96
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- Added the alias to the `Access` database schema
- Added support for translated time distances
### Changed

@ -42,14 +42,16 @@ export class AccessController {
return accessesWithGranteeUser.map((access) => {
if (access.GranteeUser) {
return {
granteeAlias: access.GranteeUser?.alias,
alias: access.alias,
grantee: access.GranteeUser?.id,
id: access.id,
type: 'RESTRICTED_VIEW'
};
}
return {
granteeAlias: 'Public',
alias: access.alias,
grantee: 'Public',
id: access.id,
type: 'PUBLIC'
};
@ -71,6 +73,10 @@ export class AccessController {
}
return this.accessService.createAccess({
alias: data.alias || undefined,
GranteeUser: data.granteeUserId
? { connect: { id: data.granteeUserId } }
: undefined,
User: { connect: { id: this.request.user.id } }
});
}

@ -1 +1,11 @@
export class CreateAccessDto {}
import { IsOptional, IsString } from 'class-validator';
export class CreateAccessDto {
@IsOptional()
@IsString()
alias?: string;
@IsOptional()
@IsString()
granteeUserId?: string;
}

@ -349,6 +349,7 @@ export class PortfolioController {
const portfolioPublicDetails: PortfolioPublicDetails = {
hasDetails,
alias: access.alias,
holdings: {}
};

@ -62,7 +62,7 @@ export class UserService {
tags,
access: access.map((accessItem) => {
return {
alias: accessItem.User.alias,
alias: accessItem.alias,
id: accessItem.id
};
}),

@ -1,8 +1,15 @@
<table class="gf-table w-100" mat-table [dataSource]="dataSource">
<ng-container matColumnDef="granteeAlias">
<ng-container matColumnDef="alias">
<th *matHeaderCellDef class="px-1" i18n mat-header-cell>Alias</th>
<td *matCellDef="let element" class="px-1" mat-cell>
{{ element.alias }}
</td>
</ng-container>
<ng-container matColumnDef="grantee">
<th *matHeaderCellDef class="px-1" i18n mat-header-cell>Grantee</th>
<td *matCellDef="let element" class="px-1" mat-cell>
{{ element.granteeAlias }}
{{ element.grantee }}
</td>
</ng-container>

@ -33,7 +33,7 @@ export class AccessTableComponent implements OnChanges, OnInit {
public ngOnInit() {}
public ngOnChanges() {
this.displayedColumns = ['granteeAlias', 'type', 'details'];
this.displayedColumns = ['alias', 'grantee', 'type', 'details'];
if (this.showActions) {
this.displayedColumns.push('actions');

@ -316,6 +316,7 @@ export class AccountPageComponent implements OnDestroy, OnInit {
const dialogRef = this.dialog.open(CreateOrUpdateAccessDialog, {
data: {
access: {
alias: '',
type: 'PUBLIC'
}
},
@ -331,7 +332,7 @@ export class AccountPageComponent implements OnDestroy, OnInit {
if (access) {
this.dataService
.postAccess({})
.postAccess({ alias: access.alias })
.pipe(takeUntil(this.unsubscribeSubject))
.subscribe({
next: () => {

@ -1,6 +1,17 @@
<form #addAccessForm="ngForm" class="d-flex flex-column h-100">
<h1 i18n mat-dialog-title>Grant access</h1>
<div class="flex-grow-1" mat-dialog-content>
<div>
<mat-form-field appearance="outline" class="w-100">
<mat-label i18n>Alias</mat-label>
<input
matInput
name="alias"
type="text"
[(ngModel)]="data.access.alias"
/>
</mat-form-field>
</div>
<div>
<mat-form-field appearance="outline" class="w-100">
<mat-label i18n>Type</mat-label>

@ -4,6 +4,7 @@ import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { MatButtonModule } from '@angular/material/button';
import { MatDialogModule } from '@angular/material/dialog';
import { MatFormFieldModule } from '@angular/material/form-field';
import { MatInputModule } from '@angular/material/input';
import { MatSelectModule } from '@angular/material/select';
import { CreateOrUpdateAccessDialog } from './create-or-update-access-dialog.component';
@ -16,6 +17,7 @@ import { CreateOrUpdateAccessDialog } from './create-or-update-access-dialog.com
MatButtonModule,
MatDialogModule,
MatFormFieldModule,
MatInputModule,
MatSelectModule,
ReactiveFormsModule
]

@ -2,7 +2,8 @@
<div class="row">
<div class="col">
<h3 class="h4 mb-3 text-center" i18n>
Hello, someone has shared a <strong>Portfolio</strong> with you!
Hello, {{ portfolioPublicDetails?.alias ?? 'someone' }} has shared a
<strong>Portfolio</strong> with you!
</h3>
</div>
</div>

@ -26,7 +26,7 @@
<target state="translated">Empfänger</target>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/components/access-table/access-table.component.html</context>
<context context-type="linenumber">3</context>
<context context-type="linenumber">10</context>
</context-group>
</trans-unit>
<trans-unit id="f61c6867295f3b53d23557021f2f4e0aa1d0b8fc" datatype="html">
@ -34,7 +34,7 @@
<target state="translated">Typ</target>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/components/access-table/access-table.component.html</context>
<context context-type="linenumber">10</context>
<context context-type="linenumber">17</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/components/admin-jobs/admin-jobs.html</context>
@ -42,7 +42,7 @@
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/account/create-or-update-access-dialog/create-or-update-access-dialog.html</context>
<context context-type="linenumber">6</context>
<context context-type="linenumber">17</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/accounts/create-or-update-account-dialog/create-or-update-account-dialog.html</context>
@ -62,7 +62,7 @@
<target state="translated">Details</target>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/components/access-table/access-table.component.html</context>
<context context-type="linenumber">20</context>
<context context-type="linenumber">27</context>
</context-group>
</trans-unit>
<trans-unit id="53ea2772322e7d4d21515bb0c6dead283f8e18a5" datatype="html">
@ -70,7 +70,7 @@
<target state="translated">Widerrufen</target>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/components/access-table/access-table.component.html</context>
<context context-type="linenumber">47</context>
<context context-type="linenumber">54</context>
</context-group>
</trans-unit>
<trans-unit id="8264698726451826067" datatype="html">
@ -366,7 +366,7 @@
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/account/create-or-update-access-dialog/create-or-update-access-dialog.html</context>
<context context-type="linenumber">14</context>
<context context-type="linenumber">25</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/accounts/create-or-update-account-dialog/create-or-update-account-dialog.html</context>
@ -390,7 +390,7 @@
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/account/create-or-update-access-dialog/create-or-update-access-dialog.html</context>
<context context-type="linenumber">21</context>
<context context-type="linenumber">32</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/accounts/create-or-update-account-dialog/create-or-update-account-dialog.html</context>
@ -798,7 +798,7 @@
<target state="translated">Registrieren</target>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/public/public-page.html</context>
<context context-type="linenumber">136</context>
<context context-type="linenumber">137</context>
</context-group>
</trans-unit>
<trans-unit id="5207635742003539443" datatype="html">
@ -1070,7 +1070,7 @@
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/public/public-page.html</context>
<context context-type="linenumber">44</context>
<context context-type="linenumber">45</context>
</context-group>
</trans-unit>
<trans-unit id="aee7d0de4e30405c1289745e4264e622b613632a" datatype="html">
@ -1438,7 +1438,7 @@
<target state="translated">Öffentlich</target>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/account/create-or-update-access-dialog/create-or-update-access-dialog.html</context>
<context context-type="linenumber">8</context>
<context context-type="linenumber">19</context>
</context-group>
</trans-unit>
<trans-unit id="5016419499983434110" datatype="html">
@ -1678,7 +1678,7 @@
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/public/public-page.html</context>
<context context-type="linenumber">75</context>
<context context-type="linenumber">76</context>
</context-group>
</trans-unit>
<trans-unit id="2948175671993825247" datatype="html">
@ -1782,7 +1782,7 @@
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/public/public-page.html</context>
<context context-type="linenumber">13</context>
<context context-type="linenumber">14</context>
</context-group>
</trans-unit>
<trans-unit id="888f6842631dc20550ad7e9a9c45ef55bf45852b" datatype="html">
@ -2041,20 +2041,12 @@
<context context-type="linenumber">12</context>
</context-group>
</trans-unit>
<trans-unit id="7081e73933b030c02e11519f76884ef7cb5d99fc" datatype="html">
<source> Hello, someone has shared a <x id="START_TAG_STRONG" ctype="x-strong" equiv-text="&lt;strong&gt;"/>Portfolio<x id="CLOSE_TAG_STRONG" ctype="x-strong" equiv-text="&lt;/strong&gt;"/> with you! </source>
<target state="new"/>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/public/public-page.html</context>
<context context-type="linenumber">4,6</context>
</context-group>
</trans-unit>
<trans-unit id="4056a76e7a710ab32285892a58d66f2d1a927796" datatype="html">
<source>Currencies</source>
<target state="translated">Währungen</target>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/public/public-page.html</context>
<context context-type="linenumber">29</context>
<context context-type="linenumber">30</context>
</context-group>
</trans-unit>
<trans-unit id="3c3163d370916438f3b52ea17720bfb2a68a1709" datatype="html">
@ -2062,7 +2054,7 @@
<target state="translated">Kontinente</target>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/public/public-page.html</context>
<context context-type="linenumber">59</context>
<context context-type="linenumber">60</context>
</context-group>
</trans-unit>
<trans-unit id="a3d148b40a389fda0665eb583c9e434ec5ee1ced" datatype="html">
@ -2070,7 +2062,7 @@
<target state="new"/>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/public/public-page.html</context>
<context context-type="linenumber">131,133</context>
<context context-type="linenumber">132,134</context>
</context-group>
</trans-unit>
<trans-unit id="8298333184054476827" datatype="html">
@ -2422,7 +2414,7 @@
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/public/public-page.html</context>
<context context-type="linenumber">89</context>
<context context-type="linenumber">90</context>
</context-group>
</trans-unit>
<trans-unit id="81eb53c18dfd116d6e54877444847b3091d92ab0" datatype="html">
@ -2434,7 +2426,7 @@
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/public/public-page.html</context>
<context context-type="linenumber">98</context>
<context context-type="linenumber">99</context>
</context-group>
</trans-unit>
<trans-unit id="7233cd3a1ef8913fa5c6db7a29c88044646ceacc" datatype="html">
@ -2446,7 +2438,7 @@
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/public/public-page.html</context>
<context context-type="linenumber">107</context>
<context context-type="linenumber">108</context>
</context-group>
</trans-unit>
<trans-unit id="add4cd82e3e38a3110fe67b3c7df56e9602644ee" datatype="html">
@ -2629,6 +2621,26 @@
<context context-type="linenumber">291</context>
</context-group>
</trans-unit>
<trans-unit id="fbaaeb297e70b9a800acf841b9d26c19d60651ef" datatype="html">
<source>Alias</source>
<target state="translated">Alias</target>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/components/access-table/access-table.component.html</context>
<context context-type="linenumber">3</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/account/create-or-update-access-dialog/create-or-update-access-dialog.html</context>
<context context-type="linenumber">6</context>
</context-group>
</trans-unit>
<trans-unit id="3d14940af7de691ac27efb67bef3e974cbe3281c" datatype="html">
<source> Hello, <x id="INTERPOLATION" equiv-text="{{ portfolioPublicDetails?.alias ?? &apos;someone&apos; }}"/> has shared a <x id="START_TAG_STRONG" ctype="x-strong" equiv-text="&lt;strong&gt;"/>Portfolio<x id="CLOSE_TAG_STRONG" ctype="x-strong" equiv-text="&lt;/strong&gt;"/> with you! </source>
<target state="translated"> Hallo, <x id="INTERPOLATION" equiv-text="{{ portfolioPublicDetails?.alias ?? &apos;jemand&apos; }}"/> hat ein <x id="START_TAG_STRONG" ctype="x-strong" equiv-text="&lt;strong&gt;"/>Portfolio<x id="CLOSE_TAG_STRONG" ctype="x-strong" equiv-text="&lt;/strong&gt;"/> mit dir geteilt! </target>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/public/public-page.html</context>
<context context-type="linenumber">4,7</context>
</context-group>
</trans-unit>
</body>
</file>
</xliff>

@ -24,14 +24,14 @@
<source>Grantee</source>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/components/access-table/access-table.component.html</context>
<context context-type="linenumber">3</context>
<context context-type="linenumber">10</context>
</context-group>
</trans-unit>
<trans-unit id="f61c6867295f3b53d23557021f2f4e0aa1d0b8fc" datatype="html">
<source>Type</source>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/components/access-table/access-table.component.html</context>
<context context-type="linenumber">10</context>
<context context-type="linenumber">17</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/components/admin-jobs/admin-jobs.html</context>
@ -39,7 +39,7 @@
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/account/create-or-update-access-dialog/create-or-update-access-dialog.html</context>
<context context-type="linenumber">6</context>
<context context-type="linenumber">17</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/accounts/create-or-update-account-dialog/create-or-update-account-dialog.html</context>
@ -58,14 +58,14 @@
<source>Details</source>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/components/access-table/access-table.component.html</context>
<context context-type="linenumber">20</context>
<context context-type="linenumber">27</context>
</context-group>
</trans-unit>
<trans-unit id="53ea2772322e7d4d21515bb0c6dead283f8e18a5" datatype="html">
<source>Revoke</source>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/components/access-table/access-table.component.html</context>
<context context-type="linenumber">47</context>
<context context-type="linenumber">54</context>
</context-group>
</trans-unit>
<trans-unit id="8264698726451826067" datatype="html">
@ -337,7 +337,7 @@
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/account/create-or-update-access-dialog/create-or-update-access-dialog.html</context>
<context context-type="linenumber">14</context>
<context context-type="linenumber">25</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/accounts/create-or-update-account-dialog/create-or-update-account-dialog.html</context>
@ -360,7 +360,7 @@
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/account/create-or-update-access-dialog/create-or-update-access-dialog.html</context>
<context context-type="linenumber">21</context>
<context context-type="linenumber">32</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/accounts/create-or-update-account-dialog/create-or-update-account-dialog.html</context>
@ -726,7 +726,7 @@
<source>Get Started</source>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/public/public-page.html</context>
<context context-type="linenumber">136</context>
<context context-type="linenumber">137</context>
</context-group>
</trans-unit>
<trans-unit id="5207635742003539443" datatype="html">
@ -968,7 +968,7 @@
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/public/public-page.html</context>
<context context-type="linenumber">44</context>
<context context-type="linenumber">45</context>
</context-group>
</trans-unit>
<trans-unit id="aee7d0de4e30405c1289745e4264e622b613632a" datatype="html">
@ -1292,7 +1292,7 @@
<source>Public</source>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/account/create-or-update-access-dialog/create-or-update-access-dialog.html</context>
<context context-type="linenumber">8</context>
<context context-type="linenumber">19</context>
</context-group>
</trans-unit>
<trans-unit id="5016419499983434110" datatype="html">
@ -1506,7 +1506,7 @@
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/public/public-page.html</context>
<context context-type="linenumber">75</context>
<context context-type="linenumber">76</context>
</context-group>
</trans-unit>
<trans-unit id="2948175671993825247" datatype="html">
@ -1599,7 +1599,7 @@
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/public/public-page.html</context>
<context context-type="linenumber">13</context>
<context context-type="linenumber">14</context>
</context-group>
</trans-unit>
<trans-unit id="888f6842631dc20550ad7e9a9c45ef55bf45852b" datatype="html">
@ -1829,32 +1829,25 @@
<context context-type="linenumber">12</context>
</context-group>
</trans-unit>
<trans-unit id="7081e73933b030c02e11519f76884ef7cb5d99fc" datatype="html">
<source> Hello, someone has shared a <x id="START_TAG_STRONG" ctype="x-strong" equiv-text="&lt;strong&gt;"/>Portfolio<x id="CLOSE_TAG_STRONG" ctype="x-strong" equiv-text="&lt;/strong&gt;"/> with you! </source>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/public/public-page.html</context>
<context context-type="linenumber">4,6</context>
</context-group>
</trans-unit>
<trans-unit id="4056a76e7a710ab32285892a58d66f2d1a927796" datatype="html">
<source>Currencies</source>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/public/public-page.html</context>
<context context-type="linenumber">29</context>
<context context-type="linenumber">30</context>
</context-group>
</trans-unit>
<trans-unit id="3c3163d370916438f3b52ea17720bfb2a68a1709" datatype="html">
<source>Continents</source>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/public/public-page.html</context>
<context context-type="linenumber">59</context>
<context context-type="linenumber">60</context>
</context-group>
</trans-unit>
<trans-unit id="a3d148b40a389fda0665eb583c9e434ec5ee1ced" datatype="html">
<source> Ghostfolio empowers you to keep track of your wealth. </source>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/public/public-page.html</context>
<context context-type="linenumber">131,133</context>
<context context-type="linenumber">132,134</context>
</context-group>
</trans-unit>
<trans-unit id="8298333184054476827" datatype="html">
@ -2107,7 +2100,7 @@
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/public/public-page.html</context>
<context context-type="linenumber">89</context>
<context context-type="linenumber">90</context>
</context-group>
</trans-unit>
<trans-unit id="27fe3d097c64eaec7ff564358f80fb7ba795f484" datatype="html">
@ -2147,7 +2140,7 @@
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/public/public-page.html</context>
<context context-type="linenumber">107</context>
<context context-type="linenumber">108</context>
</context-group>
</trans-unit>
<trans-unit id="81eb53c18dfd116d6e54877444847b3091d92ab0" datatype="html">
@ -2158,7 +2151,7 @@
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/public/public-page.html</context>
<context context-type="linenumber">98</context>
<context context-type="linenumber">99</context>
</context-group>
</trans-unit>
<trans-unit id="936788a5ab949fe0d70098ba051ac7a44999ff08" datatype="html">
@ -2348,6 +2341,24 @@
<context context-type="linenumber">291</context>
</context-group>
</trans-unit>
<trans-unit id="3d14940af7de691ac27efb67bef3e974cbe3281c" datatype="html">
<source> Hello, <x id="INTERPOLATION" equiv-text="{{ portfolioPublicDetails?.alias ?? &apos;someone&apos; }}"/> has shared a <x id="START_TAG_STRONG" ctype="x-strong" equiv-text="&lt;strong&gt;"/>Portfolio<x id="CLOSE_TAG_STRONG" ctype="x-strong" equiv-text="&lt;/strong&gt;"/> with you! </source>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/public/public-page.html</context>
<context context-type="linenumber">4,7</context>
</context-group>
</trans-unit>
<trans-unit id="fbaaeb297e70b9a800acf841b9d26c19d60651ef" datatype="html">
<source>Alias</source>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/components/access-table/access-table.component.html</context>
<context context-type="linenumber">3</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/account/create-or-update-access-dialog/create-or-update-access-dialog.html</context>
<context context-type="linenumber">6</context>
</context-group>
</trans-unit>
</body>
</file>
</xliff>

@ -1,5 +1,6 @@
export interface Access {
granteeAlias: string;
alias?: string;
grantee: string;
id: string;
type: 'PUBLIC' | 'RESTRICTED_VIEW';
}

@ -1,6 +1,7 @@
import { PortfolioPosition } from '@ghostfolio/common/interfaces';
export interface PortfolioPublicDetails {
alias?: string;
hasDetails: boolean;
holdings: {
[symbol: string]: Pick<

@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE "Access" ADD COLUMN "alias" TEXT;

@ -10,6 +10,7 @@ datasource db {
}
model Access {
alias String?
createdAt DateTime @default(now())
granteeUserId String?
id String @id @default(uuid())

Loading…
Cancel
Save