feat: bugcollect 添加 Sourcemap 列表 API
- 新增 GET /bugcollect/v1/sourcemaps 端点 - SourcemapService 新增 listByAppKey 方法 - 新增 SourcemapInfo DTO - LogSourcemapRepository 新增 findByAppKey 查询 Co-Authored-By: Claude <noreply@anthropic.com>
这个提交包含在:
父节点
a8ad342336
当前提交
dea5038de2
@ -203,6 +203,11 @@ public class LogController {
|
||||
return ApiResponse.success(sourcemapService.upload(appKey, platform, appVersion, bundleVersion, bundleName, file));
|
||||
}
|
||||
|
||||
@GetMapping("/sourcemaps")
|
||||
public ApiResponse<List<SourcemapInfo>> listSourcemaps(@RequestParam String appKey) {
|
||||
return ApiResponse.success(sourcemapService.listByAppKey(appKey));
|
||||
}
|
||||
|
||||
// ── Webhooks ───────────────────────────────────────────────────────────────
|
||||
|
||||
@GetMapping("/webhooks")
|
||||
|
||||
@ -0,0 +1,14 @@
|
||||
package com.xuqm.bugcollect.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
public record SourcemapInfo(
|
||||
@JsonProperty("id") Long id,
|
||||
@JsonProperty("appKey") String appKey,
|
||||
@JsonProperty("platform") String platform,
|
||||
@JsonProperty("appVersion") String appVersion,
|
||||
@JsonProperty("bundleName") String bundleName,
|
||||
@JsonProperty("storageKey") String storageKey,
|
||||
@JsonProperty("uploadedAt") LocalDateTime uploadedAt
|
||||
) {}
|
||||
@ -3,6 +3,7 @@ package com.xuqm.bugcollect.repository;
|
||||
import com.xuqm.bugcollect.entity.LogSourcemapEntity;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
public interface LogSourcemapRepository extends JpaRepository<LogSourcemapEntity, Long> {
|
||||
@ -10,5 +11,7 @@ public interface LogSourcemapRepository extends JpaRepository<LogSourcemapEntity
|
||||
Optional<LogSourcemapEntity> findByAppKeyAndPlatformAndAppVersionAndBundleName(
|
||||
String appKey, String platform, String appVersion, String bundleName);
|
||||
|
||||
List<LogSourcemapEntity> findByAppKey(String appKey);
|
||||
|
||||
void deleteByAppKey(String appKey);
|
||||
}
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package com.xuqm.bugcollect.service;
|
||||
|
||||
import com.xuqm.bugcollect.dto.SourcemapInfo;
|
||||
import com.xuqm.bugcollect.dto.SourcemapUploadResponse;
|
||||
import com.xuqm.bugcollect.entity.LogSourcemapEntity;
|
||||
import com.xuqm.bugcollect.repository.LogSourcemapRepository;
|
||||
@ -15,6 +16,7 @@ import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@Service
|
||||
@ -110,4 +112,19 @@ public class SourcemapService {
|
||||
public String readSourceMapContent(String storageKey) throws IOException {
|
||||
return Files.readString(Paths.get(storageKey));
|
||||
}
|
||||
|
||||
public List<SourcemapInfo> listByAppKey(String appKey) {
|
||||
return sourcemapRepository.findByAppKey(appKey)
|
||||
.stream()
|
||||
.map(entity -> new SourcemapInfo(
|
||||
entity.getId(),
|
||||
entity.getAppKey(),
|
||||
entity.getPlatform(),
|
||||
entity.getAppVersion(),
|
||||
entity.getBundleName(),
|
||||
entity.getStorageKey(),
|
||||
entity.getUploadedAt()
|
||||
))
|
||||
.toList();
|
||||
}
|
||||
}
|
||||
|
||||
正在加载...
在新工单中引用
屏蔽一个用户