Skip to content

Commit e1534a9

Browse files
committed
Merge branch 'develop' of https://github.com/pirogramming/Moodico into main-test
2 parents 63b284d + 072f28a commit e1534a9

26 files changed

Lines changed: 2061 additions & 1464 deletions

API_SPECIFICATION.md

Lines changed: 486 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Generated by Django 5.2.4 on 2025-08-10 08:09
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
('products', '0006_remove_productlike_product_url'),
10+
]
11+
12+
operations = [
13+
migrations.AddField(
14+
model_name='productlike',
15+
name='product_url',
16+
field=models.URLField(blank=True, null=True, verbose_name='제품 URL'),
17+
),
18+
]

moodico/products/models.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ class ProductLike(models.Model):
6767
product_brand = models.CharField(max_length=255, verbose_name="브랜드")
6868
product_price = models.CharField(max_length=100, verbose_name="가격")
6969
product_image = models.URLField(null=True, blank=True, verbose_name="제품 이미지")
70+
product_url = models.URLField(null=True, blank=True, verbose_name="제품 URL")
7071
created_at = models.DateTimeField(auto_now_add=True, verbose_name="좋아요 날짜")
7172

7273
class Meta:

moodico/products/views.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ def get_liked_products_color_info(liked_products):
211211
products_with_colors = []
212212

213213
for liked_product in liked_products:
214+
logger.info(f"찜한 제품 처리 중: {liked_product.product_name} (브랜드: {liked_product.product_brand})")
214215
# all_products.json에서 매칭되는 제품 찾기
215216
matching_product = None
216217
for product in all_products:
@@ -220,9 +221,21 @@ def get_liked_products_color_info(liked_products):
220221
matching_product = product
221222
break
222223

