mirror of https://github.com/ghostfolio/ghostfolio
Browse Source
* Limit length for comment, search query and symbol * Update changelogpull/7786/head^2
committed by
GitHub
28 changed files with 204 additions and 25 deletions
@ -1,9 +1,11 @@ |
|||||
import { FilterDto } from '@ghostfolio/api/dtos/filter.dto'; |
import { FilterDto } from '@ghostfolio/api/dtos/filter.dto'; |
||||
|
import { SEARCH_QUERY_MAXIMUM_LENGTH } from '@ghostfolio/common/config'; |
||||
|
|
||||
import { IsOptional, IsString } from 'class-validator'; |
import { IsOptional, IsString, MaxLength } from 'class-validator'; |
||||
|
|
||||
export class GetAllAccountsDto extends FilterDto { |
export class GetAllAccountsDto extends FilterDto { |
||||
@IsOptional() |
@IsOptional() |
||||
@IsString() |
@IsString() |
||||
|
@MaxLength(SEARCH_QUERY_MAXIMUM_LENGTH) |
||||
query?: string; |
query?: string; |
||||
} |
} |
||||
|
|||||
@ -0,0 +1,64 @@ |
|||||
|
import { SEARCH_QUERY_MAXIMUM_LENGTH } from '@ghostfolio/common/config'; |
||||
|
import { MarketDataPreset } from '@ghostfolio/common/types'; |
||||
|
|
||||
|
import { Prisma } from '@prisma/client'; |
||||
|
import { Type } from 'class-transformer'; |
||||
|
import { |
||||
|
IsIn, |
||||
|
IsInt, |
||||
|
IsOptional, |
||||
|
IsString, |
||||
|
MaxLength, |
||||
|
Min |
||||
|
} from 'class-validator'; |
||||
|
|
||||
|
export class GetAssetProfilesDto { |
||||
|
@IsOptional() |
||||
|
@IsString() |
||||
|
assetSubClasses?: string; |
||||
|
|
||||
|
@IsOptional() |
||||
|
@IsString() |
||||
|
dataSource?: string; |
||||
|
|
||||
|
@IsIn([ |
||||
|
'BENCHMARKS', |
||||
|
'CURRENCIES', |
||||
|
'ETF_WITHOUT_COUNTRIES', |
||||
|
'ETF_WITHOUT_SECTORS', |
||||
|
'NO_ACTIVITIES' |
||||
|
] as MarketDataPreset[]) |
||||
|
@IsOptional() |
||||
|
presetId?: MarketDataPreset; |
||||
|
|
||||
|
@IsOptional() |
||||
|
@IsString() |
||||
|
@MaxLength(SEARCH_QUERY_MAXIMUM_LENGTH) |
||||
|
query?: string; |
||||
|
|
||||
|
@IsInt() |
||||
|
@IsOptional() |
||||
|
@Min(0) |
||||
|
@Type(() => Number) |
||||
|
skip?: number; |
||||
|
|
||||
|
@IsIn([ |
||||
|
'activitiesCount', |
||||
|
'assetClass', |
||||
|
'assetSubClass', |
||||
|
'dataSource', |
||||
|
'symbol' |
||||
|
]) |
||||
|
@IsOptional() |
||||
|
sortColumn?: string; |
||||
|
|
||||
|
@IsIn(['asc', 'desc'] as Prisma.SortOrder[]) |
||||
|
@IsOptional() |
||||
|
sortDirection?: Prisma.SortOrder; |
||||
|
|
||||
|
@IsInt() |
||||
|
@IsOptional() |
||||
|
@Min(0) |
||||
|
@Type(() => Number) |
||||
|
take?: number; |
||||
|
} |
||||
@ -0,0 +1,16 @@ |
|||||
|
import { SEARCH_QUERY_MAXIMUM_LENGTH } from '@ghostfolio/common/config'; |
||||
|
|
||||
|
import { Transform, TransformFnParams } from 'class-transformer'; |
||||
|
import { IsBoolean, IsString, MaxLength } from 'class-validator'; |
||||
|
|
||||
|
export class GetLookupDto { |
||||
|
@IsBoolean() |
||||
|
@Transform(({ value }: TransformFnParams) => { |
||||
|
return value === 'true'; |
||||
|
}) |
||||
|
includeIndices? = false; |
||||
|
|
||||
|
@IsString() |
||||
|
@MaxLength(SEARCH_QUERY_MAXIMUM_LENGTH) |
||||
|
query? = ''; |
||||
|
} |
||||
@ -0,0 +1,16 @@ |
|||||
|
import { SEARCH_QUERY_MAXIMUM_LENGTH } from '@ghostfolio/common/config'; |
||||
|
|
||||
|
import { Transform, TransformFnParams } from 'class-transformer'; |
||||
|
import { IsBoolean, IsString, MaxLength } from 'class-validator'; |
||||
|
|
||||
|
export class GetLookupDto { |
||||
|
@IsBoolean() |
||||
|
@Transform(({ value }: TransformFnParams) => { |
||||
|
return value === 'true'; |
||||
|
}) |
||||
|
includeIndices? = false; |
||||
|
|
||||
|
@IsString() |
||||
|
@MaxLength(SEARCH_QUERY_MAXIMUM_LENGTH) |
||||
|
query? = ''; |
||||
|
} |
||||
@ -1,10 +1,13 @@ |
|||||
|
import { SYMBOL_MAXIMUM_LENGTH } from '@ghostfolio/common/config'; |
||||
|
|
||||
import { DataSource } from '@prisma/client'; |
import { DataSource } from '@prisma/client'; |
||||
import { IsEnum, IsString } from 'class-validator'; |
import { IsEnum, IsString, MaxLength } from 'class-validator'; |
||||
|
|
||||
export class CreateWatchlistItemDto { |
export class CreateWatchlistItemDto { |
||||
@IsEnum(DataSource) |
@IsEnum(DataSource) |
||||
dataSource: DataSource; |
dataSource: DataSource; |
||||
|
|
||||
@IsString() |
@IsString() |
||||
|
@MaxLength(SYMBOL_MAXIMUM_LENGTH) |
||||
symbol: string; |
symbol: string; |
||||
} |
} |
||||
|
|||||
Loading…
Reference in new issue