Browse Source

Move interfaces and types

* UserWithSettings
* RequestWithUser
pull/100/head
Thomas 4 years ago
parent
commit
a4cd08f99b
  1. 2
      apps/api/src/app/access/access.controller.ts
  2. 4
      apps/api/src/app/account/account.controller.ts
  3. 2
      apps/api/src/app/admin/admin.controller.ts
  4. 4
      apps/api/src/app/cache/cache.controller.ts
  5. 2
      apps/api/src/app/experimental/experimental.controller.ts
  6. 2
      apps/api/src/app/order/order.controller.ts
  7. 2
      apps/api/src/app/portfolio/portfolio.controller.ts
  8. 2
      apps/api/src/app/portfolio/portfolio.service.ts
  9. 2
      apps/api/src/app/symbol/symbol.controller.ts
  10. 2
      apps/api/src/app/user/user.controller.ts
  11. 4
      apps/api/src/app/user/user.service.ts
  12. 2
      apps/api/src/models/portfolio.ts
  13. 4
      libs/helper/src/lib/interfaces/index.ts
  14. 0
      libs/helper/src/lib/interfaces/user-with-settings.ts
  15. 9
      libs/helper/src/lib/types/index.ts
  16. 2
      libs/helper/src/lib/types/request-with-user.type.ts

2
apps/api/src/app/access/access.controller.ts

@ -1,5 +1,5 @@
import { RequestWithUser } from '@ghostfolio/api/app/interfaces/request-with-user.type';
import { Access } from '@ghostfolio/helper/interfaces';
import { RequestWithUser } from '@ghostfolio/helper/types';
import { Controller, Get, Inject, UseGuards } from '@nestjs/common';
import { REQUEST } from '@nestjs/core';
import { AuthGuard } from '@nestjs/passport';

4
apps/api/src/app/account/account.controller.ts

