Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
meltapplee committed Oct 21, 2024
1 parent fdb08af commit 819a76a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ class PostController(
) =
createPostService.execute(request, image)

@Operation(summary = "댓글 삭제")
@Operation(summary = "게시글 삭제")
@DeleteMapping
@ResponseStatus(HttpStatus.NO_CONTENT)
fun delete(@RequestParam("post_id") id: Long) =
deletePostService.execute(id)

@Operation(summary = "댓글 수정")
@Operation(summary = "게시글 수정")
@PatchMapping("/modify")
fun modify(
@RequestParam("post_id") id: Long,
Expand Down
11 changes: 3 additions & 8 deletions src/main/kotlin/org/meogo/global/config/FcmConfig.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@ import com.google.firebase.FirebaseApp
import com.google.firebase.FirebaseOptions
import org.springframework.beans.factory.annotation.Value
import org.springframework.context.annotation.Configuration
import java.io.File
import java.net.URL
import java.nio.file.Files
import java.nio.file.Paths
import javax.annotation.PostConstruct

@Configuration
Expand All @@ -20,15 +17,13 @@ class FcmConfig(
fun initializeFirebaseApp() {
try {
if (FirebaseApp.getApps().isEmpty()) {
// URL에서 InputStream을 열고 FirebaseOptions를 초기화
URL(url).openStream().use { inputStream ->
Files.copy(inputStream, Paths.get(PATH))
val tempfile = File(PATH)
val options = FirebaseOptions.builder()
.setCredentials(GoogleCredentials.fromStream(tempfile.inputStream()))
// InputStream을 통해 인증 정보 설정
.setCredentials(GoogleCredentials.fromStream(inputStream))
.build()
FirebaseApp.initializeApp(options)

tempfile.delete()
}
}
} catch (e: Exception) {
Expand Down
20 changes: 8 additions & 12 deletions src/main/kotlin/org/meogo/global/feign/CareerFeignClientService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,15 @@ class CareerFeignClientService(
}

fun addToList(schoolInfoJson: CareerSchoolListResponse): List<School> {
val schoolList = mutableListOf<School>()
for (school in schoolInfoJson.dataSearch.content) {
schoolList.add(
School(
id = school.seq.toInt(),
link = school.link,
schoolGubun = school.let { it.schoolGubun }.toString(),
adres = school.adres,
schoolName = school.schoolName
)

val content = schoolInfoJson.dataSearch.content ?: return emptyList()
return content.map { school ->
School(
id = school.seq.toInt(),
link = school.link,
schoolGubun = school.let { it.schoolGubun }.toString(),
adres = school.adres,
schoolName = school.schoolName
)
}
return schoolList
}
}

0 comments on commit 819a76a

Please sign in to comment.