Skip to content

Commit

Permalink
BAN-13 fix caching (and cors in prod) (#43)
Browse files Browse the repository at this point in the history
* REMOVE DEPRECATED CRUDS AND SORTING

* Add visibility, balance and ref structure

* Fix caching

* Private list WIP

* Add viewing private problems

* Add sortBy and ref

* Add CUD of private categories

* Ref. WIP

* Done categories. WIP making work.

* Fix Problem categories init

* Add full category source view stuff

* Add registration through API

* Add userInfo and fix seeds

* FIx cors and caching

---------

Co-authored-by: Naglis <naglis.suliokas@gmail.com>
  • Loading branch information
naglissul and Naglis authored Oct 31, 2024
1 parent 03a44ca commit 6d70d02
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions src/main/kotlin/lt/skafis/bankas/config/CorsConfigProd.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer
@Profile("prod")
class CorsConfigProd {
@Bean
fun corsConfigurer(): WebMvcConfigurer {
return object : WebMvcConfigurer {
fun corsConfigurer(): WebMvcConfigurer =
object : WebMvcConfigurer {
override fun addCorsMappings(registry: CorsRegistry) {
registry.addMapping("/**")
.allowedOrigins("https://bankas.skafis.lt")
registry
.addMapping("/**")
.allowedOrigins("https://bankas.skafis.lt", "https://www.skafis.lt")
.allowedMethods("GET", "POST", "PUT", "DELETE", "PATCH")
.allowedHeaders("*")
.allowCredentials(true)
.maxAge(3600)
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class SourceRepository(
sortBy: SortBy,
userId: String,
): List<Source> {
val cacheKey = "available:$search:$limit:$offset:$sortBy"
val cacheKey = "available:$search:$userId:$limit:$offset:$sortBy"
return availableCache.computeIfAbsent(cacheKey) {
val collectionRef = firestore.collection(collectionPath)
var documents = emptyList<Source>()
Expand Down

0 comments on commit 6d70d02

Please sign in to comment.