Skip to content

Commit 55fc040

Browse files
authored
Merge pull request #88 from GulSam00/feat/recentAdd
Feat/recent add
2 parents 1b4a191 + 5ca0d17 commit 55fc040

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+1750
-64
lines changed

apps/web/next-sitemap.config.js

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,25 @@ const config = {
77
changefreq: 'weekly',
88
priority: 0.7,
99
exclude: [
10-
'/login',
11-
'/signup',
12-
'/update-password',
13-
'/search',
14-
'/library',
15-
'/library/*',
16-
'/tosing',
17-
'/error',
10+
'/login*',
11+
'/signup*',
12+
'/update-password*',
13+
'/search*',
14+
'/info*',
15+
'/tosing*',
16+
'/error*',
17+
'/popular*',
18+
'/recent*',
19+
'/withdrawal*',
20+
'/api/*',
21+
'/admin/*',
1822
],
1923
robotsTxtOptions: {
2024
policies: [
2125
{
2226
userAgent: '*',
23-
disallow: '/', // 기본은 모든 경로 막기
24-
allow: ['/', '/popular'], // 이 두 경로만 허용
27+
disallow: '/', // 다른 경로 막기
28+
allow: ['/$'], // 루트 경로만 허용
2529
},
2630
],
2731
},

apps/web/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "web",
3-
"version": "1.7.0",
3+
"version": "1.8.0",
44
"type": "module",
55
"private": true,
66
"scripts": {

apps/web/public/changelog.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,5 +55,9 @@
5555
"화면 UX를 개선했습니다. 세부적인 디자인을 조정했습니다.",
5656
"로그인 상태에서 전체 검색 시 오류가 나는 현상을 수정했습니다."
5757
]
58+
},
59+
"1.8.0": {
60+
"title": "버전 1.8.0",
61+
"message": ["노래방에 최근 추가된 곡을 확인할 수 있는 페이지를 추가했습니다."]
5862
}
5963
}

apps/web/public/robots.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
# *
22
User-agent: *
3-
Disallow: /
43
Allow: /$
5-
Allow: /popular$
4+
Disallow: /
65

76
# Host
87
Host: https://www.singcode.kr

apps/web/public/sitemap-0.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:news="http://www.google.com/schemas/sitemap-news/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:mobile="http://www.google.com/schemas/sitemap-mobile/1.0" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" xmlns:video="http://www.google.com/schemas/sitemap-video/1.1">
3-
<url><loc>https://www.singcode.kr</loc><lastmod>2025-05-26T01:25:31.687Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url>
4-
<url><loc>https://www.singcode.kr/popular</loc><lastmod>2025-05-26T01:25:31.688Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url>
3+
<url><loc>https://www.singcode.kr</loc><lastmod>2025-09-14T17:29:49.412Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url>
54
</urlset>

apps/web/src/Footer.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,13 @@ import { Button } from '@/components/ui/button';
77
import { cn } from '@/utils/cn';
88

99
const navigation = [
10-
{ name: '검색', href: '/' },
10+
{ name: '최신 곡', href: '/recent' },
11+
1112
{ name: '부를 곡', href: '/tosing' },
13+
{ name: '검색', href: '/' },
14+
1215
{ name: '인기곡', href: '/popular' },
13-
{ name: '라이브러리', href: '/library' },
16+
{ name: '정보', href: '/info' },
1417
];
1518

1619
export default function Footer() {
@@ -25,7 +28,7 @@ export default function Footer() {
2528
<Button
2629
asChild
2730
key={item.name}
28-
className={cn('w-[90px] flex-auto', isActive && 'bg-accent text-accent-foreground')}
31+
className={cn('flex-1 px-0 text-sm', isActive && 'bg-accent text-accent-foreground')}
2932
variant="ghost"
3033
>
3134
<Link href={item.href}>{item.name}</Link>
File renamed without changes.
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
import { NextResponse } from 'next/server';
2+
3+
import createClient from '@/lib/supabase/server';
4+
import { ApiResponse } from '@/types/apiRoute';
5+
import { Song } from '@/types/song';
6+
7+
interface ResponseRecentAddSong {
8+
songs: Song;
9+
}
10+
export async function GET(
11+
request: Request,
12+
): Promise<NextResponse<ApiResponse<ResponseRecentAddSong[]>>> {
13+
try {
14+
const { searchParams } = new URL(request.url);
15+
16+
const year = Number(searchParams.get('year')) || 0;
17+
const month = Number(searchParams.get('month')) || 0;
18+
19+
const startDate = new Date(year, month, 1);
20+
const endDate = new Date(year, month + 1, 1);
21+
22+
const supabase = await createClient();
23+
24+
// songs 테이블의 startDate, endDate 사이의 데이터를 가져옴
25+
const { data, error: recentError } = await supabase
26+
.from('songs') // songs 테이블에서 검색
27+
.select(`*`)
28+
.gte('created_at', startDate.toISOString())
29+
.lte('created_at', endDate.toISOString())
30+
.order('created_at', { ascending: false })
31+
.limit(100); // 단순히 songs의 created_at으로 정렬
32+
33+
if (recentError) throw recentError;
34+
35+
return NextResponse.json({ success: true, data });
36+
} catch (error) {
37+
if (error instanceof Error && error.cause === 'auth') {
38+
return NextResponse.json(
39+
{
40+
success: false,
41+
error: 'User not authenticated',
42+
},
43+
{ status: 401 },
44+
);
45+
}
46+
47+
console.error('Error in recent API:', error);
48+
return NextResponse.json(
49+
{ success: false, error: 'Failed to get recent songs' },
50+
{ status: 500 },
51+
);
52+
}
53+
}

apps/web/src/app/api/songs/save/route.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ export async function POST(request: Request): Promise<NextResponse<ApiResponse<v
8787
const userId = await getAuthenticatedUser(supabase);
8888

8989
const { songId, folderName } = await request.json();
90-
const today = new Date();
9190

9291
const { data: folderData, error: folderError } = await supabase
9392
.from('save_folders')

0 commit comments

Comments
 (0)