fix: sourceUrl опциональный (воркер сам строит URL из itemId)
Build Media Mirror API / Build and publish (release) Successful in 29s

This commit is contained in:
Hermes Agent
2026-08-10 23:29:06 +03:00
parent 342ceee28d
commit 72548b798a
2 changed files with 16 additions and 2 deletions
@@ -7,7 +7,6 @@ import kotlinx.serialization.Serializable
data class CreateMirrorRequest(
@field:NotBlank(message = "itemId must not be blank")
val itemId: String,
@field:NotBlank(message = "sourceUrl must not be blank")
val sourceUrl: String,
val sourceUrl: String = "",
val sourceType: String = "jellyfin",
)
@@ -83,6 +83,21 @@ class MirrorControllerTest : AbstractIntegrationTest() {
assertEquals(1, count)
}
@Test
fun `POST mirror without sourceUrl creates a job`() {
mockMvc.perform(
post("/api/mirror")
.contentType(MediaType.APPLICATION_JSON)
.content("""{"itemId":"no-url-id"}"""),
).andExpect(status().isCreated)
val response = json.decodeFromString<ByItemResponse>(
bodyOf(mockMvc.perform(get("/api/mirror/by-item/no-url-id")).andExpect(status().isOk).andReturn()),
)
assertEquals("no-url-id", response.itemId)
assertEquals("new", response.status)
}
@Test
fun `POST mirror returns 400 on blank itemId`() {
postCreate("", "https://source.example/stream")