-
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.
Merge remote-tracking branch 'origin/develop' into feat/#15
- Loading branch information
Showing
13 changed files
with
323 additions
and
44 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { Get, HttpCode, JsonController, Res } from 'routing-controllers'; | ||
import { OpenAPI } from 'routing-controllers-openapi'; | ||
import { Response } from 'express'; | ||
import statusCode from '../modules/statusCode'; | ||
import util from '../modules/util'; | ||
import message from '../modules/responseMessage'; | ||
import { HomeService } from '../services/homeService'; | ||
import { logger } from '../utils/Logger'; | ||
|
||
@JsonController('/home') | ||
export class HomeController { | ||
constructor(private homeService: HomeService) {} | ||
|
||
@HttpCode(200) | ||
@Get('') | ||
@OpenAPI({ | ||
summary: '홈 데이터 조회', | ||
description: '메인 화면 데이터 반환', | ||
statusCode: '200', | ||
}) | ||
public async getData(@Res() res: Response): Promise<Response> { | ||
try { | ||
const list = await this.homeService.fetchList(); | ||
|
||
return res | ||
.status(statusCode.OK) | ||
.send( | ||
util.success(statusCode.OK, message.FETCH_HOME_DATA_SUCCESS, list) | ||
); | ||
} catch (err) { | ||
logger.error(err); | ||
|
||
return res | ||
.status(statusCode.INTERNAL_SERVER_ERROR) | ||
.send( | ||
util.fail( | ||
statusCode.INTERNAL_SERVER_ERROR, | ||
message.INTERNAL_SERVER_ERROR | ||
) | ||
); | ||
} | ||
} | ||
} |
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,26 @@ | ||
import { ToyDto } from './ToyDto'; | ||
|
||
/** | ||
* Home Response Dto | ||
*/ | ||
export class ResponseHomeDto { | ||
public trending?: ToyDto[] | null; | ||
|
||
public theme?: ThemeDto[] | null; | ||
|
||
public noriPick?: ToyDto[] | null; | ||
|
||
public senses?: ToyDto[] | null; | ||
|
||
public smart?: ToyDto[] | null; | ||
} | ||
|
||
export class ThemeDto { | ||
public id: number; | ||
|
||
public image: string; | ||
|
||
public subtitle: string; | ||
|
||
public title: string; | ||
} |
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,25 @@ | ||
import { IsNotEmpty } from 'class-validator'; | ||
import { Toy } from '../entities/Toy'; | ||
|
||
/** | ||
* 장난감 Dto | ||
*/ | ||
export class ToyDto { | ||
@IsNotEmpty() | ||
public image: string; | ||
|
||
@IsNotEmpty() | ||
public siteName: string; | ||
|
||
@IsNotEmpty() | ||
public title: string; | ||
|
||
@IsNotEmpty() | ||
public price: string; | ||
|
||
@IsNotEmpty() | ||
public month: number; | ||
|
||
@IsNotEmpty() | ||
public siteUrl: string; | ||
} |
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
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
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
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,5 @@ | ||
import { EntityRepository, Repository } from 'typeorm'; | ||
import { Toy } from '../entities/Toy'; | ||
|
||
@EntityRepository(Toy) | ||
export class HomeRepository extends Repository<Toy> {} |
Oops, something went wrong.