224+
# 제품명으로 매칭이 안 되면 브랜드명으로도 시도
225+
if not matching_product:
226+
for product in all_products:
227+
if (liked_product.product_brand.lower() in product.get('brand', '').lower() or
228+
product.get('brand', '').lower() in liked_product.product_brand.lower()):
229+
# 브랜드가 일치하면 제품명도 부분적으로 일치하는지 확인
230+
if (liked_product.product_name.lower() in product.get('name', '').lower() or
231+
product.get('name', '').lower() in liked_product.product_name.lower()):
232+
matching_product = product
233+
break
234+
223235
if matching_product:
236+
logger.info(f"제품 매칭 성공: {matching_product.get('name')} -> URL: {matching_product.get('url')}")
224237
products_with_colors.append({
225-
'id': matching_product.get('id', ''),
238+
'id': liked_product.product_id, # ProductLike의 product_id 사용
226239
'name': liked_product.product_name,
227240
'brand': liked_product.product_brand,
228241
'price': liked_product.product_price,
@@ -234,6 +247,7 @@ def get_liked_products_color_info(liked_products):
234247
'url': matching_product.get('url', '#')
235248
})
236249
else:
250+
logger.warning(f"제품 매칭 실패: {liked_product.product_name} (브랜드: {liked_product.product_brand})")
237251
# 매칭되지 않는 경우 기본값 사용
238252
products_with_colors.append({
239253
'id': liked_product.product_id,

moodico/users/views.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from moodico.products.models import ProductLike
99
from .utils import login_or_kakao_required
1010
from moodico.users.models import UserProfile
11+
from moodico.products.views import get_liked_products_color_info
1112

1213
# Create your views here.
1314
def signup_view(request):
@@ -146,10 +147,14 @@ def profile(request):
146147
user_mood = "정보 없음"
147148
liked_products = ProductLike.objects.filter(user=request.user).order_by('-created_at')
148149

150+
# 찜한 제품들의 색상 및 URL 정보 가져오기
151+
liked_products_colors = get_liked_products_color_info(liked_products)
152+
149153
context = {
150154
'user_name': user_name,
151155
'user_mood': user_mood,
152156
'liked_products': liked_products,
157+
'liked_products_colors': liked_products_colors,
153158
}
154159

155160
return render(request, 'users/profile.html', context)
Lines changed: 253 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,253 @@
1+
.mood-result-container {
2+
max-width: 1200px;
3+
margin: 0 auto;
4+
padding: 40px 20px;
5+
min-height: 100vh;
6+
color: #333;
7+
}
8+
9+
.result-header {
10+
text-align: center;
11+
margin-bottom: 50px;
12+
}
13+
14+
.result-header h1 {
15+
font-size: 3.5em;
16+
margin-bottom: 10px;
17+
font-weight: 700;
18+
color: #333;
19+
}
20+
21+
.result-header p {
22+
font-size: 1.3em;
23+
color: #666;
24+
line-height: 1.6;
25+
}
26+
27+
.mood-card {
28+
background: white;
29+
border-radius: 15px;
30+
padding: 30px;
31+
margin-bottom: 40px;
32+
border: 1px solid #eee;
33+
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
34+
}
35+
36+
.mood-title {
37+
font-size: 2.2em;
38+
font-weight: 700;
39+
margin-bottom: 15px;
40+
text-align: center;
41+
color: #333;
42+
}
43+
44+
.mood-description {
45+
font-size: 1.2em;
46+
line-height: 1.6;
47+
text-align: center;
48+
margin-bottom: 30px;
49+
color: #555;
50+
}
51+
52+
.mood-details {
53+
display: grid;
54+
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
55+
gap: 30px;
56+
margin-bottom: 40px;
57+
}
58+
59+
.detail-section {
60+
background: white;
61+
padding: 20px;
62+
border-radius: 12px;
63+
border: 1px solid #eee;
64+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
65+
}
66+
67+
.detail-section h3 {
68+
font-size: 1.2em;
69+
margin-bottom: 15px;
70+
color: #333;
71+
font-weight: 600;
72+
}
73+
74+
.detail-section p {
75+
font-size: 1.1em;
76+
line-height: 1.5;
77+
color: #555;
78+
}
79+
80+
.keyword-tags {
81+
display: flex;
82+
flex-wrap: wrap;
83+
gap: 10px;
84+
margin-top: 15px;
85+
}
86+
87+
.keyword-tag {
88+
background: #667eea;
89+
color: white;
90+
padding: 4px 8px;
91+
border-radius: 12px;
92+
font-size: 12px;
93+
font-weight: 500;
94+
}
95+
96+
.products-section {
97+
margin-top: 40px;
98+
}
99+
100+
.products-section h2 {
101+
font-size: 2em;
102+
text-align: center;
103+
margin-bottom: 30px;
104+
font-weight: 600;
105+
}
106+
107+
.products-grid {
108+
display: grid;
109+
grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
110+
gap: 25px;
111+
margin-bottom: 40px;
112+
}
113+
114+
.product-card {
115+
background: white;
116+
border-radius: 15px;
117+
padding: 16px;
118+
text-align: center;
119+
transition: transform 0.3s, box-shadow 0.3s;
120+
border: 1px solid #eee;
121+
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
122+
display: flex;
123+
flex-direction: column;
124+
height: 100%;
125+
min-height: 220px;
126+
}
127+
128+
.product-card:hover {
129+
transform: translateY(-5px);
130+
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
131+
}
132+
133+
.product-image {
134+
width: 100%;
135+
height: 120px;
136+
object-fit: cover;
137+
border-radius: 10px;
138+
margin-bottom: 12px;
139+
}
140+
141+
.product-brand {
142+
font-size: 14px;
143+
color: #333;
144+
font-weight: 600;
145+
margin-bottom: 5px;
146+
}
147+
148+
.product-name {
149+
font-size: 1em;
150+
font-weight: 500;
151+
margin-bottom: 10px;
152+
line-height: 1.3;
153+
color: #555;
154+
word-break: keep-all;
155+
overflow-wrap: break-word;
156+
}
157+
158+
.product-price {
159+
font-size: 1.1em;
160+
font-weight: 700;
161+
margin-bottom: 15px;
162+
color: #333;
163+
margin-top: auto;
164+
}
165+
166+
.purchase-btn {
167+
padding: 8px 12px;
168+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
169+
color: white;
170+
border: none;
171+
border-radius: 8px;
172+
font-size: 13px;
173+
font-weight: 600;
174+
cursor: pointer;
175+
transition: all 0.3s;
176+
width: 100%;
177+
}
178+
179+
.purchase-btn:hover {
180+
background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
181+
transform: translateY(-2px);
182+
}
183+
184+
.action-buttons {
185+
display: flex;
186+
justify-content: center;
187+
gap: 20px;
188+
flex-wrap: wrap;
189+
margin-top: 70px;
190+
}
191+
192+
.action-btn {
193+
background: white;
194+
color: #333;
195+
border: 2px solid #eee;
196+
padding: 12px 20px;
197+
border-radius: 20px;
198+
font-size: 14px;
199+
font-weight: 600;
200+
cursor: pointer;
201+
transition: all 0.3s;
202+
text-decoration: none;
203+
display: inline-block;
204+
}
205+
206+
.action-btn:hover {
207+
background: #f8f9fa;
208+
border-color: #ddd;
209+
transform: translateY(-2px);
210+
}
211+
212+
.action-btn.primary {
213+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
214+
border-color: #667eea;
215+
color: white;
216+
}
217+
218+
.action-btn.primary:hover {
219+
background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
220+
}
221+
222+
@media (max-width: 768px) {
223+
.mood-result-container {
224+
padding: 20px 15px;
225+
}
226+
227+
.result-header h1 {
228+
font-size: 2.5em;
229+
}
230+
231+
.mood-title {
232+
font-size: 2em;
233+
}
234+
235+
.mood-details {
236+
grid-template-columns: 1fr;
237+
gap: 20px;
238+
}
239+
240+
.products-grid {
241+
grid-template-columns: 1fr;
242+
}
243+
244+
.action-buttons {
245+
flex-direction: column;
246+
align-items: center;
247+
}
248+
249+
.action-btn {
250+
width: 100%;
251+
max-width: 300px;
252+
}
253+
}

0 commit comments

Comments
 (0)