From 181eaf44303aa6508f41d444198b4199ab94c425 Mon Sep 17 00:00:00 2001 From: Shiina Kin Date: Tue, 24 Sep 2024 12:56:07 +0800 Subject: [PATCH] feat: add groupService to InstanceCenter --- .../main/kotlin/io/sakurasou/config/InstanceCenter.kt | 4 ++++ .../kotlin/io/sakurasou/controller/GroupController.kt | 3 ++- app/src/main/kotlin/io/sakurasou/plugins/Routing.kt | 3 ++- .../kotlin/io/sakurasou/service/group/GroupService.kt | 1 - .../io/sakurasou/service/group/GroupServiceImpl.kt | 9 +++++++++ 5 files changed, 17 insertions(+), 3 deletions(-) create mode 100644 app/src/main/kotlin/io/sakurasou/service/group/GroupServiceImpl.kt diff --git a/app/src/main/kotlin/io/sakurasou/config/InstanceCenter.kt b/app/src/main/kotlin/io/sakurasou/config/InstanceCenter.kt index 10d08e9a..e066be0f 100644 --- a/app/src/main/kotlin/io/sakurasou/config/InstanceCenter.kt +++ b/app/src/main/kotlin/io/sakurasou/config/InstanceCenter.kt @@ -27,6 +27,8 @@ import io.sakurasou.service.auth.AuthService import io.sakurasou.service.auth.AuthServiceImpl import io.sakurasou.service.common.CommonService import io.sakurasou.service.common.CommonServiceImpl +import io.sakurasou.service.group.GroupService +import io.sakurasou.service.group.GroupServiceImpl import io.sakurasou.service.image.ImageService import io.sakurasou.service.role.RoleService import io.sakurasou.service.role.RoleServiceImpl @@ -55,6 +57,7 @@ object InstanceCenter { lateinit var authService: AuthService lateinit var userService: UserService + lateinit var groupService: GroupService lateinit var imageService: ImageService lateinit var albumService: AlbumService @@ -83,6 +86,7 @@ object InstanceCenter { fun initService() { albumService = AlbumServiceImpl(albumDao) settingService = SettingServiceImpl(settingDao) + groupService = GroupServiceImpl(groupDao) strategyService = StrategyServiceImpl(strategyDao) authService = AuthServiceImpl(userDao, relationDao) diff --git a/app/src/main/kotlin/io/sakurasou/controller/GroupController.kt b/app/src/main/kotlin/io/sakurasou/controller/GroupController.kt index 5077270b..ffcbd70d 100644 --- a/app/src/main/kotlin/io/sakurasou/controller/GroupController.kt +++ b/app/src/main/kotlin/io/sakurasou/controller/GroupController.kt @@ -16,12 +16,13 @@ import io.sakurasou.controller.vo.GroupVO import io.sakurasou.controller.vo.PageResult import io.sakurasou.extension.pageRequest import io.sakurasou.plugins.AuthorizationPlugin +import io.sakurasou.service.group.GroupService /** * @author Shiina Kin * 2024/9/9 08:58 */ -fun Route.groupRoute() { +fun Route.groupRoute(groupService: GroupService) { route("group", { protected = true }) { diff --git a/app/src/main/kotlin/io/sakurasou/plugins/Routing.kt b/app/src/main/kotlin/io/sakurasou/plugins/Routing.kt index f26ef520..3fbea7e7 100644 --- a/app/src/main/kotlin/io/sakurasou/plugins/Routing.kt +++ b/app/src/main/kotlin/io/sakurasou/plugins/Routing.kt @@ -14,6 +14,7 @@ import io.ktor.server.routing.* import io.ktor.util.logging.* import io.sakurasou.config.InstanceCenter.authService import io.sakurasou.config.InstanceCenter.commonService +import io.sakurasou.config.InstanceCenter.groupService import io.sakurasou.config.InstanceCenter.roleService import io.sakurasou.config.InstanceCenter.settingService import io.sakurasou.config.InstanceCenter.strategyService @@ -54,7 +55,7 @@ fun Application.configureRouting() { strategyRoute(strategyService) settingRoute(settingService) userRoute(userService) - groupRoute() + groupRoute(groupService) roleRoute(roleService) } } diff --git a/app/src/main/kotlin/io/sakurasou/service/group/GroupService.kt b/app/src/main/kotlin/io/sakurasou/service/group/GroupService.kt index ea260b86..3c4be65e 100644 --- a/app/src/main/kotlin/io/sakurasou/service/group/GroupService.kt +++ b/app/src/main/kotlin/io/sakurasou/service/group/GroupService.kt @@ -5,5 +5,4 @@ package io.sakurasou.service.group * 2024/9/13 14:47 */ interface GroupService { - fun saveGroup() } \ No newline at end of file diff --git a/app/src/main/kotlin/io/sakurasou/service/group/GroupServiceImpl.kt b/app/src/main/kotlin/io/sakurasou/service/group/GroupServiceImpl.kt new file mode 100644 index 00000000..e1f2583c --- /dev/null +++ b/app/src/main/kotlin/io/sakurasou/service/group/GroupServiceImpl.kt @@ -0,0 +1,9 @@ +package io.sakurasou.service.group +/** + * @author Shiina Kin + * 2024/9/24 12:41 + */ +class GroupServiceImpl( + private val groupDao: GroupDao +) : GroupService { +} \ No newline at end of file