Skip to content

Commit

Permalink
docs/#41/dto명, 함수명 변경(buyUserItems)
Browse files Browse the repository at this point in the history
  • Loading branch information
JeonHeena committed Jan 24, 2025
1 parent 55cb545 commit 2883e6b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions src/users/controllers/user-items.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
HttpCode,
} from '@nestjs/common';
import { UserItemsService } from '../services/user-items.service';
import { CreateItemDto } from '../dtos/create-item.dto';
import { BuyUserItemsDto } from '../dtos/buy-userItems.dto';
import { EquipItemDto } from '../dtos/equip-item.dto';
import { ApiTags } from '@nestjs/swagger';
import { PositiveIntPipe } from 'src/common/pipes/positive-int/positive-int.pipe';
Expand All @@ -31,12 +31,12 @@ export class UserItemsController {
//user의 아이템 구매
@Post()
@HttpCode(201)
async buyItem(
async buyUserItems(
@Param('userId', PositiveIntPipe) userId: number,
@Body() createItemDto: CreateItemDto,
@Body() buyUserItemsDto: BuyUserItemsDto,
) {
createItemDto.userId = userId;
return await this.userItemsService.buyItem(createItemDto);
buyUserItemsDto.userId = userId;
return await this.userItemsService.buyUserItems(buyUserItemsDto);
}

@Patch()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { IsArray, IsInt, ArrayMinSize, ArrayMaxSize } from 'class-validator';
export class CreateItemDto {
export class BuyUserItemsDto {
@IsInt()
userId: number;

Expand Down
6 changes: 3 additions & 3 deletions src/users/services/user-items.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
BadRequestException,
} from '@nestjs/common';
import { PrismaService } from 'src/prisma/prisma.service';
import { BuyItemDto } from '../dtos/buy-item.dto';
import { BuyUserItemsDto } from '../dtos/buy-userItems.dto';
import { EquipItemDto } from '../dtos/equip-item.dto';
import { ResponseItemDto } from '../dtos/response-item.dto';

Expand Down Expand Up @@ -50,8 +50,8 @@ export class UserItemsService {
}

//아이템 구매
async buyItem(buyItemDto: BuyItemDto): Promise<void> {
const { userId, itemIds } = buyItemDto;
async buyUserItems(buyUserItemsDto: BuyUserItemsDto): Promise<void> {
const { userId, itemIds } = buyUserItemsDto;

await this.prisma.$transaction(async (prisma) => {
//사용자 존재 여부 확인
Expand Down
Empty file.

0 comments on commit 2883e6b

Please sign in to comment.