Skip to content
This repository was archived by the owner on Jun 23, 2025. It is now read-only.

Commit c071fcd

Browse files
committed
refactor: Add distributionPercent field to Product model and DTO
1 parent f750262 commit c071fcd

File tree

4 files changed

+15
-1
lines changed

4 files changed

+15
-1
lines changed

prisma/schema.prisma

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ model Product {
101101
currentAmount Int
102102
targetAmount Int
103103
collectedAmount Int @default(0)
104+
distributionPercent Float
104105
fundingEndDate DateTime
105106
tokenAddress String?
106107
productQnA ProductQnA[]

src/modules/product/dto/create.product.dto.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Prisma } from '@prisma/client';
2-
import { IsArray, IsDateString, IsNotEmpty, IsNumber, IsString } from 'class-validator';
2+
import { IsArray, IsDateString, IsNotEmpty, IsNumber, IsString, Matches } from 'class-validator';
33

44
import { ApiProperty } from '@nestjs/swagger';
55

@@ -28,6 +28,15 @@ export class CreateProductDTO implements Partial<Prisma.ProductCreateInput> {
2828
})
2929
targetAmount: number;
3030

31+
@IsNumber()
32+
@IsNotEmpty()
33+
@Matches('/^(0(.d)?|1(.0)?)$/')
34+
@ApiProperty({
35+
example: '0.5',
36+
description: '배분율',
37+
})
38+
distributionPercent: number;
39+
3140
@IsDateString()
3241
@IsNotEmpty()
3342
@ApiProperty({

src/modules/product/dto/product.dto.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ export class ProductDTO implements Product {
3030
@ApiProperty({ description: '현재 모인금액' })
3131
collectedAmount: number;
3232

33+
@ApiProperty({ description: '배분율' })
34+
distributionPercent: number;
35+
3336
@ApiProperty({ description: '펀딩 종료일' })
3437
fundingEndDate: Date;
3538

src/modules/product/product.service.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ export class ProductService {
3636
detailImage: '상세 이미지 URL',
3737
currentAmount: dto.currentAmount,
3838
targetAmount: dto.targetAmount,
39+
distributionPercent: dto.distributionPercent,
3940
fundingEndDate: DateTime.fromISO(dto.fundingEndDate).toJSDate(),
4041
user: {
4142
connect: {

0 commit comments

Comments
 (0)