Skip to content

Commit d204ccb

Browse files
fix: MySQL type mapping in DestinationSchemaService + use @WithMockUser in inheritance test
- DestinationSchemaService: handle ConnectionType.MYSQL in both source normalisation and destination dialect branches - WorkspaceInheritanceControllerTest: switch .with(user()) to @WithMockUser annotation for cleaner security context setup Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent f6b1d93 commit d204ccb

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

backend/src/main/kotlin/com/opendatamask/service/DestinationSchemaService.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,15 @@ class DestinationSchemaService {
6060
ConnectionType.MONGODB, ConnectionType.MONGODB_COSMOS -> "mixed"
6161
ConnectionType.FILE ->
6262
if (sourceType.equals("mixed", ignoreCase = true)) "TEXT" else sourceType.uppercase()
63+
ConnectionType.MYSQL ->
64+
postgresTypeMap[sourceType.lowercase()] ?: sourceType.uppercase()
6365
}
6466

6567
// Step 2: translate the portable type to the destination dialect
6668
return when (destDb) {
6769
ConnectionType.MONGODB, ConnectionType.MONGODB_COSMOS -> "mixed"
6870
ConnectionType.AZURE_SQL -> toAzureSqlTypeMap[normalized] ?: normalized
69-
ConnectionType.POSTGRESQL, ConnectionType.FILE -> normalized
71+
ConnectionType.POSTGRESQL, ConnectionType.FILE, ConnectionType.MYSQL -> normalized
7072
}
7173
}
7274

backend/src/test/kotlin/com/opendatamask/controller/WorkspaceInheritanceControllerTest.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import org.springframework.boot.autoconfigure.security.servlet.SecurityFilterAut
1818
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest
1919
import org.springframework.boot.test.mock.mockito.MockBean
2020
import org.springframework.http.MediaType
21-
import org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.user
21+
import org.springframework.security.test.context.support.WithMockUser
2222
import org.springframework.test.context.ActiveProfiles
2323
import org.springframework.test.web.servlet.MockMvc
2424
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*
@@ -75,6 +75,7 @@ class WorkspaceInheritanceControllerTest {
7575
}
7676

7777
@Test
78+
@WithMockUser(username = "testuser")
7879
fun `POST children creates child workspace and returns 201`() {
7980
val response = makeWorkspaceResponse(id = 5L, name = "child", parentId = 1L)
8081
whenever(workspaceService.createWorkspace(any<WorkspaceRequest>(), any<Long>())).thenReturn(response)
@@ -87,7 +88,6 @@ class WorkspaceInheritanceControllerTest {
8788
)
8889
mockMvc.perform(
8990
post("/api/workspaces/1/children")
90-
.with(user("testuser").roles("USER"))
9191
.contentType(MediaType.APPLICATION_JSON)
9292
.content(body)
9393
)

0 commit comments

Comments
 (0)