Skip to content

Commit

Permalink
๐Ÿฉน ํ”„๋ก ํŠธ ์š”๊ตฌ์‚ฌํ•ญ ๋ณ€๊ฒฝ์— ๋”ฐ๋ฅธ ๋ณ€๊ฒฝ (#85)
Browse files Browse the repository at this point in the history
* โœจ [ํƒ€์ž„๋ผ์ธ] ๋นˆ ๋ฌธ์ž์—ด์˜ ๊ฒฝ์šฐ DB์— null๋กœ ๋“ค์–ด๊ฐ€๋„๋ก ์ฒ˜๋ฆฌ

* ๐Ÿ“ Swagger ๋ฌธ์„œ ์—…๋ฐ์ดํŠธ

* โœ๏ธ ํ”„๋กฌํ”„ํŠธ ์ผ๋ถ€ ๋ณ€๊ฒฝ
  • Loading branch information
MinseoKangQ authored Nov 12, 2024
1 parent d3bf70d commit 3b74280
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import lombok.AccessLevel;
import lombok.Getter;
import lombok.NoArgsConstructor;
import org.example.gather_back_end.promotion.dto.timeline.PromotionTimelineReq;
import org.example.gather_back_end.util.entity.BaseEntity;

// ํ™๋ณด ์š”์ฒญ ๋‚ด์—ญ
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ public enum WorkType {

PRINTS("PRINTS"), // ์ธ์‡„๋ฌผ (ํฌ์Šคํ„ฐ, ๋ฐฐ๋„ˆ ๋“ฑ)
VIDEO("VIDEO"), // ์˜์ƒ (์ˆํผ, ๋ฏธ๋“œํผ, ๋กฑํผ ๋“ฑ)
SNS_POST("SNS_POST"), // SNS ๊ฒŒ์‹œ๋ฌผ (์นด๋“œ๋‰ด์Šค, ํ”ผ๋“œ ๋“ฑ)
ETC("ETC"); // ๊ธฐํƒ€
SNS_POST("SNS_POST"); // SNS ๊ฒŒ์‹œ๋ฌผ (์นด๋“œ๋‰ด์Šค, ํ”ผ๋“œ ๋“ฑ)

private String value;
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ public record PromotionCostReq(
@Schema(description = "1์ˆœ์œ„ ํ™๋ณด ์ˆ˜๋‹จ (ํ•„์ˆ˜)", example = "PRINTS")
String firstMeans,

@Schema(description = "2์ˆœ์œ„ ํ™๋ณด ์ˆ˜๋‹จ (null ๊ฐ€๋Šฅ)", example = "VIDEO")
@Schema(description = "2์ˆœ์œ„ ํ™๋ณด ์ˆ˜๋‹จ (๋นˆ ๋ฌธ์ž์—ด ๊ฐ€๋Šฅ)", example = "VIDEO")
String secondMeans,

@Schema(description = "3์ˆœ์œ„ ํ™๋ณด ์ˆ˜๋‹จ (null ๊ฐ€๋Šฅ)", example = "SNS_POST")
@Schema(description = "3์ˆœ์œ„ ํ™๋ณด ์ˆ˜๋‹จ (๋นˆ ๋ฌธ์ž์—ด ๊ฐ€๋Šฅ)", example = "SNS_POST")
String thirdMeans,

@Schema(description = "์ธ์Šคํƒ€๊ทธ๋žจ ํ™๋ณด ๊ธฐ๊ฐ„", example = "20")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ public record PromotionTimelineReq(
WorkType firstMeans,

@Nullable
@Schema(description = "2์ˆœ์œ„ ํ™๋ณด ์ˆ˜๋‹จ (null ๊ฐ€๋Šฅ)", example = "SNS_POST")
WorkType secondMeans,
@Schema(description = "2์ˆœ์œ„ ํ™๋ณด ์ˆ˜๋‹จ (๋นˆ ๋ฌธ์ž์—ด ๊ฐ€๋Šฅ)", example = "SNS_POST")
String secondMeans,

@Nullable
@Schema(description = "3์ˆœ์œ„ ํ™๋ณด ์ˆ˜๋‹จ (null ๊ฐ€๋Šฅ)", example = "VIDEO")
WorkType thirdMeans
@Schema(description = "3์ˆœ์œ„ ํ™๋ณด ์ˆ˜๋‹จ (๋นˆ ๋ฌธ์ž์—ด ๊ฐ€๋Šฅ)", example = "VIDEO")
String thirdMeans
) {

public PromotionRequest toPromotionRequest(PromotionTimelineReq req, User user) {
Expand All @@ -41,9 +41,14 @@ public PromotionRequest toPromotionRequest(PromotionTimelineReq req, User user)
req.targetNumberOfPeople,
req.budget,
req.firstMeans,
req.secondMeans,
req.thirdMeans
parseWorkType(req.secondMeans),
parseWorkType(req.thirdMeans)
);
}

// ๋นˆ ๋ฌธ์ž์—ด("")์— ๋Œ€ํ•œ ์ฒ˜๋ฆฌ
private WorkType parseWorkType(String means) {
return (means == null || means.isEmpty()) ? null : WorkType.valueOf(means);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ public class CostPrompt {
SNS_POST // SNS ๊ฒŒ์‹œ๋ฌผ (์นด๋“œ๋‰ด์Šค, ํ”ผ๋“œ ๋“ฑ)
ํ™๋ณด ์ˆ˜๋‹จ์€ ๋ฌด์กฐ๊ฑด 1๊ฐœ ์ด์ƒ ์ž‘์„ฑ๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค.
ํ™๋ณด ์ˆ˜๋‹จ์— ๋Œ€ํ•œ ์ฃผ์˜์‚ฌํ•ญ์€ ๋‹ค์Œ๊ณผ ๊ฐ™์Šต๋‹ˆ๋‹ค.
๊ฐ’์ด ์—†๋Š” ๊ฒฝ์šฐ์—๋Š” null์ด ์•„๋‹ˆ๋ผ ๋นˆ ๋ฌธ์ž์—ด("")๋กœ ์˜ค๊ฒŒ ๋˜์–ด์žˆ์Šต๋‹ˆ๋‹ค.
secondMeans, thirdMeans์— ๋นˆ ๋ฌธ์ž์—ด("")์ด ์˜ค๋ฉด ํ•ด๋‹น ํ™๋ณด ์ˆ˜๋‹จ์€ ์ œ์™ธํ•˜๊ณ  ์‘๋‹ตํ•ด ์ฃผ์„ธ์š”. ์ฆ‰, null์ด๋ผ๊ณ  ์ƒ๊ฐํ•˜๋ฉด ํŽธํ•ฉ๋‹ˆ๋‹ค.
๊ทธ๋Ÿผ ์•„๋ž˜์™€ ๊ฐ™์€ json ๋ฐ์ดํ„ฐ ํƒ€์ž…์œผ๋กœ ์‘๋‹ต์„ ํ•ด์ค˜์•ผ ํ•ฉ๋‹ˆ๋‹ค.
Expand Down Expand Up @@ -86,7 +89,7 @@ public class CostPrompt {
"budget": 167000,
"firstMeans": "VIDEO",
"secondMeans": "SNS_POST",
"thirdMeans": null,
"thirdMeans": "",
"instagramPromotionPeriod" : 7
}
""";
Expand All @@ -111,7 +114,7 @@ public class CostPrompt {
"budget": 157000,
"firstMeans": "PRINTS",
"secondMeans": "SNS_POST",
"thirdMeans": null,
"thirdMeans": "",
"instagramPromotionPeriod" : 10
}
""";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ public class TimelinePrompt {
SNS_POST // SNS ๊ฒŒ์‹œ๋ฌผ (์นด๋“œ๋‰ด์Šค, ํ”ผ๋“œ ๋“ฑ)
ํ™๋ณด ์ˆ˜๋‹จ์€ ๋ฌด์กฐ๊ฑด 1๊ฐœ ์ด์ƒ ์ž‘์„ฑ๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค.
ํ™๋ณด ์ˆ˜๋‹จ์— ๋Œ€ํ•œ ์ฃผ์˜์‚ฌํ•ญ์€ ๋‹ค์Œ๊ณผ ๊ฐ™์Šต๋‹ˆ๋‹ค.
๊ฐ’์ด ์—†๋Š” ๊ฒฝ์šฐ์—๋Š” null์ด ์•„๋‹ˆ๋ผ ๋นˆ ๋ฌธ์ž์—ด("")๋กœ ์˜ค๊ฒŒ ๋˜์–ด์žˆ์Šต๋‹ˆ๋‹ค.
secondMeans, thirdMeans์— ๋นˆ ๋ฌธ์ž์—ด("")์ด ์˜ค๋ฉด ํ•ด๋‹น ํ™๋ณด ์ˆ˜๋‹จ์€ ์ œ์™ธํ•˜๊ณ  ์‘๋‹ตํ•ด ์ฃผ์„ธ์š”. ์ฆ‰, null์ด๋ผ๊ณ  ์ƒ๊ฐํ•˜๋ฉด ํŽธํ•ฉ๋‹ˆ๋‹ค.
๊ทธ๋Ÿผ ์•„๋ž˜์™€ ๊ฐ™์€ json ๋ฐ์ดํ„ฐ ํƒ€์ž…์œผ๋กœ ์‘๋‹ต์„ ํ•ด์ค˜์•ผ ํ•ฉ๋‹ˆ๋‹ค.
Expand Down Expand Up @@ -133,7 +136,7 @@ public class TimelinePrompt {
"budget": 167000,
"firstMeans": "VIDEO",
"secondMeans": "SNS_POST",
"thirdMeans": null
"thirdMeans": ""
}
""";
public static final String ASSISTANT2 = """
Expand Down Expand Up @@ -221,8 +224,8 @@ public class TimelinePrompt {
"targetNumberOfPeople": 432,
"budget": 157000,
"firstMeans": "PRINTS",
"secondMeans": "SNS_POST",
"thirdMEans": null
"secondMeans": "",
"thirdMeans": ""
}
""";
public static final String ASSISTANT3 = """
Expand Down Expand Up @@ -286,30 +289,6 @@ public class TimelinePrompt {
"tip":"20๋Œ€๋ฅผ ํƒ€๊ฒŸ์œผ๋กœ ์ธ์Šคํƒ€๊ทธ๋žจ ์œ ํ–‰์„ ํ™œ์šฉํ•ด ํšจ์œจ์ ์œผ๋กœ ํ™๋ณดํ•˜์„ธ์š”!"
}
]
},
{
"period":48,
"category":"SNS_POST",
"tasks":[
{
"name":"๋‚ด์šฉ ์ •๋ฆฌ ๋ฐ ์ปจํƒ",
"start":0,
"end":2,
"tip":"๋‹จ์ฒด์˜ ํ‚ค์›Œ๋“œ์™€ ์•„์ด๋ดํ‹ฐํ‹ฐ๋ฅผ ๋ช…ํ™•ํžˆ ์ •๋ฆฌํ•ด, ๋””์ž์ด๋„ˆ์™€ ์ตœ๊ณ ์˜ ๊ฒฐ๊ณผ๋ฌผ์„ ๋งŒ๋“ค์–ด๋ณด์„ธ์š”!"
},
{
"name":"์ œ์ž‘",
"start":2,
"end":9,
"tip":"๋‹ด๋‹น์ž๋ฅผ ์ง€์ •ํ•ด ํฌ๋ฆฌ์—์ดํ„ฐ์™€ ๋น ๋ฅด๊ณ  ์˜ˆ์˜ ์žˆ๊ฒŒ ์†Œํ†ตํ•˜์„ธ์š”!"
},
{
"name":"๊ฒŒ์‹œ_์ธ์Šคํƒ€๊ทธ๋žจ",
"start":9,
"end":39,
"tip":"์ผ 5000์› ํˆฌ์ž๋กœ ์งง์€ ๊ธฐ๊ฐ„์— ์ตœ๋Œ€ ํšจ๊ณผ๋กœ ๋” ๋งŽ์€ ์‚ฌ๋žŒ๋“ค์—๊ฒŒ ์ •๋ณด๋ฅผ ์•Œ๋ฆฌ์„ธ์š”!"
}
]
}
]
""";
Expand Down

0 comments on commit 3b74280

Please sign in to comment.