채널 카드 필터 UI, 캐시 초기화, 나라 필터 수정

- 채널 설명/태그 DB 컬럼 추가 및 백오피스 편집 기능
- 채널 드롭다운을 유튜브 아이콘 토글 카드로 변경 (데스크톱 최대 4개 표시, 스크롤)
- 모바일 홈탭 채널 카드 가로 스크롤
- region "나라" 값 필터 옵션에서 제외
- 관리자 캐시 초기화 버튼 및 API 추가

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
joungmin
2026-03-11 16:10:21 +09:00
parent 0f985d52a9
commit 2a0ee1d2cc
9 changed files with 211 additions and 42 deletions

View File

@@ -0,0 +1,25 @@
package com.tasteby.controller;
import com.tasteby.security.AuthUtil;
import com.tasteby.service.CacheService;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
@RestController
@RequestMapping("/api/admin")
public class AdminCacheController {
private final CacheService cacheService;
public AdminCacheController(CacheService cacheService) {
this.cacheService = cacheService;
}
@PostMapping("/cache-flush")
public Map<String, Object> flushCache() {
AuthUtil.requireAdmin();
cacheService.flush();
return Map.of("ok", true);
}
}

View File

@@ -76,6 +76,14 @@ public class ChannelController {
return result;
}
@PutMapping("/{id}")
public Map<String, Object> update(@PathVariable String id, @RequestBody Map<String, String> body) {
AuthUtil.requireAdmin();
channelService.update(id, body.get("description"), body.get("tags"));
cache.flush();
return Map.of("ok", true);
}
@DeleteMapping("/{channelId}")
public Map<String, Object> delete(@PathVariable String channelId) {
AuthUtil.requireAdmin();

View File

@@ -14,6 +14,8 @@ public class Channel {
private String channelId;
private String channelName;
private String titleFilter;
private String description;
private String tags;
private int videoCount;
private String lastVideoAt;
}

View File

@@ -21,4 +21,8 @@ public interface ChannelMapper {
int deactivateById(@Param("id") String id);
Channel findByChannelId(@Param("channelId") String channelId);
void updateDescriptionTags(@Param("id") String id,
@Param("description") String description,
@Param("tags") String tags);
}

View File

@@ -38,4 +38,8 @@ public class ChannelService {
public Channel findByChannelId(String channelId) {
return mapper.findByChannelId(channelId);
}
public void update(String id, String description, String tags) {
mapper.updateDescriptionTags(id, description, tags);
}
}

View File

@@ -7,12 +7,14 @@
<result property="channelId" column="channel_id"/>
<result property="channelName" column="channel_name"/>
<result property="titleFilter" column="title_filter"/>
<result property="description" column="description"/>
<result property="tags" column="tags"/>
<result property="videoCount" column="video_count"/>
<result property="lastVideoAt" column="last_video_at"/>
</resultMap>
<select id="findAllActive" resultMap="channelResultMap">
SELECT c.id, c.channel_id, c.channel_name, c.title_filter,
SELECT c.id, c.channel_id, c.channel_name, c.title_filter, c.description, c.tags,
(SELECT COUNT(*) FROM videos v WHERE v.channel_id = c.id) AS video_count,
(SELECT MAX(v.published_at) FROM videos v WHERE v.channel_id = c.id) AS last_video_at
FROM channels c
@@ -35,6 +37,11 @@
WHERE id = #{id} AND is_active = 1
</update>
<update id="updateDescriptionTags">
UPDATE channels SET description = #{description}, tags = #{tags}
WHERE id = #{id}
</update>
<select id="findByChannelId" resultMap="channelResultMap">
SELECT id, channel_id, channel_name, title_filter
FROM channels