-
Notifications
You must be signed in to change notification settings - Fork 0
v0.5.1 #70
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
Merged
v0.5.1 #70
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
6f9c78b
๋ณด์๊ด๋ จ ์์
rktclgh 352d26f
๋ณด์๊ด๋ จ ์์
rktclgh 1a6ce44
์ฌ์ฉ์ ์๋น์ค ๋ชจ๋ ์ถ๊ฐ
rktclgh 7f2ded5
๋ํ์ ๋ชจ๋ ๋ชจ์๊ณ ์ฌ ์ธ์
์์ธ / ๋ต์ ์ ์ถ / ๊ฐ๋จ ์ฑ์ ์ ์ฅ
rktclgh dbee9c4
[feat] ๋ํ์ ๋ชจ๋ ๋ชจ์๊ณ ์ฌ ์ต์
๊ณ ๋ํ ๋ฐ ์๋ฃ ์๊ฐ ์์ฐ ์ถ์ถ ์ถ๊ฐ
rktclgh 0ef63c5
์กฑ๋ณด ๊ธฐ๋ฅ ๊ตฌํ ์๋ฃ
rktclgh 4a5b603
์์ฝ๋ณธ ์์ฑ ๊ธฐ๋ฅ ์ถ๊ฐ
rktclgh 1906b61
์ฝ๋๋๋น ๋ฆฌ๋ทฐ ๋ฐ์
rktclgh 9711555
์ฝ๋๋๋น ๋ฆฌ๋ทฐ ๋ฐ์
rktclgh fbdc67e
์ฝ๋๋๋น ์์
rktclgh 8e80612
์ฝ๋๋๋น ์์ , ๋ํ ์กฐํ ๋ฉํ๋ฐ์ดํฐ -> api ๊ตฌ์กฐ๋ก ์์
rktclgh 2a02099
์ฝ๋๋๋น ์์
rktclgh 18b44f4
Merge pull request #69 from rktclgh/feat/v0.5
rktclgh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| [Definition] | ||
| failregex = ^<HOST> - - \[[^]]+\] "(?:GET|POST|HEAD|PUT|DELETE|OPTIONS|PATCH) [^"]+" 444 | ||
| ignoreregex = |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| [vlainter-probe] | ||
| enabled = true | ||
| filter = vlainter-probe | ||
| logpath = /var/log/nginx/probe-access.log | ||
| backend = auto | ||
| port = http,https | ||
| findtime = 600 | ||
| maxretry = 1 | ||
| bantime = 3600 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| server { | ||
| listen 80; | ||
| listen [::]:80; | ||
| server_name vlainter.online www.vlainter.online; | ||
|
|
||
| access_log /var/log/nginx/access.log; | ||
| error_log /var/log/nginx/error.log warn; | ||
|
|
||
| location /.well-known/acme-challenge/ { | ||
| root /var/www/html; | ||
| } | ||
|
|
||
| location ~* ^/(?:\.env(?:$|[./])|\.git(?:$|/)|phpmyadmin(?:$|/)|xmlrpc\.php$|wp-(?:admin|content|includes|login\.php|json)|.*phpunit.*|.*pearcmd.*|.*eval-stdin\.php.*) { | ||
| access_log /var/log/nginx/probe-access.log combined; | ||
| return 444; | ||
| } | ||
|
|
||
| location / { | ||
| return 301 https://$host$request_uri; | ||
| } | ||
| } | ||
|
|
||
| server { | ||
| listen 443 ssl http2; | ||
| listen [::]:443 ssl http2; | ||
| server_name vlainter.online www.vlainter.online; | ||
|
|
||
| access_log /var/log/nginx/access.log; | ||
| error_log /var/log/nginx/error.log warn; | ||
|
|
||
| ssl_certificate /etc/letsencrypt/live/vlainter.online/fullchain.pem; | ||
| ssl_certificate_key /etc/letsencrypt/live/vlainter.online/privkey.pem; | ||
|
|
||
| client_max_body_size 50m; | ||
|
|
||
| real_ip_header CF-Connecting-IP; | ||
| real_ip_recursive on; | ||
|
|
||
| set_real_ip_from 173.245.48.0/20; | ||
| set_real_ip_from 103.21.244.0/22; | ||
| set_real_ip_from 103.22.200.0/22; | ||
| set_real_ip_from 103.31.4.0/22; | ||
| set_real_ip_from 141.101.64.0/18; | ||
| set_real_ip_from 108.162.192.0/18; | ||
| set_real_ip_from 190.93.240.0/20; | ||
| set_real_ip_from 188.114.96.0/20; | ||
| set_real_ip_from 197.234.240.0/22; | ||
| set_real_ip_from 198.41.128.0/17; | ||
| set_real_ip_from 162.158.0.0/15; | ||
| set_real_ip_from 104.16.0.0/13; | ||
| set_real_ip_from 104.24.0.0/14; | ||
| set_real_ip_from 172.64.0.0/13; | ||
| set_real_ip_from 131.0.72.0/22; | ||
| set_real_ip_from 2400:cb00::/32; | ||
| set_real_ip_from 2606:4700::/32; | ||
| set_real_ip_from 2803:f800::/32; | ||
| set_real_ip_from 2405:b500::/32; | ||
| set_real_ip_from 2405:8100::/32; | ||
| set_real_ip_from 2a06:98c0::/29; | ||
| set_real_ip_from 2c0f:f248::/32; | ||
|
|
||
| location ~* ^/(?:\.env(?:$|[./])|\.git(?:$|/)|phpmyadmin(?:$|/)|xmlrpc\.php$|wp-(?:admin|content|includes|login\.php|json)|.*phpunit.*|.*pearcmd.*|.*eval-stdin\.php.*) { | ||
| access_log /var/log/nginx/probe-access.log combined; | ||
| return 444; | ||
| } | ||
|
|
||
| location / { | ||
| proxy_pass http://127.0.0.1:8080; | ||
| proxy_http_version 1.1; | ||
| proxy_set_header Host $host; | ||
| proxy_set_header X-Internal-Client-IP $remote_addr; | ||
| proxy_set_header CF-Connecting-IP $http_cf_connecting_ip; | ||
| proxy_set_header X-Forwarded-Proto https; | ||
| proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
| proxy_set_header X-Real-IP $remote_addr; | ||
| proxy_read_timeout 60s; | ||
| proxy_connect_timeout 5s; | ||
| proxy_send_timeout 60s; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| kotlin.incremental=false |
57 changes: 57 additions & 0 deletions
57
src/main/kotlin/com/cw/vlainter/domain/academic/controller/AcademicSearchController.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| package com.cw.vlainter.domain.academic.controller | ||
|
|
||
| import com.cw.vlainter.domain.academic.dto.DepartmentSearchItemResponse | ||
| import com.cw.vlainter.domain.academic.dto.UniversitySearchItemResponse | ||
| import com.cw.vlainter.domain.academic.service.AcademicSearchService | ||
| import jakarta.validation.constraints.Size | ||
| import org.springframework.http.HttpStatus | ||
| import org.springframework.validation.annotation.Validated | ||
| import org.springframework.web.bind.annotation.GetMapping | ||
| import org.springframework.web.bind.annotation.RequestMapping | ||
| import org.springframework.web.bind.annotation.RequestParam | ||
| import org.springframework.web.bind.annotation.RestController | ||
| import org.springframework.web.server.ResponseStatusException | ||
|
|
||
| @Validated | ||
| @RestController | ||
| @RequestMapping("/api/academics") | ||
| class AcademicSearchController( | ||
| private val academicSearchService: AcademicSearchService | ||
| ) { | ||
| @GetMapping("/universities/search") | ||
| fun searchUniversities( | ||
| @RequestParam | ||
| @Size(max = 120, message = "๋ํ๊ต ๊ฒ์์ด๋ 120์ ์ดํ์ฌ์ผ ํฉ๋๋ค.") | ||
| keyword: String | ||
| ): List<UniversitySearchItemResponse> { | ||
| return academicSearchService.searchUniversities(keyword) | ||
| } | ||
|
|
||
| @GetMapping("/departments/search") | ||
| fun searchDepartments( | ||
| @RequestParam(required = false) | ||
| universityId: String?, | ||
| @RequestParam | ||
| @Size(max = 120, message = "๋ํ๊ต ์ด๋ฆ์ 120์ ์ดํ์ฌ์ผ ํฉ๋๋ค.") | ||
| universityName: String, | ||
| @RequestParam | ||
| @Size(max = 120, message = "ํ๊ณผ ๊ฒ์์ด๋ 120์ ์ดํ์ฌ์ผ ํฉ๋๋ค.") | ||
| keyword: String | ||
| ): List<DepartmentSearchItemResponse> { | ||
| val parsedUniversityId = parseUniversityId(universityId) | ||
| return academicSearchService.searchDepartments( | ||
| universityId = parsedUniversityId, | ||
| universityName = universityName, | ||
| keyword = keyword | ||
| ) | ||
| } | ||
|
|
||
| private fun parseUniversityId(rawUniversityId: String?): Long? { | ||
| val normalized = rawUniversityId?.trim() | ||
| if (normalized.isNullOrEmpty()) return null | ||
| if (normalized.equals("null", ignoreCase = true)) return null | ||
| if (normalized.equals("undefined", ignoreCase = true)) return null | ||
| return normalized.toLongOrNull() | ||
| ?: throw ResponseStatusException(HttpStatus.BAD_REQUEST, "universityId๋ ์ซ์์ฌ์ผ ํฉ๋๋ค.") | ||
| } | ||
| } |
15 changes: 15 additions & 0 deletions
15
src/main/kotlin/com/cw/vlainter/domain/academic/dto/AcademicSearchResponses.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| package com.cw.vlainter.domain.academic.dto | ||
|
|
||
| data class UniversitySearchItemResponse( | ||
| val universityId: Long? = null, | ||
| val universityName: String, | ||
| val universityCode: String? = null | ||
| ) | ||
|
|
||
| data class DepartmentSearchItemResponse( | ||
| val departmentId: Long? = null, | ||
| val universityId: Long? = null, | ||
| val universityName: String, | ||
| val departmentName: String, | ||
| val departmentCode: String? = null | ||
| ) |
58 changes: 58 additions & 0 deletions
58
src/main/kotlin/com/cw/vlainter/domain/academic/entity/AcademicDepartment.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| @file:Suppress("JpaDataSourceORMInspection") | ||
|
|
||
| package com.cw.vlainter.domain.academic.entity | ||
|
|
||
| import jakarta.persistence.Column | ||
| import jakarta.persistence.Entity | ||
| import jakarta.persistence.FetchType | ||
| import jakarta.persistence.GeneratedValue | ||
| import jakarta.persistence.GenerationType | ||
| import jakarta.persistence.Id | ||
| import jakarta.persistence.JoinColumn | ||
| import jakarta.persistence.ManyToOne | ||
| import jakarta.persistence.PrePersist | ||
| import jakarta.persistence.PreUpdate | ||
| import jakarta.persistence.Table | ||
| import java.time.OffsetDateTime | ||
|
|
||
| @Entity | ||
| @Table(name = "academic_departments") | ||
| class AcademicDepartment( | ||
| @Id | ||
| @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
| val id: Long = 0, | ||
|
|
||
| @ManyToOne(fetch = FetchType.LAZY) | ||
| @JoinColumn(name = "university_id", nullable = false) | ||
| var university: AcademicUniversity, | ||
|
|
||
| @Column(name = "external_code", length = 60) | ||
| var externalCode: String? = null, | ||
|
|
||
| @Column(name = "name", nullable = false, length = 120) | ||
| var name: String, | ||
|
|
||
| @Column(name = "normalized_name", nullable = false, length = 160) | ||
| var normalizedName: String, | ||
|
|
||
| @Column(name = "last_synced_at") | ||
| var lastSyncedAt: OffsetDateTime? = null, | ||
|
|
||
| @Column(name = "created_at", nullable = false) | ||
| var createdAt: OffsetDateTime = OffsetDateTime.now(), | ||
|
|
||
| @Column(name = "updated_at", nullable = false) | ||
| var updatedAt: OffsetDateTime = OffsetDateTime.now() | ||
| ) { | ||
| @PrePersist | ||
| fun prePersist() { | ||
| val now = OffsetDateTime.now() | ||
| createdAt = now | ||
| updatedAt = now | ||
| } | ||
|
|
||
| @PreUpdate | ||
| fun preUpdate() { | ||
| updatedAt = OffsetDateTime.now() | ||
| } | ||
| } |
57 changes: 57 additions & 0 deletions
57
src/main/kotlin/com/cw/vlainter/domain/academic/entity/AcademicUniversity.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| @file:Suppress("JpaDataSourceORMInspection") | ||
|
|
||
| package com.cw.vlainter.domain.academic.entity | ||
|
|
||
| import jakarta.persistence.Column | ||
| import jakarta.persistence.Entity | ||
| import jakarta.persistence.GeneratedValue | ||
| import jakarta.persistence.GenerationType | ||
| import jakarta.persistence.Id | ||
| import jakarta.persistence.PrePersist | ||
| import jakarta.persistence.PreUpdate | ||
| import jakarta.persistence.Table | ||
| import jakarta.persistence.UniqueConstraint | ||
| import java.time.OffsetDateTime | ||
|
|
||
| @Entity | ||
| @Table( | ||
| name = "academic_universities", | ||
| uniqueConstraints = [ | ||
| UniqueConstraint(name = "uk_academic_universities_normalized_name", columnNames = ["normalized_name"]) | ||
| ] | ||
| ) | ||
| class AcademicUniversity( | ||
| @Id | ||
| @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
| val id: Long = 0, | ||
|
|
||
| @Column(name = "external_code", length = 60, unique = true) | ||
| var externalCode: String? = null, | ||
|
|
||
| @Column(name = "name", nullable = false, length = 120) | ||
| var name: String, | ||
|
|
||
| @Column(name = "normalized_name", nullable = false, length = 160) | ||
| var normalizedName: String, | ||
|
|
||
| @Column(name = "last_synced_at") | ||
| var lastSyncedAt: OffsetDateTime? = null, | ||
|
|
||
| @Column(name = "created_at", nullable = false) | ||
| var createdAt: OffsetDateTime = OffsetDateTime.now(), | ||
|
|
||
| @Column(name = "updated_at", nullable = false) | ||
| var updatedAt: OffsetDateTime = OffsetDateTime.now() | ||
| ) { | ||
| @PrePersist | ||
| fun prePersist() { | ||
| val now = OffsetDateTime.now() | ||
| createdAt = now | ||
| updatedAt = now | ||
| } | ||
|
|
||
| @PreUpdate | ||
| fun preUpdate() { | ||
| updatedAt = OffsetDateTime.now() | ||
| } | ||
| } |
29 changes: 29 additions & 0 deletions
29
src/main/kotlin/com/cw/vlainter/domain/academic/repository/AcademicDepartmentRepository.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| package com.cw.vlainter.domain.academic.repository | ||
|
|
||
| import com.cw.vlainter.domain.academic.entity.AcademicDepartment | ||
| import org.springframework.data.domain.Pageable | ||
| import org.springframework.data.jpa.repository.JpaRepository | ||
| import org.springframework.data.jpa.repository.Query | ||
| import org.springframework.data.repository.query.Param | ||
|
|
||
| interface AcademicDepartmentRepository : JpaRepository<AcademicDepartment, Long> { | ||
| fun findByUniversityIdAndExternalCode(universityId: Long, externalCode: String): AcademicDepartment? | ||
| fun findByUniversityIdAndNormalizedName(universityId: Long, normalizedName: String): AcademicDepartment? | ||
| fun findAllByUniversityId(universityId: Long): List<AcademicDepartment> | ||
|
|
||
| @Query( | ||
| """ | ||
| select d | ||
| from AcademicDepartment d | ||
| join fetch d.university u | ||
| where d.university.id = :universityId | ||
| and d.normalizedName like concat('%', :keyword, '%') | ||
| order by d.name asc | ||
| """ | ||
| ) | ||
| fun searchByUniversityAndKeyword( | ||
| @Param("universityId") universityId: Long, | ||
| @Param("keyword") keyword: String, | ||
| pageable: Pageable | ||
| ): List<AcademicDepartment> | ||
| } |
21 changes: 21 additions & 0 deletions
21
src/main/kotlin/com/cw/vlainter/domain/academic/repository/AcademicUniversityRepository.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| package com.cw.vlainter.domain.academic.repository | ||
|
|
||
| import com.cw.vlainter.domain.academic.entity.AcademicUniversity | ||
| import org.springframework.data.jpa.repository.JpaRepository | ||
| import org.springframework.data.jpa.repository.Query | ||
| import org.springframework.data.repository.query.Param | ||
|
|
||
| interface AcademicUniversityRepository : JpaRepository<AcademicUniversity, Long> { | ||
| fun findByExternalCode(externalCode: String): AcademicUniversity? | ||
| fun findByNormalizedName(normalizedName: String): AcademicUniversity? | ||
|
|
||
| @Query( | ||
| """ | ||
| select u | ||
| from AcademicUniversity u | ||
| where u.normalizedName like concat('%', :keyword, '%') | ||
| order by u.name asc | ||
| """ | ||
| ) | ||
| fun searchByKeyword(@Param("keyword") keyword: String): List<AcademicUniversity> | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ํ์ฌ
maxretry = 1๋ก ์ค์ ๋์ด ์์ด ๋จ ํ ๋ฒ์ 444 ์๋ต์ผ๋ก๋ IP๊ฐ ์ฐจ๋จ๋ฉ๋๋ค. ์ด๋ ํ๋ก๋ธ ๊ณต๊ฒฉ์ ๋น ๋ฅด๊ฒ ์ฐจ๋จํ๋ ๋ฐ ํจ๊ณผ์ ์ผ ์ ์์ง๋ง, ์๋์น ์์ ์ ์์ ์ธ ์์ฒญ์ด 444๋ฅผ ๋ฐํํ๋ ๊ฒฝ์ฐ์๋ ์ฆ์ ์ฐจ๋จ๋ ์ ์์ต๋๋ค. ์คํ(false positive) ๊ฐ๋ฅ์ฑ์ ์ค์ด๊ธฐ ์ํดmaxretry๊ฐ์ 2 ๋๋ 3์ผ๋ก ๋๋ฆฌ๋ ๊ฒ์ ๊ณ ๋ คํด ๋ณผ ์ ์์ต๋๋ค. ์ด๋ ๊ฒ ํด๋ ์ฌ์ ํ ๊ณต๊ฒฉ์ ์ธ ํ๋ก๋ธ๋ ํจ๊ณผ์ ์ผ๋ก ์ฐจ๋จ๋ ๊ฒ์ ๋๋ค.