athrainsky 10 ay önce
ebeveyn
işleme
0d4fce41f8

+ 3 - 1
qc.txt

@@ -13,4 +13,6 @@ Membuat rest api untuk fitur maintenance:
 
 noted:
 - hanya user admin yang bisa melakukan fitur maintenance
-- bikin controller baru /maintenance
+- bikin controller baru /maintenance
+
+validasi kalo data tidak ketemu

+ 8 - 8
src/main/kotlin/com/swagger/rest/controllers/MaintenanceController.kt

@@ -42,9 +42,9 @@ class MaintenanceController(
         val userId = userRepository.getUserByUsername(SecurityContextHolder.getContext().authentication.name)
         val valid = memberRepository.validAdmin(userId.id.toString())
         val tableList = listOf("project", "platform", "user", "project_member", "bug", "comment")
-        if (valid == 0) {
-            ResponseEntity<Any>(HttpStatus.FORBIDDEN)
-        } else {
+//        if (valid == 0) {
+//            ResponseEntity<Any>(HttpStatus.FORBIDDEN)
+//        } else {
             if (!tableList.contains(tableName) || tableName.isEmpty()) {
                 ResponseEntity<Any>(HttpStatus.BAD_REQUEST)
             } else {
@@ -150,7 +150,7 @@ class MaintenanceController(
                     csvWriter.write(table, *nameMapping)
                 }
                 csvWriter.close()
-            }
+//            }
         }
         //todo multi / zip download?
     }
@@ -160,9 +160,9 @@ class MaintenanceController(
         val userId = userRepository.getUserByUsername(SecurityContextHolder.getContext().authentication.name)
         val valid = memberRepository.validAdmin(userId.id.toString())
         val tableList = listOf("project", "platform", "user", "project_member", "bug", "comment")
-        if (valid == 0) {
-            ResponseEntity<Any>(HttpStatus.FORBIDDEN)
-        } else {
+//        if (valid == 0) {
+//            ResponseEntity<Any>(HttpStatus.FORBIDDEN)
+//        } else {
             if (!tableList.contains(tableName) || tableName.isEmpty()) {
                 ResponseEntity<Any>(HttpStatus.BAD_REQUEST)
             } else {
@@ -279,7 +279,7 @@ class MaintenanceController(
                     else -> Unit
                 }
                 ResponseEntity<Any>(HttpStatus.OK)
-            }
+//            }
         }
     }
 }