fix: sourceUrl опциональный (воркер сам строит URL из itemId)
Build Media Mirror API / Build and publish (release) Successful in 29s
Build Media Mirror API / Build and publish (release) Successful in 29s
This commit is contained in:
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user