Skip to content

Commit

Permalink
controller: SuperAdminController: Fix creating of club
Browse files Browse the repository at this point in the history
Signed-off-by: Shashank Verma <[email protected]>
  • Loading branch information
shank03 committed Nov 1, 2023
1 parent eafe345 commit 47ae05d
Showing 1 changed file with 17 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package com.mnnit.moticlubs.controller

import com.mnnit.moticlubs.dao.Admin
import com.mnnit.moticlubs.dao.Channel
import com.mnnit.moticlubs.dao.Club
import com.mnnit.moticlubs.dto.request.AddClubDTO
import com.mnnit.moticlubs.dto.request.AssignAdminDTO
import com.mnnit.moticlubs.service.AdminService
import com.mnnit.moticlubs.service.ChannelService
import com.mnnit.moticlubs.service.ClubService
import com.mnnit.moticlubs.utils.Constants.BASE_PATH
import com.mnnit.moticlubs.utils.Constants.SUPER_ADMIN_ROUTE
Expand Down Expand Up @@ -33,6 +35,7 @@ import reactor.core.publisher.Mono
class SuperAdminController(
private val pathAuthorization: PathAuthorization,
private val clubService: ClubService,
private val channelService: ChannelService,
private val adminService: AdminService,
) {

Expand Down Expand Up @@ -65,7 +68,16 @@ class SuperAdminController(
),
)
}
.invalidateStamp { ResponseStamp.CLUB }
.flatMap { club ->
LOGGER.info("addClub: creating general channel")
channelService.saveChannel(
Channel(cid = club.cid, name = "General", private = false),
).map { club }
}
.invalidateStamp {
ResponseStamp.CHANNEL.invalidateStamp()
ResponseStamp.CLUB
}
.wrapError()

@DeleteMapping("/delete_club")
Expand All @@ -76,7 +88,10 @@ class SuperAdminController(
LOGGER.info("deleteClubByCid: cid: $clubId")
clubService.deleteClubByCid(clubId)
}
.invalidateStamp { ResponseStamp.CLUB }
.invalidateStamp {
ResponseStamp.CHANNEL.invalidateStamp()
ResponseStamp.CLUB
}
.wrapError()

@PostMapping("/add_admin")
Expand Down

0 comments on commit 47ae05d

Please sign in to comment.