generated from Medici-Mansion/basic-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b6e9622
commit 0e5a8ea
Showing
8 changed files
with
168 additions
and
4 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "shinnyang", | ||
"version": "0.2.8", | ||
"version": "0.2.9", | ||
"description": "", | ||
"author": { | ||
"name": "Medici", | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { ApiProperty } from '@nestjs/swagger'; | ||
import { | ||
IsEnum, | ||
IsNumber, | ||
IsOptional, | ||
IsString, | ||
IsUUID, | ||
} from 'class-validator'; | ||
import { LETTER_TYPE } from 'src/letters/entities/letter.entity'; | ||
|
||
export class CreateKakaoShareStatisticRequestDto { | ||
@ApiProperty({ | ||
description: ` | ||
카카오톡 공유 메세지가 전달된 채딩방의 타입 | ||
MemoChat: 나와의 채팅방 | ||
DirectChat: 다른 사용자와의 1:1 채팅방 | ||
MultiChat: 다른 사용자들과의 그룹 채팅방 | ||
OpenDirectChat: 1:1 오픈채팅방 | ||
OpenMultiChat: 그룹 오픈채팅방`, | ||
}) | ||
@IsString() | ||
CHAT_TYPE: string; | ||
@ApiProperty() | ||
@IsString() | ||
HASH_CHAT_ID: string; | ||
@ApiProperty() | ||
@IsNumber() | ||
TEMPLATE_ID: number; | ||
|
||
@ApiProperty() | ||
@IsOptional() | ||
@IsUUID('all') | ||
letterId?: string; | ||
|
||
@ApiProperty({ description: '답장하기 일 경우, 답장하는 메일의 아이디' }) | ||
@IsOptional() | ||
@IsEnum(LETTER_TYPE) | ||
letterType?: LETTER_TYPE; | ||
} |
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,33 @@ | ||
import { BaseEntity } from 'src/common/entities/base.entity'; | ||
import { LETTER_TYPE } from 'src/letters/entities/letter.entity'; | ||
import { Column, Entity } from 'typeorm'; | ||
|
||
@Entity({ name: 'KA_SHARE_ST' }) | ||
export class KakaoShareCallbackStatistic extends BaseEntity { | ||
@Column({ | ||
name: 'chat_type', | ||
comment: `카카오톡 공유 메시지가 전달된 채팅방의 타입`, | ||
}) | ||
chatType: string; | ||
|
||
@Column({ | ||
name: 'hash_chat_id', | ||
comment: '카카오톡 공유 메세지를 수신한 채팅방의 참고용 ID', | ||
}) | ||
hashChatId: string; | ||
|
||
@Column({ name: 'template_id', comment: '메세지 템플릿 ID' }) | ||
templateId: number; | ||
|
||
@Column({ name: 'letter_id', type: 'uuid' }) | ||
letterId: string; | ||
|
||
@Column({ | ||
name: 'letter_type', | ||
comment: '편지 타입', | ||
type: 'enum', | ||
enum: LETTER_TYPE, | ||
nullable: true, | ||
}) | ||
letterType: LETTER_TYPE; | ||
} |
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,15 @@ | ||
import { Controller, Post, Body } from '@nestjs/common'; | ||
import { StatisticsService } from './statistics.service'; | ||
import { CreateKakaoShareStatisticRequestDto } from './dto/create-statistic.dto'; | ||
import { ApiTags } from '@nestjs/swagger'; | ||
|
||
@Controller('statistics') | ||
@ApiTags('Statistics API') | ||
export class StatisticsController { | ||
constructor(private readonly statisticsService: StatisticsService) {} | ||
|
||
@Post('share/kakao') | ||
create(@Body() createStatisticDto: CreateKakaoShareStatisticRequestDto) { | ||
return this.statisticsService.create(createStatisticDto); | ||
} | ||
} |
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,9 @@ | ||
import { Module } from '@nestjs/common'; | ||
import { StatisticsService } from './statistics.service'; | ||
import { StatisticsController } from './statistics.controller'; | ||
|
||
@Module({ | ||
controllers: [StatisticsController], | ||
providers: [StatisticsService], | ||
}) | ||
export class StatisticsModule {} |
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,22 @@ | ||
import { Injectable } from '@nestjs/common'; | ||
import { InjectDataSource } from '@nestjs/typeorm'; | ||
import { DataSource } from 'typeorm'; | ||
import { CreateKakaoShareStatisticRequestDto } from './dto/create-statistic.dto'; | ||
import { KakaoShareCallbackStatistic } from './entities/statistic.entity'; | ||
|
||
@Injectable() | ||
export class StatisticsService { | ||
constructor(@InjectDataSource() private readonly dataSource: DataSource) {} | ||
async create( | ||
createKakaoShareStatisticRequestDto: CreateKakaoShareStatisticRequestDto, | ||
) { | ||
const repository = this.dataSource.getRepository( | ||
KakaoShareCallbackStatistic, | ||
); | ||
|
||
await repository.save( | ||
repository.create(createKakaoShareStatisticRequestDto), | ||
); | ||
return null; | ||
} | ||
} |