diff --git a/dutypark_secret b/dutypark_secret index fd28022c..30909bfc 160000 --- a/dutypark_secret +++ b/dutypark_secret @@ -1 +1 @@ -Subproject commit fd28022cf9dcfc39856ea8e71d90eee2c6081506 +Subproject commit 30909bfca9bc135adfe7527a50c2a28de78b02e5 diff --git a/src/main/kotlin/com/tistory/shanepark/dutypark/common/advice/ViewExceptionControllerAdvice.kt b/src/main/kotlin/com/tistory/shanepark/dutypark/common/advice/ViewExceptionControllerAdvice.kt index 9e07d082..77054b56 100644 --- a/src/main/kotlin/com/tistory/shanepark/dutypark/common/advice/ViewExceptionControllerAdvice.kt +++ b/src/main/kotlin/com/tistory/shanepark/dutypark/common/advice/ViewExceptionControllerAdvice.kt @@ -2,6 +2,7 @@ package com.tistory.shanepark.dutypark.common.advice import com.tistory.shanepark.dutypark.common.exceptions.DutyparkAuthException import jakarta.servlet.http.HttpServletRequest +import org.slf4j.LoggerFactory import org.springframework.core.Ordered import org.springframework.core.annotation.Order import org.springframework.stereotype.Controller @@ -13,7 +14,7 @@ import java.net.URLEncoder @ControllerAdvice(annotations = [Controller::class]) @Order(Ordered.HIGHEST_PRECEDENCE) class ViewExceptionControllerAdvice { - val log: org.slf4j.Logger = org.slf4j.LoggerFactory.getLogger(this.javaClass) + val log: org.slf4j.Logger = LoggerFactory.getLogger(this.javaClass) @ExceptionHandler fun notAuthorizedHandler(e: DutyparkAuthException, request: HttpServletRequest): ModelAndView { diff --git a/src/main/kotlin/com/tistory/shanepark/dutypark/common/config/LogbackConfig.kt b/src/main/kotlin/com/tistory/shanepark/dutypark/common/config/LogbackConfig.kt new file mode 100644 index 00000000..4d045c46 --- /dev/null +++ b/src/main/kotlin/com/tistory/shanepark/dutypark/common/config/LogbackConfig.kt @@ -0,0 +1,57 @@ +package com.tistory.shanepark.dutypark.common.config + +import ch.qos.logback.classic.Level +import ch.qos.logback.classic.LoggerContext +import ch.qos.logback.classic.encoder.PatternLayoutEncoder +import ch.qos.logback.classic.spi.ILoggingEvent +import ch.qos.logback.core.rolling.RollingFileAppender +import ch.qos.logback.core.rolling.TimeBasedRollingPolicy +import jakarta.annotation.PostConstruct +import org.slf4j.Logger +import org.slf4j.LoggerFactory +import org.springframework.beans.factory.annotation.Value +import org.springframework.context.annotation.Configuration + +@Configuration +class LogbackConfig { + + @Value("\${dutypark.log.path}") + private lateinit var logPath: String + + val log: Logger = LoggerFactory.getLogger(LogbackConfig::class.java) + + @PostConstruct + fun configureLogging() { + val loggerContext = LoggerFactory.getILoggerFactory() as LoggerContext + + val encoder = PatternLayoutEncoder().apply { + context = loggerContext + pattern = "%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n" + start() + } + + val fileAppender = RollingFileAppender().apply { + context = loggerContext + name = "FILE" + this.encoder = encoder + isAppend = true + } + + val rollingPolicy = TimeBasedRollingPolicy().apply { + context = loggerContext + fileNamePattern = "${logPath}/dutypark-%d{yyyy-MM-dd}.log" + maxHistory = 365 + setParent(fileAppender) + start() + } + + fileAppender.rollingPolicy = rollingPolicy + fileAppender.start() + + val rootLogger = loggerContext.getLogger("ROOT") + rootLogger.level = Level.INFO + rootLogger.addAppender(fileAppender) + + log.info("log file path: $logPath") + } +} diff --git a/src/main/kotlin/com/tistory/shanepark/dutypark/common/slack/SlackApiConfiguration.kt b/src/main/kotlin/com/tistory/shanepark/dutypark/common/slack/SlackApiConfiguration.kt index 5f4a63ba..266e7c9a 100644 --- a/src/main/kotlin/com/tistory/shanepark/dutypark/common/slack/SlackApiConfiguration.kt +++ b/src/main/kotlin/com/tistory/shanepark/dutypark/common/slack/SlackApiConfiguration.kt @@ -6,6 +6,7 @@ import com.tistory.shanepark.dutypark.common.slack.notifier.SlackNotifierSender import net.gpedro.integrations.slack.SlackApi import net.gpedro.integrations.slack.SlackMessage import org.slf4j.Logger +import org.slf4j.LoggerFactory import org.springframework.beans.factory.annotation.Value import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration @@ -19,7 +20,7 @@ class SlackApiConfiguration( val slackToken: String ) { - private val log: Logger = org.slf4j.LoggerFactory.getLogger(this.javaClass) + private val log: Logger = LoggerFactory.getLogger(this.javaClass) @Bean("slackTaskExecutor") fun threadPoolTaskExecutor(): TaskExecutor { diff --git a/src/main/kotlin/com/tistory/shanepark/dutypark/common/slack/advice/ErrorDetectAdvisor.kt b/src/main/kotlin/com/tistory/shanepark/dutypark/common/slack/advice/ErrorDetectAdvisor.kt index e4a5aa67..f51c1188 100644 --- a/src/main/kotlin/com/tistory/shanepark/dutypark/common/slack/advice/ErrorDetectAdvisor.kt +++ b/src/main/kotlin/com/tistory/shanepark/dutypark/common/slack/advice/ErrorDetectAdvisor.kt @@ -8,6 +8,7 @@ import net.gpedro.integrations.slack.SlackMessage import org.apache.catalina.connector.ClientAbortException import org.apache.coyote.CloseNowException import org.slf4j.Logger +import org.slf4j.LoggerFactory import org.springframework.http.ResponseEntity import org.springframework.web.HttpRequestMethodNotSupportedException import org.springframework.web.bind.annotation.ControllerAdvice @@ -21,7 +22,7 @@ import java.util.* class ErrorDetectAdvisor( private val slackNotifier: SlackNotifier, ) { - val log: Logger = org.slf4j.LoggerFactory.getLogger(this.javaClass) + val log: Logger = LoggerFactory.getLogger(this.javaClass) @ExceptionHandler(HttpRequestMethodNotSupportedException::class) @ResponseBody diff --git a/src/main/kotlin/com/tistory/shanepark/dutypark/common/slack/notifier/SlackNotifierLogger.kt b/src/main/kotlin/com/tistory/shanepark/dutypark/common/slack/notifier/SlackNotifierLogger.kt index 14089be1..679aec87 100644 --- a/src/main/kotlin/com/tistory/shanepark/dutypark/common/slack/notifier/SlackNotifierLogger.kt +++ b/src/main/kotlin/com/tistory/shanepark/dutypark/common/slack/notifier/SlackNotifierLogger.kt @@ -1,10 +1,11 @@ package com.tistory.shanepark.dutypark.common.slack.notifier import net.gpedro.integrations.slack.SlackMessage +import org.slf4j.LoggerFactory class SlackNotifierLogger : SlackNotifier { - private val log: org.slf4j.Logger = org.slf4j.LoggerFactory.getLogger(this.javaClass) + private val log: org.slf4j.Logger = LoggerFactory.getLogger(this.javaClass) override fun call(slackMessage: SlackMessage) { log.info("SlackNotifierLogger: $slackMessage") diff --git a/src/main/kotlin/com/tistory/shanepark/dutypark/department/controller/DepartmentAdminController.kt b/src/main/kotlin/com/tistory/shanepark/dutypark/department/controller/DepartmentAdminController.kt index 07ac2599..964848db 100644 --- a/src/main/kotlin/com/tistory/shanepark/dutypark/department/controller/DepartmentAdminController.kt +++ b/src/main/kotlin/com/tistory/shanepark/dutypark/department/controller/DepartmentAdminController.kt @@ -1,6 +1,7 @@ package com.tistory.shanepark.dutypark.department.controller import com.tistory.shanepark.dutypark.common.domain.dto.PageResponse +import com.tistory.shanepark.dutypark.common.exceptions.DutyparkAuthException import com.tistory.shanepark.dutypark.dashboard.domain.DashboardDepartment import com.tistory.shanepark.dutypark.department.domain.dto.DepartmentCreateDto import com.tistory.shanepark.dutypark.department.domain.dto.DepartmentDto @@ -13,8 +14,12 @@ import com.tistory.shanepark.dutypark.duty.batch.domain.DutyBatchTeamResult import com.tistory.shanepark.dutypark.duty.batch.domain.DutyBatchTemplate import com.tistory.shanepark.dutypark.duty.batch.exceptions.DutyBatchException import com.tistory.shanepark.dutypark.duty.batch.service.DutyBatchService +import com.tistory.shanepark.dutypark.member.domain.annotation.Login import com.tistory.shanepark.dutypark.member.repository.MemberRepository +import com.tistory.shanepark.dutypark.security.domain.dto.LoginMember import jakarta.validation.Valid +import org.slf4j.Logger +import org.slf4j.LoggerFactory import org.springframework.context.ApplicationContext import org.springframework.data.domain.Pageable import org.springframework.data.web.PageableDefault @@ -32,6 +37,8 @@ class DepartmentAdminController( private val applicationContext: ApplicationContext, ) { + val log: Logger = LoggerFactory.getLogger(DepartmentAdminController::class.java) + @GetMapping fun findAll(@PageableDefault(page = 0, size = 10) page: Pageable): PageResponse { val result = departmentService.findAllWithMemberCount(page) @@ -90,22 +97,27 @@ class DepartmentAdminController( @PostMapping("/{id}/duty") fun uploadBatchTemplate( + @Login loginMember: LoginMember, @PathVariable id: Long, @RequestParam(name = "file") file: MultipartFile, @RequestParam(name = "year") year: Int, @RequestParam(name = "month") month: Int ): DutyBatchTeamResult { + if (!loginMember.isAdmin) { + throw DutyparkAuthException("$loginMember is not admin") + } val department = departmentRepository.findById(id).orElseThrow() val batchTemplate = department.dutyBatchTemplate ?: throw IllegalArgumentException("templateName is required") val dutyBatchService = applicationContext.getBean(batchTemplate.batchServiceClass) as DutyBatchService - try { - return dutyBatchService.batchUploadDepartment( + return try { + log.info("batch duty upload by $loginMember for department ${department.name}(${department.id}) year=$year, month=$month") + dutyBatchService.batchUploadDepartment( departmentId = id, file = file, yearMonth = YearMonth.of(year, month) ) } catch (e: DutyBatchException) { - return DutyBatchTeamResult.fail(e.message ?: "알 수 없는 원인으로 시간표 업로드 실패.") + DutyBatchTeamResult.fail(e.message ?: "알 수 없는 원인으로 시간표 업로드 실패.") } } diff --git a/src/main/kotlin/com/tistory/shanepark/dutypark/duty/controller/DutyBatchController.kt b/src/main/kotlin/com/tistory/shanepark/dutypark/duty/controller/DutyBatchController.kt index 74dd8c35..cec60f29 100644 --- a/src/main/kotlin/com/tistory/shanepark/dutypark/duty/controller/DutyBatchController.kt +++ b/src/main/kotlin/com/tistory/shanepark/dutypark/duty/controller/DutyBatchController.kt @@ -11,6 +11,7 @@ import com.tistory.shanepark.dutypark.member.domain.annotation.Login import com.tistory.shanepark.dutypark.member.service.MemberService import com.tistory.shanepark.dutypark.security.domain.dto.LoginMember import org.slf4j.Logger +import org.slf4j.LoggerFactory import org.springframework.context.ApplicationContext import org.springframework.web.bind.annotation.* import org.springframework.web.multipart.MultipartFile @@ -23,7 +24,7 @@ class DutyBatchController( private val memberService: MemberService, private val applicationContext: ApplicationContext, ) { - val log: Logger = org.slf4j.LoggerFactory.getLogger(DutyBatchController::class.java) + val log: Logger = LoggerFactory.getLogger(DutyBatchController::class.java) @GetMapping("/templates") fun getTemplates( @@ -48,6 +49,7 @@ class DutyBatchController( val dutyBatchService = applicationContext.getBean(dutyBatchTemplate.batchServiceClass) as DutyBatchService return try { + log.info("batch duty upload by $loginMember for member $memberId. year=$year, month=$month") dutyBatchService.batchUploadMember(memberId = memberId, file = file, yearMonth = YearMonth.of(year, month)) } catch (e: DutyBatchException) { DutyBatchResult.fail(e.batchErrorMessage) diff --git a/src/main/kotlin/com/tistory/shanepark/dutypark/duty/controller/DutyController.kt b/src/main/kotlin/com/tistory/shanepark/dutypark/duty/controller/DutyController.kt index 7ccdb482..f1c2f404 100644 --- a/src/main/kotlin/com/tistory/shanepark/dutypark/duty/controller/DutyController.kt +++ b/src/main/kotlin/com/tistory/shanepark/dutypark/duty/controller/DutyController.kt @@ -8,6 +8,7 @@ import com.tistory.shanepark.dutypark.duty.service.DutyService import com.tistory.shanepark.dutypark.member.domain.annotation.Login import com.tistory.shanepark.dutypark.security.domain.dto.LoginMember import org.slf4j.Logger +import org.slf4j.LoggerFactory import org.springframework.http.ResponseEntity import org.springframework.web.bind.annotation.* import java.time.YearMonth @@ -17,7 +18,7 @@ import java.time.YearMonth class DutyController( private val dutyService: DutyService, ) { - val log: Logger = org.slf4j.LoggerFactory.getLogger(DutyController::class.java) + val log: Logger = LoggerFactory.getLogger(DutyController::class.java) @GetMapping fun getDuties( @@ -40,6 +41,7 @@ class DutyController( ): ResponseEntity { checkAuthentication(loginMember, dutyUpdateDto.memberId) dutyService.update(dutyUpdateDto) + log.info("$loginMember update duty: $dutyUpdateDto") return ResponseEntity.ok(true) } @@ -50,6 +52,7 @@ class DutyController( ): ResponseEntity { checkAuthentication(loginMember, dutyBatchUpdateDto.memberId) dutyService.update(dutyBatchUpdateDto) + log.info("$loginMember update duty batch: $dutyBatchUpdateDto") return ResponseEntity.ok(true) } diff --git a/src/main/kotlin/com/tistory/shanepark/dutypark/duty/controller/DutyViewController.kt b/src/main/kotlin/com/tistory/shanepark/dutypark/duty/controller/DutyViewController.kt index e5ee23a1..5a7aefc9 100644 --- a/src/main/kotlin/com/tistory/shanepark/dutypark/duty/controller/DutyViewController.kt +++ b/src/main/kotlin/com/tistory/shanepark/dutypark/duty/controller/DutyViewController.kt @@ -6,6 +6,7 @@ import com.tistory.shanepark.dutypark.member.service.FriendService import com.tistory.shanepark.dutypark.member.service.MemberService import com.tistory.shanepark.dutypark.security.domain.dto.LoginMember import org.slf4j.Logger +import org.slf4j.LoggerFactory import org.springframework.stereotype.Controller import org.springframework.ui.Model import org.springframework.web.bind.annotation.GetMapping @@ -18,7 +19,7 @@ class DutyViewController( val memberService: MemberService, val friendService: FriendService, ) : ViewController() { - val log: Logger = org.slf4j.LoggerFactory.getLogger(this.javaClass) + val log: Logger = LoggerFactory.getLogger(this.javaClass) @GetMapping("/duty/{id}") fun retrieveMemberDuty( diff --git a/src/main/kotlin/com/tistory/shanepark/dutypark/member/controller/DDayController.kt b/src/main/kotlin/com/tistory/shanepark/dutypark/member/controller/DDayController.kt index fe48c6e5..02e2a567 100644 --- a/src/main/kotlin/com/tistory/shanepark/dutypark/member/controller/DDayController.kt +++ b/src/main/kotlin/com/tistory/shanepark/dutypark/member/controller/DDayController.kt @@ -6,6 +6,7 @@ import com.tistory.shanepark.dutypark.member.domain.dto.DDaySaveDto import com.tistory.shanepark.dutypark.member.service.DDayService import com.tistory.shanepark.dutypark.security.domain.dto.LoginMember import jakarta.validation.Valid +import org.slf4j.LoggerFactory import org.springframework.http.HttpStatus import org.springframework.http.ResponseEntity import org.springframework.web.bind.annotation.* @@ -15,7 +16,7 @@ import org.springframework.web.bind.annotation.* class DDayController( private val dDayService: DDayService ) { - private val log: org.slf4j.Logger = org.slf4j.LoggerFactory.getLogger(this.javaClass) + private val log = LoggerFactory.getLogger(this.javaClass) @PostMapping @SlackNotification diff --git a/src/main/kotlin/com/tistory/shanepark/dutypark/member/service/DDayService.kt b/src/main/kotlin/com/tistory/shanepark/dutypark/member/service/DDayService.kt index b125ec8d..2688b827 100644 --- a/src/main/kotlin/com/tistory/shanepark/dutypark/member/service/DDayService.kt +++ b/src/main/kotlin/com/tistory/shanepark/dutypark/member/service/DDayService.kt @@ -7,6 +7,8 @@ import com.tistory.shanepark.dutypark.member.domain.entity.DDayEvent import com.tistory.shanepark.dutypark.member.repository.DDayRepository import com.tistory.shanepark.dutypark.member.repository.MemberRepository import com.tistory.shanepark.dutypark.security.domain.dto.LoginMember +import org.slf4j.Logger +import org.slf4j.LoggerFactory import org.springframework.stereotype.Service import org.springframework.transaction.annotation.Transactional import java.time.LocalDate @@ -18,7 +20,7 @@ class DDayService( private val dDayRepository: DDayRepository ) { - val log: org.slf4j.Logger = org.slf4j.LoggerFactory.getLogger(this.javaClass) + val log: Logger = LoggerFactory.getLogger(this.javaClass) fun createDDay(loginMember: LoginMember, dDaySaveDto: DDaySaveDto): DDayEvent { val member = memberRepository.findById(loginMember.id).orElseThrow() diff --git a/src/main/kotlin/com/tistory/shanepark/dutypark/member/service/RefreshTokenService.kt b/src/main/kotlin/com/tistory/shanepark/dutypark/member/service/RefreshTokenService.kt index 8f71990b..fa53ebe9 100644 --- a/src/main/kotlin/com/tistory/shanepark/dutypark/member/service/RefreshTokenService.kt +++ b/src/main/kotlin/com/tistory/shanepark/dutypark/member/service/RefreshTokenService.kt @@ -9,6 +9,7 @@ import com.tistory.shanepark.dutypark.security.domain.dto.LoginMember import com.tistory.shanepark.dutypark.security.domain.dto.RefreshTokenDto import com.tistory.shanepark.dutypark.security.domain.entity.RefreshToken import org.slf4j.Logger +import org.slf4j.LoggerFactory import org.springframework.scheduling.annotation.Scheduled import org.springframework.stereotype.Service import java.time.LocalDateTime @@ -19,7 +20,7 @@ class RefreshTokenService( private val refreshTokenRepository: RefreshTokenRepository, private val jwtConfig: JwtConfig, ) { - private val log: Logger = org.slf4j.LoggerFactory.getLogger(this.javaClass) + private val log: Logger = LoggerFactory.getLogger(this.javaClass) @Scheduled(cron = "0 0 0 * * *") fun revokeExpiredRefreshTokens() { @@ -39,7 +40,7 @@ class RefreshTokenService( fun deleteRefreshToken(loginMember: LoginMember, id: Long) { val refreshToken = refreshTokenRepository.findById(id).orElseThrow() if (!loginMember.isAdmin && refreshToken.member.id != loginMember.id) { - log.warn("No authority to delete refresh token. loginMemberId:${loginMember.id}, refreshTokenId:$id") + log.warn("No authority to delete refresh token. loginMemberId:$loginMember, refreshTokenId:$id") throw DutyparkAuthException("No authority to delete refresh token.") } refreshTokenRepository.delete(refreshToken) diff --git a/src/main/kotlin/com/tistory/shanepark/dutypark/schedule/service/ScheduleService.kt b/src/main/kotlin/com/tistory/shanepark/dutypark/schedule/service/ScheduleService.kt index b2b8454e..30aa0778 100644 --- a/src/main/kotlin/com/tistory/shanepark/dutypark/schedule/service/ScheduleService.kt +++ b/src/main/kotlin/com/tistory/shanepark/dutypark/schedule/service/ScheduleService.kt @@ -12,6 +12,7 @@ import com.tistory.shanepark.dutypark.schedule.domain.enums.ParsingTimeStatus import com.tistory.shanepark.dutypark.schedule.repository.ScheduleRepository import com.tistory.shanepark.dutypark.schedule.timeparsing.service.ScheduleTimeParsingQueueManager import com.tistory.shanepark.dutypark.security.domain.dto.LoginMember +import org.slf4j.LoggerFactory import org.springframework.stereotype.Service import org.springframework.transaction.annotation.Transactional import java.time.LocalDateTime @@ -26,7 +27,7 @@ class ScheduleService( private val friendService: FriendService, private val scheduleTimeParsingQueueManager: ScheduleTimeParsingQueueManager, ) { - private val log = org.slf4j.LoggerFactory.getLogger(this.javaClass) + private val log = LoggerFactory.getLogger(this.javaClass) @Transactional(readOnly = true) fun findSchedulesByYearAndMonth( diff --git a/src/main/kotlin/com/tistory/shanepark/dutypark/schedule/timeparsing/service/ScheduleTimeParsingService.kt b/src/main/kotlin/com/tistory/shanepark/dutypark/schedule/timeparsing/service/ScheduleTimeParsingService.kt index 76cc2a50..fe280f9f 100644 --- a/src/main/kotlin/com/tistory/shanepark/dutypark/schedule/timeparsing/service/ScheduleTimeParsingService.kt +++ b/src/main/kotlin/com/tistory/shanepark/dutypark/schedule/timeparsing/service/ScheduleTimeParsingService.kt @@ -4,6 +4,8 @@ import com.fasterxml.jackson.core.JsonProcessingException import com.fasterxml.jackson.databind.ObjectMapper import com.tistory.shanepark.dutypark.schedule.timeparsing.domain.ScheduleTimeParsingRequest import com.tistory.shanepark.dutypark.schedule.timeparsing.domain.ScheduleTimeParsingResponse +import org.slf4j.Logger +import org.slf4j.LoggerFactory import org.springframework.ai.chat.client.ChatClient import org.springframework.ai.chat.model.ChatModel import org.springframework.stereotype.Service @@ -14,7 +16,7 @@ class ScheduleTimeParsingService( private val objectMapper: ObjectMapper, ) { private val chatClient = ChatClient.builder(chatModel).build() - private val log: org.slf4j.Logger = org.slf4j.LoggerFactory.getLogger(ScheduleTimeParsingService::class.java) + private val log: Logger = LoggerFactory.getLogger(ScheduleTimeParsingService::class.java) fun parseScheduleTime(request: ScheduleTimeParsingRequest): ScheduleTimeParsingResponse { val prompt = generatePrompt(request) diff --git a/src/main/kotlin/com/tistory/shanepark/dutypark/security/controller/AuthController.kt b/src/main/kotlin/com/tistory/shanepark/dutypark/security/controller/AuthController.kt index 342d643d..0df26a49 100644 --- a/src/main/kotlin/com/tistory/shanepark/dutypark/security/controller/AuthController.kt +++ b/src/main/kotlin/com/tistory/shanepark/dutypark/security/controller/AuthController.kt @@ -7,6 +7,7 @@ import com.tistory.shanepark.dutypark.security.domain.dto.LoginMember import com.tistory.shanepark.dutypark.security.domain.dto.PasswordChangeDto import com.tistory.shanepark.dutypark.security.service.AuthService import jakarta.servlet.http.HttpServletRequest +import org.slf4j.LoggerFactory import org.springframework.http.ResponseEntity import org.springframework.ui.Model import org.springframework.web.bind.annotation.* @@ -16,7 +17,7 @@ import org.springframework.web.bind.annotation.* class AuthController( private val authService: AuthService, ) { - private val log = org.slf4j.LoggerFactory.getLogger(AuthController::class.java) + private val log = LoggerFactory.getLogger(AuthController::class.java) @PostMapping("login") fun login( diff --git a/src/main/kotlin/com/tistory/shanepark/dutypark/security/domain/dto/LoginMember.kt b/src/main/kotlin/com/tistory/shanepark/dutypark/security/domain/dto/LoginMember.kt index 712fe8d3..b991ac82 100644 --- a/src/main/kotlin/com/tistory/shanepark/dutypark/security/domain/dto/LoginMember.kt +++ b/src/main/kotlin/com/tistory/shanepark/dutypark/security/domain/dto/LoginMember.kt @@ -12,4 +12,9 @@ data class LoginMember( const val ATTR_NAME: String = "loginMember" } + override fun toString(): String { + return "${name}(${id})" + } + + } diff --git a/src/main/kotlin/com/tistory/shanepark/dutypark/security/service/JwtProvider.kt b/src/main/kotlin/com/tistory/shanepark/dutypark/security/service/JwtProvider.kt index 315eb3f3..2a295ade 100644 --- a/src/main/kotlin/com/tistory/shanepark/dutypark/security/service/JwtProvider.kt +++ b/src/main/kotlin/com/tistory/shanepark/dutypark/security/service/JwtProvider.kt @@ -9,6 +9,8 @@ import io.jsonwebtoken.* import io.jsonwebtoken.io.Decoders import io.jsonwebtoken.security.Keys import io.jsonwebtoken.security.SecurityException +import org.slf4j.Logger +import org.slf4j.LoggerFactory import org.springframework.stereotype.Component import java.security.Key import java.util.* @@ -20,7 +22,7 @@ class JwtProvider( ) { private val key: Key = Keys.hmacShaKeyFor(Decoders.BASE64.decode(jwtConfig.secret)) private val tokenValidityInMilliseconds: Long = 1000L * jwtConfig.tokenValidityInSeconds - private val log: org.slf4j.Logger = org.slf4j.LoggerFactory.getLogger(JwtProvider::class.java) + private val log: Logger = LoggerFactory.getLogger(JwtProvider::class.java) fun createToken(member: Member): String { diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index a0064628..a5739f47 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -51,7 +51,7 @@ management: include: "health, metrics, prometheus, shutdown" endpoint: shutdown: - enabled: true + access: unrestricted jwt: secret: "WvQiOAms2XFyW/UnmfO/9xL24ch4IlfUikP9QohMuso=" # Change it on production @@ -70,6 +70,7 @@ dutypark: minimum-interval: 60 data-go-kr: service-key: "DECODED_SERVICE_KEY_HERE" + log.path: "/tmp/logs" oauth: kakao: diff --git a/src/main/resources/static/css/base.css b/src/main/resources/static/css/base.css index 88d4fea9..b7ab352c 100644 --- a/src/main/resources/static/css/base.css +++ b/src/main/resources/static/css/base.css @@ -22,6 +22,7 @@ color: white; font-size: 1.4em; width: 100%; + z-index: 9999; } #footer .footer-dock { @@ -588,9 +589,6 @@ a.homeButton:hover { } #add-todo-btn { - font-size: 1.2rem; - margin: 0; - cursor: pointer; width: 9rem; border-right: 1px solid #dee2e6; background-color: #22c55e; diff --git a/src/main/resources/static/css/mquery.css b/src/main/resources/static/css/mquery.css index c1144f15..acdcc6cc 100644 --- a/src/main/resources/static/css/mquery.css +++ b/src/main/resources/static/css/mquery.css @@ -4,10 +4,6 @@ font-size: calc(1.375rem + 1.5vw); } - .calendar { - margin: 0 10px; - } - header h1 { font-size: 2em; } @@ -24,6 +20,16 @@ font-size: 1.2em; } + .calendar .schedules { + font-size: 1.2em; + } + + .calendar .duty-table-header, + .calendar .duty-table-header span, + .calendar .duty-table-header button { + font-size: 1.3em; + } + .todo-container { font-size: 1.5em; } diff --git a/src/main/resources/static/js/common.js b/src/main/resources/static/js/common.js index db723956..5119e9e0 100644 --- a/src/main/resources/static/js/common.js +++ b/src/main/resources/static/js/common.js @@ -1,24 +1,55 @@ const isEndsWithLastConsonantLetter = function (text) { - const strGa = 44032; // 가 - const strHih = 55203; // 힣 - const lastStrCode = text.charCodeAt(text.length - 1); + const strGa = 44032; // 가 + const strHih = 55203; // 힣 + const lastStrCode = text.charCodeAt(text.length - 1); - if (lastStrCode < strGa || lastStrCode > strHih) { - return false; // if it's not Korean, return false - } - return ((lastStrCode - strGa) % 28 === 0) + if (lastStrCode < strGa || lastStrCode > strHih) { + return false; // if it's not Korean, return false + } + return ((lastStrCode - strGa) % 28 === 0) } const roChecker = function (text) { - return isEndsWithLastConsonantLetter(text) ? '로' : '으로'; + return isEndsWithLastConsonantLetter(text) ? '로' : '으로'; } const rulChecker = function (text) { - return isEndsWithLastConsonantLetter(text) ? '를' : '을'; + return isEndsWithLastConsonantLetter(text) ? '를' : '을'; } function toLocalISOString(date) { - const offsetInMs = date.getTimezoneOffset() * 60000; - const localDate = new Date(date - offsetInMs); - return localDate.toISOString().slice(0, -1); + const offsetInMs = date.getTimezoneOffset() * 60000; + const localDate = new Date(date - offsetInMs); + return localDate.toISOString().slice(0, -1); } + +const vueFilters = { + formatDate(value) { + if (value && value.length > 10) { + return value.substring(0, 10); + } + return value; + }, + + formatDateTime(value) { + if (value && value.length > 19) { + return value.substring(0, 19); + } + return value; + }, + + fromNow(value) { + if (typeof dayjs !== "undefined") { + return dayjs(value).fromNow(); + } + return value; + } +}; + +document.addEventListener("DOMContentLoaded", function () { + if (typeof Vue !== "undefined") { + Object.keys(vueFilters).forEach((key) => { + Vue.filter(key, vueFilters[key]); + }); + } +}); diff --git a/src/main/resources/templates/admin/admin-home.html b/src/main/resources/templates/admin/admin-home.html index 73e8b851..32721d69 100644 --- a/src/main/resources/templates/admin/admin-home.html +++ b/src/main/resources/templates/admin/admin-home.html @@ -1,163 +1,149 @@

Active Refresh Tokens

-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- {{ member.name }} - - -
Last activeIpDeviceBrowser
{{ index+1 }}{{ token.lastUsed | fromNow }}{{ token.remoteAddr}}{{ token.userAgent ? token.userAgent.device : '' }}{{ token.userAgent ? token.userAgent.browser : '' }}
-
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ {{ member.name }} + + +
Last activeIpDeviceBrowser
{{ index+1 }}{{ token.lastUsed | fromNow }}{{ token.remoteAddr}}{{ token.userAgent ? token.userAgent.device : '' }}{{ token.userAgent ? token.userAgent.browser : '' }}
+
diff --git a/src/main/resources/templates/dashboard.html b/src/main/resources/templates/dashboard.html index 8f32d36a..15fcdef5 100644 --- a/src/main/resources/templates/dashboard.html +++ b/src/main/resources/templates/dashboard.html @@ -50,7 +50,7 @@

주요 기능

내 시간표 + @click="moveTo()" v-text="myInfo.member.name">
@@ -232,12 +232,12 @@
오늘 일정
관리자
- @@ -324,325 +324,325 @@
오늘 일정
diff --git a/src/main/resources/templates/duty/duty.html b/src/main/resources/templates/duty/duty.html index 39692143..0b2fae5f 100644 --- a/src/main/resources/templates/duty/duty.html +++ b/src/main/resources/templates/duty/duty.html @@ -7,8 +7,8 @@
-
- 할일 + +
+
@@ -22,7 +22,7 @@
-
+
-
@@ -207,35 +202,6 @@

어느 부서에도 소속되어 있지 않습니다.

- -