-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #119 from boostcampwm-2024/dev-back
[BE] merge to main
- Loading branch information
Showing
36 changed files
with
2,178 additions
and
357 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
backend/console-server/src/clickhouse/util/map-filter-condition.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
type FilterValue = string | number | Date | unknown; | ||
|
||
export function mapFilterCondition( | ||
key: string, | ||
value: FilterValue, | ||
): { condition: string; param: FilterValue } { | ||
let type: string; | ||
|
||
if (typeof value === 'string') { | ||
type = 'String'; | ||
} else if (typeof value === 'number') { | ||
type = Number.isInteger(value) ? 'Int32' : 'Float64'; | ||
} else if (value instanceof Date) { | ||
type = 'DateTime64(3)'; | ||
} else { | ||
throw new Error(`Unsupported filter value type for key "${key}": ${typeof value}`); | ||
} | ||
return { condition: `${key} = {${key}:${type}}`, param: value }; | ||
} |
12 changes: 6 additions & 6 deletions
12
backend/console-server/src/clickhouse/util/metric-expressions.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
backend/console-server/src/log/dto/get-dau-by-project-response.dto.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { Exclude, Expose, Type } from 'class-transformer'; | ||
import { ApiProperty } from '@nestjs/swagger'; | ||
|
||
@Exclude() | ||
export class GetDAUByProjectResponseDto { | ||
@ApiProperty({ | ||
example: 'my-project', | ||
description: '프로젝트 이름', | ||
}) | ||
@Expose() | ||
projectName: string; | ||
|
||
@ApiProperty({ | ||
example: '2023-10-01', | ||
description: '조회한 날짜', | ||
}) | ||
@Expose() | ||
date: string; | ||
|
||
@ApiProperty({ | ||
example: 12345, | ||
description: '해당 날짜의 DAU 값', | ||
}) | ||
@Expose() | ||
@Type(() => Number) | ||
dau: number; | ||
} |
20 changes: 20 additions & 0 deletions
20
backend/console-server/src/log/dto/get-dau-by-project.dto.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { IsNotEmpty, IsString, IsDateString } from 'class-validator'; | ||
import { ApiProperty } from '@nestjs/swagger'; | ||
|
||
export class GetDAUByProjectDto { | ||
@ApiProperty({ | ||
example: 'watchducks', | ||
description: '프로젝트 이름', | ||
}) | ||
@IsNotEmpty() | ||
@IsString() | ||
projectName: string; | ||
|
||
@ApiProperty({ | ||
example: '2023-10-01', | ||
description: '조회할 날짜 (YYYY-MM-DD 형식)', | ||
}) | ||
@IsNotEmpty() | ||
@IsDateString() | ||
date: string; | ||
} |
44 changes: 44 additions & 0 deletions
44
backend/console-server/src/log/dto/get-path-speed-rank-response.dto.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { Exclude, Expose, Type } from 'class-transformer'; | ||
import { ApiProperty } from '@nestjs/swagger'; | ||
|
||
class PathResponseDto { | ||
@ApiProperty({ | ||
example: '/api/v1/resource', | ||
description: '사용자의 요청 경로', | ||
}) | ||
@Expose() | ||
path: string; | ||
|
||
@ApiProperty({ | ||
example: 123.45, | ||
description: '해당 경로의 평균 응답 소요 시간 (ms).', | ||
}) | ||
@Expose() | ||
avg_elapsed_time: number; | ||
} | ||
|
||
@Exclude() | ||
export class GetPathSpeedRankResponseDto { | ||
@ApiProperty({ | ||
example: 'watchducks', | ||
description: '프로젝트 이름', | ||
}) | ||
@Expose() | ||
projectName: string; | ||
|
||
@ApiProperty({ | ||
type: [PathResponseDto], | ||
description: '프로젝트의 가장 빠른 응답 경로 배열', | ||
}) | ||
@Expose() | ||
@Type(() => PathResponseDto) | ||
fastestPaths: Array<PathResponseDto>; | ||
|
||
@ApiProperty({ | ||
type: [PathResponseDto], | ||
description: '프로젝트의 가장 느린 응답 경로 배열', | ||
}) | ||
@Expose() | ||
@Type(() => PathResponseDto) | ||
slowestPaths: Array<PathResponseDto>; | ||
} |
7 changes: 7 additions & 0 deletions
7
backend/console-server/src/log/dto/get-path-speed-rank.dto.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { IsNotEmpty, IsString } from 'class-validator'; | ||
|
||
export class GetPathSpeedRankDto { | ||
@IsNotEmpty() | ||
@IsString() | ||
projectName: string; | ||
} |
18 changes: 18 additions & 0 deletions
18
backend/console-server/src/log/dto/get-success-rate-by-project-response.dto.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { Expose, Type } from 'class-transformer'; | ||
import { ApiProperty } from '@nestjs/swagger'; | ||
|
||
export class GetSuccessRateByProjectResponseDTO { | ||
@ApiProperty({ | ||
description: '프로젝트의 이름', | ||
example: 'watchducks', | ||
}) | ||
@Expose() | ||
projectName: string; | ||
@ApiProperty({ | ||
description: '프로젝트의 응답 성공률', | ||
example: 85.5, | ||
}) | ||
@Expose() | ||
@Type(() => Number) | ||
success_rate: number; | ||
} |
12 changes: 12 additions & 0 deletions
12
backend/console-server/src/log/dto/get-success-rate-by-project.dto.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { IsString } from 'class-validator'; | ||
import { ApiProperty } from '@nestjs/swagger'; | ||
|
||
export class GetSuccessRateByProjectDto { | ||
@IsString() | ||
@ApiProperty({ | ||
description: '프로젝트 이름', | ||
example: 'watchducks', | ||
required: true, | ||
}) | ||
projectName: string; | ||
} |
12 changes: 12 additions & 0 deletions
12
backend/console-server/src/log/dto/get-success-rate-response.dto.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { ApiProperty } from '@nestjs/swagger'; | ||
import { Expose } from 'class-transformer'; | ||
|
||
export class GetSuccessRateResponseDto { | ||
@ApiProperty({ | ||
example: 95.5, | ||
description: '응답 성공률 (%)', | ||
type: Number, | ||
}) | ||
@Expose() | ||
success_rate: number; | ||
} |
14 changes: 14 additions & 0 deletions
14
backend/console-server/src/log/dto/get-success-rate.dto.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { ApiProperty } from '@nestjs/swagger'; | ||
import { Type } from 'class-transformer'; | ||
import { IsNumber } from 'class-validator'; | ||
|
||
export class GetSuccessRateDto { | ||
@IsNumber() | ||
@Type(() => Number) | ||
@ApiProperty({ | ||
description: '기수', | ||
example: 5, | ||
required: true, | ||
}) | ||
generation: number; | ||
} |
12 changes: 12 additions & 0 deletions
12
backend/console-server/src/log/dto/get-traffic-by-generation-response.dto.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { ApiProperty } from '@nestjs/swagger'; | ||
import { Expose } from 'class-transformer'; | ||
|
||
export class GetTrafficByGenerationResponseDto { | ||
@ApiProperty({ | ||
example: 15, | ||
description: '기수 별 트래픽 수', | ||
type: Number, | ||
}) | ||
@Expose() | ||
count: number; | ||
} |
14 changes: 14 additions & 0 deletions
14
backend/console-server/src/log/dto/get-traffic-by-generation.dto.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { IsNumber } from 'class-validator'; | ||
import { Type } from 'class-transformer'; | ||
import { ApiProperty } from '@nestjs/swagger'; | ||
|
||
export class GetTrafficByGenerationDto { | ||
@IsNumber() | ||
@Type(() => Number) | ||
@ApiProperty({ | ||
description: '기수', | ||
example: 5, | ||
required: true, | ||
}) | ||
generation: number; | ||
} |
43 changes: 43 additions & 0 deletions
43
backend/console-server/src/log/dto/get-traffic-by-project-response.dto.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { Expose, Type } from 'class-transformer'; | ||
import { ApiProperty } from '@nestjs/swagger'; | ||
|
||
class TrafficDataPoint { | ||
@ApiProperty({ | ||
example: '2024-11-07 23:07:28', | ||
description: '시간 단위 별 타임스탬프', | ||
}) | ||
@Expose() | ||
timestamp: string; | ||
|
||
@ApiProperty({ | ||
example: 1500, | ||
description: '해당 타임스탬프의 트래픽 총량', | ||
}) | ||
@Expose() | ||
@Type(() => Number) | ||
count: number; | ||
} | ||
|
||
export class GetTrafficByProjectResponseDto { | ||
@ApiProperty({ | ||
example: 'watchducks', | ||
description: '프로젝트 이름', | ||
}) | ||
@Expose() | ||
projectName: string; | ||
|
||
@ApiProperty({ | ||
example: 'hour', | ||
description: '시간 단위', | ||
}) | ||
@Expose() | ||
timeUnit: string; | ||
|
||
@ApiProperty({ | ||
type: [TrafficDataPoint], | ||
description: '시간 단위 별 트래픽 데이터', | ||
}) | ||
@Expose() | ||
@Type(() => TrafficDataPoint) | ||
trafficData: TrafficDataPoint[]; | ||
} |
30 changes: 30 additions & 0 deletions
30
backend/console-server/src/log/dto/get-traffic-by-project.dto.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { IsNotEmpty, IsString, IsIn } from 'class-validator'; | ||
import { ApiProperty } from '@nestjs/swagger'; | ||
import { Transform } from 'class-transformer'; | ||
|
||
export class GetTrafficByProjectDto { | ||
@ApiProperty({ | ||
example: 'watchducks', | ||
description: '프로젝트 이름', | ||
}) | ||
@IsNotEmpty() | ||
@IsString() | ||
projectName: string; | ||
|
||
@ApiProperty({ | ||
example: 'hour', | ||
description: '시간 단위 (Minute, Hour, Day, Week, Month)', | ||
enum: ['Minute', 'Hour', 'Day', 'Week', 'Month'], | ||
}) | ||
@IsNotEmpty() | ||
@IsString() | ||
@Transform(({ value }) => { | ||
if (typeof value === 'string') { | ||
const lower = value.toLowerCase(); | ||
return lower.charAt(0).toUpperCase() + lower.slice(1); | ||
} | ||
return value; | ||
}) | ||
@IsIn(['Minute', 'Hour', 'Day', 'Week', 'Month']) | ||
timeUnit: string; | ||
} |
Oops, something went wrong.