@ -1,4 +1,3 @@
import { RequestWithUser } from '@ghostfolio/api/app/interfaces/request-with-user.type';
import { nullifyValuesInObjects } from '@ghostfolio/api/helper/object.helper';
import { ImpersonationService } from '@ghostfolio/api/services/impersonation.service';
import {
@ -6,6 +5,7 @@ import {
hasPermission,
permissions
} from '@ghostfolio/helper/permissions';
import { RequestWithUser } from '@ghostfolio/helper/types';
import {
Body,
Controller,
@ -21,7 +21,7 @@ import {
} from '@nestjs/common';
import { REQUEST } from '@nestjs/core';
import { AuthGuard } from '@nestjs/passport';
import { Account as AccountModel, Order } from '@prisma/client';
import { Account as AccountModel } from '@prisma/client';
import { StatusCodes, getReasonPhrase } from 'http-status-codes';
import { AccountService } from './account.service';

2
apps/api/src/app/admin/admin.controller.ts

@ -1,4 +1,3 @@
import { RequestWithUser } from '@ghostfolio/api/app/interfaces/request-with-user.type';
import { DataGatheringService } from '@ghostfolio/api/services/data-gathering.service';
import { AdminData } from '@ghostfolio/helper/interfaces';
import {
@ -6,6 +5,7 @@ import {
hasPermission,
permissions
} from '@ghostfolio/helper/permissions';
import { RequestWithUser } from '@ghostfolio/helper/types';
import {
Controller,
Get,

4
apps/api/src/app/cache/cache.controller.ts

@ -1,5 +1,5 @@
import { RequestWithUser } from '@ghostfolio/api/app/interfaces/request-with-user.type';
import { Controller, Inject, Param, Post, UseGuards } from '@nestjs/common';
import { RequestWithUser } from '@ghostfolio/helper/types';
import { Controller, Inject, Post, UseGuards } from '@nestjs/common';
import { REQUEST } from '@nestjs/core';
import { AuthGuard } from '@nestjs/passport';

2
apps/api/src/app/experimental/experimental.controller.ts

@ -1,6 +1,6 @@
import { RequestWithUser } from '@ghostfolio/api/app/interfaces/request-with-user.type';
import { baseCurrency, benchmarks } from '@ghostfolio/helper/config';
import { isApiTokenAuthorized } from '@ghostfolio/helper/permissions';
import { RequestWithUser } from '@ghostfolio/helper/types';
import {
Body,
Controller,

2
apps/api/src/app/order/order.controller.ts

@ -1,4 +1,3 @@
import { RequestWithUser } from '@ghostfolio/api/app/interfaces/request-with-user.type';
import { nullifyValuesInObjects } from '@ghostfolio/api/helper/object.helper';
import { ImpersonationService } from '@ghostfolio/api/services/impersonation.service';
import {
@ -6,6 +5,7 @@ import {
hasPermission,
permissions
} from '@ghostfolio/helper/permissions';
import { RequestWithUser } from '@ghostfolio/helper/types';
import {
Body,
Controller,

2
apps/api/src/app/portfolio/portfolio.controller.ts

@ -18,6 +18,7 @@ import {
hasPermission,
permissions
} from '@ghostfolio/helper/permissions';
import { RequestWithUser } from '@ghostfolio/helper/types';
import {
Controller,
Get,
@ -34,7 +35,6 @@ import { AuthGuard } from '@nestjs/passport';
import { Response } from 'express';
import { StatusCodes, getReasonPhrase } from 'http-status-codes';
import { RequestWithUser } from '../interfaces/request-with-user.type';
import {
HistoricalDataItem,
PortfolioPositionDetail

2
apps/api/src/app/portfolio/portfolio.service.ts

@ -1,4 +1,3 @@
import { RequestWithUser } from '@ghostfolio/api/app/interfaces/request-with-user.type';
import { Portfolio } from '@ghostfolio/api/models/portfolio';
import { DataProviderService } from '@ghostfolio/api/services/data-provider.service';
import { ExchangeRateDataService } from '@ghostfolio/api/services/exchange-rate-data.service';
@ -9,6 +8,7 @@ import {
PortfolioItem,
PortfolioOverview
} from '@ghostfolio/helper/interfaces';
import { RequestWithUser } from '@ghostfolio/helper/types';
import { DateRange } from '@ghostfolio/helper/types';
import { Inject, Injectable } from '@nestjs/common';
import { REQUEST } from '@nestjs/core';

2
apps/api/src/app/symbol/symbol.controller.ts

@ -1,4 +1,4 @@
import { RequestWithUser } from '@ghostfolio/api/app/interfaces/request-with-user.type';
import { RequestWithUser } from '@ghostfolio/helper/types';
import {
Controller,
Get,

2
apps/api/src/app/user/user.controller.ts

@ -1,10 +1,10 @@
import { RequestWithUser } from '@ghostfolio/api/app/interfaces/request-with-user.type';
import { User } from '@ghostfolio/helper/interfaces';
import {
getPermissions,
hasPermission,
permissions
} from '@ghostfolio/helper/permissions';
import { RequestWithUser } from '@ghostfolio/helper/types';
import {
Body,
Controller,

4
apps/api/src/app/user/user.service.ts

@ -2,14 +2,12 @@ import { ConfigurationService } from '@ghostfolio/api/services/configuration.ser
import { PrismaService } from '@ghostfolio/api/services/prisma.service';
import { locale } from '@ghostfolio/helper/config';
import { resetHours } from '@ghostfolio/helper/helper';
import { User as IUser } from '@ghostfolio/helper/interfaces';
import { User as IUser, UserWithSettings } from '@ghostfolio/helper/interfaces';
import { getPermissions, permissions } from '@ghostfolio/helper/permissions';
import { Injectable } from '@nestjs/common';
import { Currency, Prisma, Provider, User } from '@prisma/client';
import { add } from 'date-fns';
import { UserWithSettings } from '../interfaces/user-with-settings';
const crypto = require('crypto');
@Injectable()

2
apps/api/src/models/portfolio.ts

@ -7,6 +7,7 @@ import {
PortfolioReport,
Position
} from '@ghostfolio/helper/interfaces';
import { UserWithSettings } from '@ghostfolio/helper/interfaces';
import { DateRange } from '@ghostfolio/helper/types';
import { OrderWithAccount } from '@ghostfolio/helper/types';
import {
@ -28,7 +29,6 @@ import {
import { cloneDeep, isEmpty } from 'lodash';
import * as roundTo from 'round-to';
import { UserWithSettings } from '../app/interfaces/user-with-settings';
import { DataProviderService } from '../services/data-provider.service';
import { ExchangeRateDataService } from '../services/exchange-rate-data.service';
import { IOrder } from '../services/interfaces/interfaces';

4
libs/helper/src/lib/interfaces/index.ts

@ -9,6 +9,7 @@ import { PortfolioReportRule } from './portfolio-report-rule.interface';
import { PortfolioReport } from './portfolio-report.interface';
import { Position } from './position.interface';
import { UserSettings } from './user-settings.interface';
import { UserWithSettings } from './user-with-settings';
import { User } from './user.interface';
export {
@ -23,5 +24,6 @@ export {
PortfolioReportRule,
Position,
User,
UserSettings
UserSettings,
UserWithSettings
};

0
apps/api/src/app/interfaces/user-with-settings.ts → libs/helper/src/lib/interfaces/user-with-settings.ts

9
libs/helper/src/lib/types/index.ts

@ -2,5 +2,12 @@ import { AccessWithGranteeUser } from './access-with-grantee-user.type';
import { DateRange } from './date-range.type';
import { Granularity } from './granularity.type';
import { OrderWithAccount } from './order-with-account.type';
import { RequestWithUser } from './request-with-user.type';
export { AccessWithGranteeUser, DateRange, Granularity, OrderWithAccount };
export {
AccessWithGranteeUser,
DateRange,
Granularity,
OrderWithAccount,
RequestWithUser
};

2
apps/api/src/app/interfaces/request-with-user.type.ts → libs/helper/src/lib/types/request-with-user.type.ts

@ -1,3 +1,3 @@
import { UserWithSettings } from './user-with-settings';
import { UserWithSettings } from '@ghostfolio/helper/interfaces';
export type RequestWithUser = Request & { user: UserWithSettings };
Loading…
Cancel
Save