diff --git a/CHANGELOG.md b/CHANGELOG.md index 74fe7db59..183ead51b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/apps/api/src/app/access/access.controller.ts b/apps/api/src/app/access/access.controller.ts index a778d8b57..dd40a19f4 100644 --- a/apps/api/src/app/access/access.controller.ts +++ b/apps/api/src/app/access/access.controller.ts @@ -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 } } }); } diff --git a/apps/api/src/app/access/create-access.dto.ts b/apps/api/src/app/access/create-access.dto.ts index 672e195c2..055cb6610 100644 --- a/apps/api/src/app/access/create-access.dto.ts +++ b/apps/api/src/app/access/create-access.dto.ts @@ -1 +1,11 @@ -export class CreateAccessDto {} +import { IsOptional, IsString } from 'class-validator'; + +export class CreateAccessDto { + @IsOptional() + @IsString() + alias?: string; + + @IsOptional() + @IsString() + granteeUserId?: string; +} diff --git a/apps/api/src/app/portfolio/portfolio.controller.ts b/apps/api/src/app/portfolio/portfolio.controller.ts index 00919b835..5172b8071 100644 --- a/apps/api/src/app/portfolio/portfolio.controller.ts +++ b/apps/api/src/app/portfolio/portfolio.controller.ts @@ -349,6 +349,7 @@ export class PortfolioController { const portfolioPublicDetails: PortfolioPublicDetails = { hasDetails, + alias: access.alias, holdings: {} }; diff --git a/apps/api/src/app/user/user.service.ts b/apps/api/src/app/user/user.service.ts index 213351ede..57e3ba80d 100644 --- a/apps/api/src/app/user/user.service.ts +++ b/apps/api/src/app/user/user.service.ts @@ -62,7 +62,7 @@ export class UserService { tags, access: access.map((accessItem) => { return { - alias: accessItem.User.alias, + alias: accessItem.alias, id: accessItem.id }; }), diff --git a/apps/client/src/app/components/access-table/access-table.component.html b/apps/client/src/app/components/access-table/access-table.component.html index 93c9356c3..5b54156ce 100644 --- a/apps/client/src/app/components/access-table/access-table.component.html +++ b/apps/client/src/app/components/access-table/access-table.component.html @@ -1,8 +1,15 @@
Alias | ++ {{ element.alias }} + | +Grantee | - {{ element.granteeAlias }} + {{ element.grantee }} |
---|