Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
ilyoil2 committed Sep 19, 2024
2 parents 57c814a + e7100f4 commit 2124d56
Show file tree
Hide file tree
Showing 85 changed files with 1,810 additions and 62 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/xquare-cd-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,5 @@ jobs:
S3_BUCKET_NAME=${{ secrets.S3_BUCKET_NAME }}
FCM_FILE_URL=${{ secrets.FCM_FILE_URL }}
FLYWAY_ENABLED=${{ secrets.FLYWAY_ENABLED }}
BASELINE_ON_MIGRATE=${{ secrets.BASELINE_ON_MIGRATE }}
BASELINE_ON_MIGRATE=${{ secrets.BASELINE_ON_MIGRATE }}
# SLACK_WEBHOOK_URL=${{ secrets.SLACK_STAG_WEBHOOK_URL }}
3 changes: 2 additions & 1 deletion .github/workflows/xquare-cd-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,5 @@ jobs:
S3_BUCKET_NAME=${{ secrets.S3_BUCKET_NAME }}
FCM_FILE_URL=${{ secrets.FCM_FILE_URL }}
FLYWAY_ENABLED=${{ secrets.FLYWAY_ENABLED }}
BASELINE_ON_MIGRATE=${{ secrets.BASELINE_ON_MIGRATE }}
BASELINE_ON_MIGRATE=${{ secrets.BASELINE_ON_MIGRATE }}
SLACK_WEBHOOK_URL=${{ secrets.SLACK_PROD_WEBHOOK_URL }}
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,8 @@ ENV FLYWAY_ENABLED ${FLYWAY_ENABLED}
ARG BASELINE_ON_MIGRATE
ENV BASELINE_ON_MIGRATE ${BASELINE_ON_MIGRATE}

ARG SLACK_WEBHOOK_URL
ENV SLACK_WEBHOOK_URL ${SLACK_WEBHOOK_URL}

