|
|
@ -3,7 +3,14 @@ import { HasPermissionGuard } from '@ghostfolio/api/guards/has-permission.guard' |
|
|
import { permissions } from '@ghostfolio/common/permissions'; |
|
|
import { permissions } from '@ghostfolio/common/permissions'; |
|
|
import type { RequestWithUser } from '@ghostfolio/common/types'; |
|
|
import type { RequestWithUser } from '@ghostfolio/common/types'; |
|
|
|
|
|
|
|
|
import { Controller, Get, Inject, Query, UseGuards } from '@nestjs/common'; |
|
|
import { |
|
|
|
|
|
BadRequestException, |
|
|
|
|
|
Controller, |
|
|
|
|
|
Get, |
|
|
|
|
|
Inject, |
|
|
|
|
|
Query, |
|
|
|
|
|
UseGuards |
|
|
|
|
|
} from '@nestjs/common'; |
|
|
import { REQUEST } from '@nestjs/core'; |
|
|
import { REQUEST } from '@nestjs/core'; |
|
|
import { AuthGuard } from '@nestjs/passport'; |
|
|
import { AuthGuard } from '@nestjs/passport'; |
|
|
|
|
|
|
|
|
@ -92,17 +99,17 @@ export class FamilyOfficeController { |
|
|
@Query('year') year?: string |
|
|
@Query('year') year?: string |
|
|
) { |
|
|
) { |
|
|
if (!period || !year) { |
|
|
if (!period || !year) { |
|
|
return { |
|
|
throw new BadRequestException( |
|
|
error: 'period and year are required query parameters' |
|
|
'period and year are required query parameters' |
|
|
}; |
|
|
); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
const validPeriods = ['MONTHLY', 'QUARTERLY', 'YEARLY']; |
|
|
const validPeriods = ['MONTHLY', 'QUARTERLY', 'YEARLY']; |
|
|
|
|
|
|
|
|
if (!validPeriods.includes(period)) { |
|
|
if (!validPeriods.includes(period)) { |
|
|
return { |
|
|
throw new BadRequestException( |
|
|
error: `period must be one of: ${validPeriods.join(', ')}` |
|
|
`period must be one of: ${validPeriods.join(', ')}` |
|
|
}; |
|
|
); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
const yearNum = parseInt(year, 10); |
|
|
const yearNum = parseInt(year, 10); |
|
|
|