Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🔀 :: (XQUARE-14)14 use user repository #15

Merged
merged 7 commits into from
Mar 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
root = true

[*]
charset = utf-8
end_of_line = lf
indent_style = space
indent_size = 4
insert_final_newline = true
max_line_length = 120
tab_width = 4
ktlint_disabled_rules = no-wildcard-imports,import-ordering,comment-spacing
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ plugins {
id("io.spring.dependency-management") version "1.0.15.RELEASE"
kotlin("jvm") version "1.6.21"
kotlin("plugin.spring") version "1.6.21"
id("org.jlleitschuh.gradle.ktlint") version "11.5.1"
kotlin("plugin.jpa") version "1.6.21"
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ import org.springframework.boot.runApplication
class XquareBackofficeApplication

fun main(args: Array<String>) {
runApplication<XquareBackofficeApplication>(*args)
runApplication<XquareBackofficeApplication>(*args)
}
34 changes: 17 additions & 17 deletions src/main/kotlin/com/xaquare/xquarebackoffice/domain/entity/User.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,27 @@ import javax.persistence.Column
import javax.persistence.Entity

@Entity
class User (
id: UUID? = null,
class User(
id: UUID? = null,

@Column(name = "name", nullable = false)
val name: String,
@Column(name = "name", nullable = false)
val name: String,

@Column(name = "account_id", nullable = false, unique = true)
val accountId: String,
@Column(name = "account_id", nullable = false, unique = true)
val accountId: String,

@Column(name = "password", nullable = false)
val password: String,
@Column(name = "password", nullable = false)
val password: String,

@Column(name = "grade", nullable = false)
val grade: Int,
@Column(name = "grade", nullable = false)
val grade: Int,

@Column(name = "class_num", nullable = false)
val classNum: Int,
@Column(name = "class_num", nullable = false)
val classNum: Int,

@Column(name = "num", nullable = false)
val num: Int,
@Column(name = "num", nullable = false)
val num: Int,

@Column(name = "profile_file")
val profile: String ? = null,
) : BaseUUIDEntity(id)
@Column(name = "profile_file")
val profile: String ? = null
) : BaseUUIDEntity(id)
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ import com.xaquare.xquarebackoffice.domain.entity.User
import java.util.UUID
import org.springframework.data.jpa.repository.JpaRepository

interface UserRepository: JpaRepository<User, UUID>
interface UserRepository : JpaRepository<User, UUID>
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,15 @@ class GlobalExceptionFilter(
}

@Throws(IOException::class)
private fun writeErrorResponse(response: HttpServletResponse, status:Int, errorResponse:
ErrorResponse) {
private fun writeErrorResponse(
response: HttpServletResponse,
status: Int,
errorResponse:
ErrorResponse
) {
response.status = status
response.contentType = "application/json"
response.characterEncoding = "UTF-8"
objectMapper.writeValue(response.writer,errorResponse)
objectMapper.writeValue(response.writer, errorResponse)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ enum class ErrorCode(
FEIGN_FORBIDDEN(403, "Feign Forbidden"),
FEIGN_SERVER_ERROR(500, "Feign Server Error"),
DATA_FORMAT_BAD_REQUEST(400, "data Format Bad Request"),

// Internal Server Error
INTERNAL_SERVER_ERROR(500, "Internal Server Error"),
DB_ACCESS_ERROR(500, "DB Access Error"),
DB_ACCESS_ERROR(500, "DB Access Error")
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package com.xaquare.xquarebackoffice.global.error.exception

abstract class XquareException(
val errorCode: ErrorCode
val errorCode: ErrorCode
) : RuntimeException()
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.xaquare.xquarebackoffice.infrastructure.excel.controller

import com.xaquare.xquarebackoffice.infrastructure.excel.service.CreateExcelSheetAsDB
import com.xaquare.xquarebackoffice.infrastructure.excel.service.CreateExcelSheetService
import com.xaquare.xquarebackoffice.infrastructure.excel.service.GetUserInfo
import com.xaquare.xquarebackoffice.infrastructure.excel.service.SaveUserInfo
import com.xaquare.xquarebackoffice.infrastructure.excel.service.GetExcelSheetService

import org.springframework.web.bind.annotation.GetMapping
Expand All @@ -10,24 +10,25 @@ import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController
import org.springframework.web.multipart.MultipartFile
import javax.servlet.http.HttpServletResponse
import org.springframework.web.bind.annotation.RequestParam

@RestController
@RequestMapping("/excel")
class ExcelController(
private val createExcelSheetService: CreateExcelSheetService,
private val saveUserInfo: SaveUserInfo,
private val getExcelSheetService: GetExcelSheetService,
private val createExcelSheetAsDB: CreateExcelSheetAsDB
private val getUserInfo: GetUserInfo
) {
@GetMapping
fun createExcelSheet(httpServletResponse: HttpServletResponse) =
createExcelSheetService.execute(httpServletResponse)
saveUserInfo.execute(httpServletResponse)

@PostMapping
fun saveExcelInfo(@RequestParam(name = "scheme")scheme: String, @RequestParam(name = "host")host: String, @RequestParam(name = "port")port: Int, @RequestParam(name = "database")database: String, @RequestParam(name = "username")username: String, @RequestParam(name = "password")password: String, file: MultipartFile) =
getExcelSheetService.execute(scheme, host, port, database, username, password, file)
fun saveExcelInfo(file: MultipartFile) =
getExcelSheetService.execute(file)

@GetMapping("/userInfo")
fun createExcelSheetAsDD(@RequestParam(name = "scheme")scheme: String, @RequestParam(name = "host")host: String, @RequestParam(name = "port")port: Int, @RequestParam(name = "database")database: String, @RequestParam(name = "username")username: String, @RequestParam(name = "password")password: String, httpServletResponse: HttpServletResponse) =
createExcelSheetAsDB.execute(scheme, host, port, database, username, password, httpServletResponse)
fun getUserInfo(httpServletResponse: HttpServletResponse) =
getUserInfo.execute(httpServletResponse)


}

This file was deleted.

This file was deleted.

Loading