Skip to content

Commit

Permalink
Merge pull request #208 from boostcampwm-2024/hotfix-1128
Browse files Browse the repository at this point in the history
[BE] DAU 날짜 형식 수정
  • Loading branch information
hyo-limilimee authored Nov 28, 2024
2 parents 674901e + de8f0fb commit bc259d7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ export class GetElapsedTimeRankResponseDto {
example: [
{
projectName: 'test059',
elapsedTime: 100,
value: 100,
},
{
projectName: 'test007',
elapsedTime: 110,
value: 110,
},
{
projectName: 'test079',
elapsedTime: 120,
value: 120,
},
],
})
Expand Down
13 changes: 11 additions & 2 deletions backend/name-server/src/database/query/dau-recorder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ export class DAURecorder implements DAURecorderInterface {
private clickhouseClient = ClickhouseDatabase.getInstance();

public async recordAccess(domain: string): Promise<void> {
const dateString = new Date().toLocaleDateString();
const values = [{ domain: domain.toLowerCase(), date: dateString, access: 1 }];
const values = [
{ domain: domain.toLowerCase(), date: this.formatDate(new Date()), access: 1 },
];
try {
await this.clickhouseClient.insert({
table: 'dau',
Expand All @@ -20,4 +21,12 @@ export class DAURecorder implements DAURecorderInterface {
console.error('ClickHouse Error:', error);
}
}

private formatDate(date: Date): string {
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0');

return `${year}-${month}-${day}`;
}
}

0 comments on commit bc259d7

Please sign in to comment.