feat(api): add controller layer and auth service stubs
- Add AdminBookController, AdminBorrowController, BookController, BorrowController, and DashBoardController stubs - Implement AuthController with login endpoint - Add AuthService interface and AuthServiceImpl stub
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
package com.msksbr.bookmgr.controller
|
||||
|
||||
import org.springframework.web.bind.annotation.RestController
|
||||
|
||||
@RestController
|
||||
class AdminBookController {
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.msksbr.bookmgr.controller
|
||||
|
||||
import org.springframework.web.bind.annotation.RestController
|
||||
|
||||
@RestController
|
||||
class AdminBorrowController {
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.msksbr.bookmgr.controller
|
||||
|
||||
import com.msksbr.bookmgr.service.AuthService
|
||||
import jakarta.servlet.http.HttpSession
|
||||
import org.springframework.beans.factory.annotation.Autowired
|
||||
import org.springframework.web.bind.annotation.PostMapping
|
||||
import org.springframework.web.bind.annotation.RestController
|
||||
|
||||
// 管理登录、登出
|
||||
@RestController
|
||||
class AuthController(
|
||||
val authService: AuthService
|
||||
) {
|
||||
@PostMapping("/api/auth/login")
|
||||
fun login(username: String?, password: String?) :String? {
|
||||
return TODO("提供返回值")
|
||||
}
|
||||
@PostMapping("/api/auth/logout")
|
||||
fun logout(session: HttpSession): String? {
|
||||
// 直接销毁session
|
||||
session.invalidate()
|
||||
return TODO("Need json template")
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.msksbr.bookmgr.controller
|
||||
|
||||
import org.springframework.web.bind.annotation.RestController
|
||||
|
||||
@RestController
|
||||
class BookController {
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.msksbr.bookmgr.controller
|
||||
|
||||
import org.springframework.web.bind.annotation.RestController
|
||||
|
||||
@RestController
|
||||
class BorrowController {
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.msksbr.bookmgr.controller
|
||||
|
||||
import org.springframework.web.bind.annotation.RestController
|
||||
|
||||
@RestController
|
||||
class DashBoardController {
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package com.msksbr.bookmgr.service
|
||||
|
||||
interface AuthService {
|
||||
fun login(username: String?, password: String?): String?
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.msksbr.bookmgr.service.impl
|
||||
|
||||
import com.msksbr.bookmgr.service.AuthService
|
||||
import org.springframework.stereotype.Service
|
||||
|
||||
@Service
|
||||
class AuthServiceImpl: AuthService {
|
||||
override fun login(username: String?, password: String?): String? {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user