Skip to content

Commit 449e4c4

Browse files
Merge pull request #6 from OpenFuturePlatform/develop
Merge develop
2 parents 31ca13c + 9d48b2d commit 449e4c4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+1008
-31
lines changed

build.gradle

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ repositories {
2424
maven {
2525
url "https://maven.dcm4che.org"
2626
}
27+
jcenter()
2728
}
2829

2930
dependencies {
@@ -72,15 +73,15 @@ dependencies {
7273
// WebJars Locator
7374
implementation 'org.webjars:webjars-locator:0.46'
7475

75-
//
76+
//
7677
implementation ("org.webjars.bower:bootstrap:5.2.2")
7778
implementation ("org.webjars.bower:demo-console:1.5.1")
7879
implementation ("org.webjars.bower:draggabilly:2.1.0")
7980
implementation ("org.webjars.bower:ekko-lightbox:5.2.0")
8081
implementation ("org.webjars.bower:jquery:3.6.1")
8182
implementation ("org.webjars.bower:jsnlog.js:2.20.1")
8283
implementation ("org.webjars.bower:webrtc-adapter:7.4.0")
83-
84+
8485
implementation("org.kurento:kurento-commons:7.1.0")
8586
implementation("org.kurento:kurento-client:7.1.0")
8687
implementation("org.kurento:kurento-utils-js:7.1.0")
@@ -93,6 +94,9 @@ dependencies {
9394

9495
testImplementation 'org.testcontainers:postgresql:1.19.7'
9596

97+
implementation("org.springframework.boot:spring-boot-starter-webflux")
98+
implementation 'com.google.firebase:firebase-admin:9.2.0'
99+
96100
}
97101

98102
tasks.named('test') {

src/main/kotlin/io/openfuture/openmessenger/assistant/model/Reminder.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ data class Reminder(
1616
): BaseModel
1717

1818
data class ReminderItem(
19-
val remindAt: LocalDateTime?,
19+
val remindAt: String?,
2020
val description: String?
21-
)
21+
){
22+
23+
}

src/main/kotlin/io/openfuture/openmessenger/assistant/model/Todos.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ data class Todos(
1818
data class Todo(
1919
val executor: String?,
2020
val description: String?,
21-
val dueDate: LocalDateTime?,
21+
val dueDate: String?,
2222
val context: String?
2323
)
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
package io.openfuture.openmessenger.component.state
2+
3+
import io.openfuture.openmessenger.repository.entity.BlockchainType
4+
import io.openfuture.openmessenger.service.dto.StateWalletDto
5+
import org.springframework.http.MediaType
6+
import org.springframework.stereotype.Component
7+
import org.springframework.web.reactive.function.BodyInserters
8+
import org.springframework.web.reactive.function.client.WebClient
9+
10+
11+
@Component
12+
class DefaultStateApi(
13+
private val stateWebClient: WebClient
14+
) : StateApi {
15+
16+
override fun createWallet(
17+
address: String,
18+
webHook: String,
19+
blockchain: BlockchainType,
20+
applicationId: String
21+
): StateWalletDto? {
22+
val request = CreateStateWalletRequest(address, applicationId, blockchain.getValue(), webHook)
23+
println("State save request $request")
24+
return stateWebClient
25+
.post()
26+
.uri("http://localhost:8545/api/wallets/single")
27+
.accept(MediaType.APPLICATION_JSON)
28+
.body(BodyInserters.fromValue(request))
29+
.retrieve()
30+
.bodyToMono(StateWalletDto::class.java)
31+
.block()
32+
}
33+
34+
data class CreateStateWalletRequest(
35+
val address: String,
36+
val applicationId: String,
37+
val blockchain: String,
38+
val webhook: String
39+
)
40+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package io.openfuture.openmessenger.component.state
2+
3+
import io.openfuture.openmessenger.repository.entity.BlockchainType
4+
import io.openfuture.openmessenger.service.dto.StateWalletDto
5+
6+
interface StateApi {
7+
fun createWallet(address: String, webHook: String, blockchain: BlockchainType, applicationId: String): StateWalletDto?
8+
}

src/main/kotlin/io/openfuture/openmessenger/configuration/SecurityConfig.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package io.openfuture.openmessenger.configuration
22

33
import io.openfuture.openmessenger.security.AwsCognitoTokenFilter
44
import io.openfuture.openmessenger.security.CognitoAuthenticationProvider
5-
import jakarta.servlet.http.HttpServletRequest
65
import org.springframework.context.annotation.Bean
76
import org.springframework.context.annotation.Configuration
87
import org.springframework.security.config.Customizer
@@ -14,9 +13,6 @@ import org.springframework.security.config.annotation.web.configurers.SessionMan
1413
import org.springframework.security.config.http.SessionCreationPolicy
1514
import org.springframework.security.web.SecurityFilterChain
1615
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter
17-
import org.springframework.web.cors.CorsConfiguration
18-
import org.springframework.web.cors.CorsConfigurationSource
19-
import org.springframework.web.cors.UrlBasedCorsConfigurationSource
2016

2117
@Configuration
2218
@EnableWebSecurity
@@ -36,6 +32,8 @@ class SecurityConfig(
3632
.authorizeHttpRequests {
3733
it.requestMatchers("/api/v1/public/login").permitAll()
3834
it.requestMatchers("/api/v1/public/signup").permitAll()
35+
it.requestMatchers("/api/v1/refreshToken").permitAll()
36+
it.requestMatchers("/api/v1/wallets/webhook").permitAll()
3937
it.requestMatchers("/api/v1/attachments/download/**").permitAll()
4038
it.requestMatchers("/*").permitAll()
4139
it.requestMatchers("/webjars/**").permitAll()
@@ -52,7 +50,9 @@ class SecurityConfig(
5250
"/api/v1/public/login",
5351
"/api/v1/public/signup",
5452
"/api/v1/attachments/download/**",
55-
listOf("/*", "/webjars/**", "/js/*", "/img/*", "/css/*", "/video/*")
53+
listOf("/*", "/webjars/**", "/js/*", "/img/*", "/css/*", "/video/*"),
54+
"/api/v1/refreshToken",
55+
"/api/v1/wallets/webhook"
5656
),
5757
UsernamePasswordAuthenticationFilter::class.java
5858
)
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package io.openfuture.openmessenger.configuration
2+
3+
import io.openfuture.openmessenger.configuration.property.StateProperties
4+
import org.springframework.context.annotation.Bean
5+
import org.springframework.context.annotation.Configuration
6+
import org.springframework.web.reactive.function.client.WebClient
7+
8+
9+
@Configuration
10+
class StateConfig {
11+
12+
@Bean
13+
fun stateClient(stateProperties: StateProperties): WebClient =
14+
WebClient.builder()
15+
.baseUrl(stateProperties.baseUrl!!)
16+
.build()
17+
18+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package io.openfuture.openmessenger.configuration.property
2+
3+
import org.springframework.boot.context.properties.ConfigurationProperties
4+
import org.springframework.stereotype.Component
5+
import org.springframework.validation.annotation.Validated
6+
import javax.validation.constraints.NotBlank
7+
import javax.validation.constraints.NotNull
8+
9+
@ConfigurationProperties(prefix = "state")
10+
@Validated
11+
@Component
12+
data class StateProperties(@field:NotNull @field:NotBlank var baseUrl: String?)
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package io.openfuture.openmessenger.repository
2+
3+
import io.openfuture.openmessenger.repository.entity.BlockchainContractEntity
4+
import io.openfuture.openmessenger.repository.entity.BlockchainType
5+
import org.springframework.data.jpa.repository.JpaRepository
6+
import org.springframework.data.jpa.repository.Query
7+
8+
interface BlockchainContractRepository : JpaRepository<BlockchainContractEntity, Long> {
9+
@Query("SELECT t from BlockchainContractEntity t where t.blockchain = :blockchain and t.isTest = :isTest")
10+
fun findFirstByBlockchain(blockchain: BlockchainType, isTest: Boolean) : BlockchainContractEntity?
11+
12+
@Query("SELECT t from BlockchainContractEntity t where t.isTest = :isTest")
13+
fun findAllByIsTest(isTest: Boolean) : List<BlockchainContractEntity>
14+
15+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package io.openfuture.openmessenger.repository
2+
3+
import io.openfuture.openmessenger.repository.entity.TaskEntity
4+
import org.springframework.data.jpa.repository.JpaRepository
5+
import org.springframework.data.jpa.repository.Query
6+
7+
interface TaskRepository : JpaRepository<TaskEntity, Long> {
8+
@Query("SELECT t from TaskEntity t where t.assignee = :emailAddress or t.assignor =:emailAddress ")
9+
fun findAllByAssigneeOrAssignor(emailAddress: String) : List<TaskEntity>
10+
11+
}

0 commit comments

Comments
 (0)