COPY ./dms-infrastructure/build/libs/*.jar app.jar
ENTRYPOINT ["java","-jar","/app.jar"]
4 changes: 4 additions & 0 deletions buildSrc/src/main/kotlin/Dependencies.kt
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,8 @@ object Dependencies {
// flyway
const val FLYWAY = "org.flywaydb:flyway-mysql:${DependencyVersions.FLYWAY_VERSION}"

// slack
const val SLACK = "com.slack.api:slack-api-client:${DependencyVersions.SLACK_VERSION}"

const val CACHE = "org.springframework.boot:spring-boot-starter-cache"
}
1 change: 1 addition & 0 deletions buildSrc/src/main/kotlin/DependencyVersions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ object DependencyVersions {
const val ASPECTJ_VERSION = "1.9.7"
const val FCM_VERSION = "8.1.0"
const val FLYWAY_VERSION = "10.8.1"
const val SLACK_VERSION = "1.40.3"
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ package team.aliens.dms.domain.auth.dto
data class SignInRequest(
val accountId: String,
val password: String,
val deviceToken: String
val deviceToken: String?
)
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,18 @@ class SignInUseCase(
)
val availableFeatures = schoolService.getAvailableFeaturesBySchoolId(user.schoolId)

if (notificationService.checkDeviceTokenByUserId(user.id))
notificationService.deleteDeviceTokenByUserId(user.id)

notificationService.saveDeviceToken(
DeviceToken(
userId = user.id,
schoolId = user.schoolId,
token = request.deviceToken
if (!request.deviceToken.isNullOrBlank()) {
if (notificationService.checkDeviceTokenByUserId(user.id))
notificationService.deleteDeviceTokenByUserId(user.id)

notificationService.saveDeviceToken(
DeviceToken(
userId = user.id,
schoolId = user.schoolId,
token = request.deviceToken
)
)
)
}

return TokenFeatureResponse.of(tokenResponse, availableFeatures)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@ import team.aliens.dms.common.annotation.Service

@Service
class BugService(
commandBugService: CommandBugService
) : CommandBugService by commandBugService
commandBugService: CommandBugService,
sendBugService: SendBugService
) : CommandBugService by commandBugService,
SendBugService by sendBugService
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package team.aliens.dms.domain.bug.service

import team.aliens.dms.domain.bug.model.BugReport

interface SendBugService {

fun sendBugReport(bugReport: BugReport)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package team.aliens.dms.domain.bug.service

import team.aliens.dms.common.annotation.Service
import team.aliens.dms.domain.bug.model.BugReport
import team.aliens.dms.domain.bug.spi.SendBugPort

@Service
class SendBugServiceImpl(
private val sendBugPort: SendBugPort
) : SendBugService {

override fun sendBugReport(bugReport: BugReport) {
sendBugPort.sendBugReport(bugReport)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package team.aliens.dms.domain.bug.spi

import team.aliens.dms.domain.bug.model.BugReport

interface SendBugPort {

fun sendBugReport(bugReport: BugReport)
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@ class CreateBugReportUseCase(

val attachmentUrls = request.attachmentUrls ?: emptyList()

bugService.saveBugReport(
BugReport(
studentId = student.id,
content = request.content,
developmentArea = DevelopmentArea.valueOf(request.developmentArea),
createdAt = LocalDateTime.now(),
attachmentUrls = BugAttachment(attachmentUrls)
bugService.sendBugReport(
bugService.saveBugReport(
BugReport(
studentId = student.id,
content = request.content,
developmentArea = DevelopmentArea.valueOf(request.developmentArea),
createdAt = LocalDateTime.now(),
attachmentUrls = BugAttachment(attachmentUrls)
)
)
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,6 @@ interface NotificationService :
fun sendMessagesByTopic(
notification: Notification
)

fun toggleSubscription(token: String, topic: Topic)
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import team.aliens.dms.domain.notification.model.TopicSubscription
import team.aliens.dms.domain.notification.spi.CommandNotificationOfUserPort
import team.aliens.dms.domain.notification.spi.CommandTopicSubscriptionPort
import team.aliens.dms.domain.notification.spi.NotificationPort
import team.aliens.dms.domain.notification.spi.QueryTopicSubscriptionPort
import team.aliens.dms.domain.user.spi.QueryUserPort

@Service
Expand All @@ -16,6 +17,7 @@ class NotificationServiceImpl(
private val queryUserPort: QueryUserPort,
private val commandTopicSubscriptionPort: CommandTopicSubscriptionPort,
private val notificationOfUserPort: CommandNotificationOfUserPort,
private val queryTopicSubscriptionPort: QueryTopicSubscriptionPort,
getNotificationService: GetNotificationService,
checkNotificationService: CheckNotificationService,
commandNotificationService: CommandNotificationService
Expand Down Expand Up @@ -118,4 +120,25 @@ class NotificationServiceImpl(
notification = notification
)
}

override fun toggleSubscription(token: String, topic: Topic) {
val deviceToken = this.getDeviceTokenByToken(token)
val currentSubscribe = queryTopicSubscriptionPort.queryDeviceTokenIdAndTopic(deviceToken.id, topic)

currentSubscribe?.let {
if (it.isSubscribed) {
notificationPort.unsubscribeTopic(token, topic)
} else {
notificationPort.subscribeTopic(token, topic)
}

commandTopicSubscriptionPort.saveTopicSubscription(
TopicSubscription(
deviceTokenId = deviceToken.id,
topic = topic,
isSubscribed = !it.isSubscribed
)
)
}
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
package team.aliens.dms.domain.notification.spi

import team.aliens.dms.domain.notification.model.Topic
import team.aliens.dms.domain.notification.model.TopicSubscription
import java.util.UUID

interface QueryTopicSubscriptionPort {

fun queryTopicSubscriptionsByDeviceTokenId(deviceTokenId: UUID): List<TopicSubscription>

fun queryDeviceTokenIdAndTopic(deviceTokenId: UUID, topic: Topic): TopicSubscription?
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package team.aliens.dms.domain.notification.usecase

import team.aliens.dms.common.annotation.UseCase
import team.aliens.dms.domain.notification.model.Topic
import team.aliens.dms.domain.notification.service.NotificationService

@UseCase
class ToggleSubscriptionUseCase(
private val notificationService: NotificationService
) {

fun execute(deviceToken: String, topic: Topic) {
notificationService.toggleSubscription(
token = deviceToken,
topic = topic
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,10 @@ data class OutingAvailableTime(
) : SchoolIdDomain {

fun checkAvailable(
dayOfWeek: DayOfWeek,
outingTime: LocalTime,
arrivalTime: LocalTime,
) {
if (this.dayOfWeek != dayOfWeek ||
if (
this.outingTime.isAfter(outingTime) ||
this.arrivalTime.isBefore(arrivalTime)
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ class CheckOutingServiceImpl(
arrivalTime: LocalTime
) {
queryOutingAvailableTimePort.queryOutingAvailableTimeByDayOfWeek(outingDate.dayOfWeek)
?.checkAvailable(outingDate.dayOfWeek, outingTime, arrivalTime)
?: throw OutingAvailableTimeMismatchException
?.checkAvailable(outingTime, arrivalTime)
?:throw OutingAvailableTimeMismatchException
}

override fun checkOutingTypeExists(outingType: OutingType) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,6 @@ class UpdateOutingAvailableTimeUseCase(
fun execute(outingAvailableTimeId: UUID, outingTime: LocalTime, arrivalTime: LocalTime) {
val currentOutingAvailableTime = outingService.getOutingAvailableTimeById(outingAvailableTimeId)

outingService.checkOutingAvailableTimeOverlap(
dayOfWeek = currentOutingAvailableTime.dayOfWeek,
outingTime = outingTime,
arrivalTime = arrivalTime
)

val updatedOutingAvailableTime = OutingAvailableTime(
id = outingAvailableTimeId,
schoolId = currentOutingAvailableTime.schoolId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import team.aliens.dms.domain.file.spi.vo.ExcelStudentVO
import team.aliens.dms.domain.manager.dto.PointFilter
import team.aliens.dms.domain.manager.dto.Sort
import team.aliens.dms.domain.outing.spi.QueryOutingApplicationPort
import team.aliens.dms.domain.point.spi.QueryPointHistoryPort
import team.aliens.dms.domain.room.exception.RoomNotFoundException
import team.aliens.dms.domain.room.model.Room
import team.aliens.dms.domain.student.exception.StudentNotFoundException
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package team.aliens.dms.domain.volunteer.dto.request

data class CreateVolunteerRequest(
val name: String,
val content: String,
val availableSex: String,
val availableGrade: String,
val score: Int,
val optionalScore: Int,
val maxApplicants: Int
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package team.aliens.dms.domain.volunteer.dto.request

import java.util.UUID

data class UpdateVolunteerRequest(
val name: String,
val content: String,
val availableSex: String,
val availableGrade: String,
val score: Int,
val optionalScore: Int,
val maxApplicants: Int,
val volunteerId: UUID
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package team.aliens.dms.domain.volunteer.dto.response

import java.util.UUID

data class ApplyVolunteerResponse(
val volunteerApplicationId: UUID
)
Loading

0 comments on commit 2124d56

Please sign in to comment.