Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add price comparison URL to perfume data (#542) #543

Merged
merged 1 commit into from
Mar 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/controllers/definitions/response/perfume.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ type NoteDict = {
* type: array
* items:
* type: string
* priceComparisonUrl:
* type: string
* description: 가격 비교 url
* score:
* type: number
* description: 점수 평균 값
Expand Down Expand Up @@ -169,6 +172,7 @@ class PerfumeDetailResponse {
readonly noteType: number;
readonly ingredients: NoteDict;
readonly reviewIdx: number;
readonly priceComparisonUrl: string;
constructor(
perfumeIdx: number,
name: string,
Expand All @@ -186,7 +190,8 @@ class PerfumeDetailResponse {
Keywords: string[],
noteType: number,
ingredients: NoteDict,
reviewIdx: number = NO_REVIEW
reviewIdx: number = NO_REVIEW,
priceComparisonUrl?: string
) {
this.perfumeIdx = perfumeIdx;
this.name = name;
Expand All @@ -205,6 +210,7 @@ class PerfumeDetailResponse {
this.noteType = noteType;
this.ingredients = ingredients;
this.reviewIdx = reviewIdx;
this.priceComparisonUrl = priceComparisonUrl ?? '';
}

public toString(): string {
Expand Down Expand Up @@ -242,7 +248,8 @@ class PerfumeDetailResponse {
perfumeIntegralDTO.keywordList,
perfumeIntegralDTO.noteType,
perfumeIntegralDTO.noteDict,
perfumeIntegralDTO.reviewIdx
perfumeIntegralDTO.reviewIdx,
perfumeIntegralDTO.priceComparisonUrl
);
}
private static convertLongevity(longevity: any): Longevity {
Expand Down
8 changes: 6 additions & 2 deletions src/data/dto/PerfumeDTO.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ class PerfumeDTO {
readonly abundanceRate: number;
readonly volumeAndPrice: { [key: string]: number }[];
readonly imageUrl: string;
readonly priceComparisonUrl: string;
readonly Brand: BrandDTO;
constructor(
perfumeIdx: number,
Expand All @@ -16,7 +17,8 @@ class PerfumeDTO {
abundanceRate: number,
volumeAndPrice: { [key: string]: number }[],
imageUrl: string,
Brand: BrandDTO
Brand: BrandDTO,
priceComparisonUrl: string
) {
this.perfumeIdx = perfumeIdx;
this.name = name;
Expand All @@ -26,6 +28,7 @@ class PerfumeDTO {
this.volumeAndPrice = volumeAndPrice;
this.imageUrl = imageUrl;
this.Brand = Brand;
this.priceComparisonUrl = priceComparisonUrl;
}

public toString(): string {
Expand All @@ -40,7 +43,8 @@ class PerfumeDTO {
json.abundanceRate,
json.volumeAndPrice,
json.imageUrl,
BrandDTO.createByJson(json.Brand)
BrandDTO.createByJson(json.Brand),
json.priceComparisonUrl
);
}
}
Expand Down
8 changes: 6 additions & 2 deletions src/data/dto/PerfumeIntegralDTO.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class PerfumeIntegralDTO {
readonly noteType: number;
readonly noteDict: NoteDict;
readonly reviewIdx: number;
readonly priceComparisonUrl: string;
constructor(
perfumeIdx: number,
name: string,
Expand All @@ -65,7 +66,8 @@ class PerfumeIntegralDTO {
keywordList: string[],
noteType: number,
noteDict: NoteDict,
reviewIdx: number
reviewIdx: number,
priceComparisonUrl: string
) {
this.perfumeIdx = perfumeIdx;
this.name = name;
Expand All @@ -84,6 +86,7 @@ class PerfumeIntegralDTO {
this.noteType = noteType;
this.noteDict = noteDict;
this.reviewIdx = reviewIdx;
this.priceComparisonUrl = priceComparisonUrl;
}

public toString(): string {
Expand Down Expand Up @@ -142,7 +145,8 @@ class PerfumeIntegralDTO {
json.keywordList,
json.noteType,
json.noteDict,
json.reviewIdx
json.reviewIdx,
json.priceComparisonUrl
);
}
}
Expand Down
6 changes: 6 additions & 0 deletions src/models/tables/Perfume.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ export class Perfume extends Model {
})
imageUrl: string;

@Column({
type: DataType.STRING,
allowNull: true,
})
priceComparisonUrl: string;

@Column({
type: DataType.STRING(1000),
allowNull: false,
Expand Down