Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
1938883
test: create initial version of transactional test
gabrmanh Mar 2, 2025
5359bff
feat: implement exception handler to use existing response entity mapper
gabrmanh Mar 2, 2025
4cdbd6f
feat: add transactional annotation to service
gabrmanh Mar 2, 2025
98a2e1f
refactor(batchAnswer): service now answer both rob and extraction thr…
matheusspacifico Jul 15, 2025
45abc46
test(batchAnswer): update test to adapt the new answering both contex…
matheusspacifico Jul 15, 2025
c56e9e9
test(batchAnswer): update controller test to adapt the new answering …
matheusspacifico Jul 15, 2025
3a452bc
test(batchAnswer): update label dto to use batch service instead of s…
matheusspacifico Jul 15, 2025
c566667
feat: delete both old single answer endpoint
matheusspacifico Jul 15, 2025
437d81b
refactor: rename get protocol stage service to find protocol stage se…
matheusspacifico Jul 18, 2025
365b831
feat!: new shared module to avoid class duplication
matheusspacifico Jul 20, 2025
527273b
chore: remove unused imports
matheusspacifico Jul 20, 2025
003be7a
chore: remove redundant semicolon
matheusspacifico Jul 20, 2025
baa85e6
Merge pull request #174 from pet-ads/shared-module
matheusspacifico Jul 25, 2025
63ab393
Merge branch 'main' into dev
ericksgmes Jul 28, 2025
9afaeef
Revert "Merge branch 'main' into dev"
ericksgmes Jul 28, 2025
25bd4fa
feat: make pageable endpoint
ericksgmes Jul 28, 2025
aaa8b0d
refactor: move all shared exceptions to shared module
matheusspacifico Jul 29, 2025
c11c73d
refactor: move generic presenter to shared module
matheusspacifico Jul 31, 2025
865de30
refactor: move researcher related classes to shared module
matheusspacifico Jul 31, 2025
0d9a2fe
Merge remote-tracking branch 'origin/test/transactional-tests' into dev
ericksgmes Jul 31, 2025
ad4d2dd
Merge pull request #176 from pet-ads/shared-credentials
matheusspacifico Jul 31, 2025
429ed8c
refactor: change spring tags
matheusspacifico Aug 6, 2025
5b0b484
chore: fix typo
matheusspacifico Aug 6, 2025
413f375
feat: add retrieve user profile presenter and service interfaces
matheusspacifico Aug 6, 2025
a8cd1f6
feat: add new repository method to return user account dto
matheusspacifico Aug 6, 2025
de5e230
feat: add retrieve user profile service implementation
matheusspacifico Aug 6, 2025
013aa3f
feat: add restful user profile presenter
matheusspacifico Aug 6, 2025
0933384
feat: add new service bean configuration
matheusspacifico Aug 6, 2025
c4df4f4
feat: add endpoint to new get profile service
matheusspacifico Aug 6, 2025
221fc51
refactor: tweak spring security to block unauthenticated requests to …
matheusspacifico Aug 6, 2025
593b959
refactor: add new specific dto for user profile and implement it
matheusspacifico Aug 6, 2025
3cabe3a
chore: remove unused import
matheusspacifico Aug 6, 2025
8a2f277
feat: add user profile dto factory
matheusspacifico Aug 6, 2025
8d374c0
feat: add retrieve user profile service tests
matheusspacifico Aug 6, 2025
6b81166
Merge pull request #177 from pet-ads/public-data-2
matheusspacifico Aug 6, 2025
26919ab
docs: add comment to transactional test
matheusspacifico Aug 9, 2025
1425318
test: disable broken test
matheusspacifico Aug 12, 2025
1d682d6
build: disable sonarqube ci yml
matheusspacifico Aug 13, 2025
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
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# This action is disabled because it does
# the same thing as CI with Maven (run all tests and build).
# The SonarQube Cloud Analysis already happens without this, so no worries.

name: SonarQube
on:
push:
Expand Down
1 change: 1 addition & 0 deletions .idea/dictionaries/project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions account/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,11 @@
<artifactId>postgresql</artifactId>
<version>42.7.2</version>
</dependency>
<dependency>
<groupId>br.all</groupId>
<artifactId>shared</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package br.all.application.user.create

import br.all.application.shared.GenericPresenter
import br.all.domain.shared.presenter.GenericPresenter
import br.all.application.user.create.RegisterUserAccountService.ResponseModel

interface RegisterUserAccountPresenter : GenericPresenter<ResponseModel>
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package br.all.application.user.create

import br.all.application.shared.UniquenessViolationException
import br.all.application.user.create.RegisterUserAccountService.RequestModel
import br.all.application.user.create.RegisterUserAccountService.ResponseModel
import br.all.application.user.repository.UserAccountRepository
import br.all.application.user.repository.toDto
import br.all.domain.shared.exception.UniquenessViolationException
import br.all.domain.shared.user.Email
import br.all.domain.user.*

class RegisterUserAccountServiceImpl(private val repository: UserAccountRepository) : RegisterUserAccountService {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package br.all.application.user.find

import br.all.application.user.find.RetrieveUserProfileService.ResponseModel
import br.all.domain.shared.presenter.GenericPresenter

interface RetrieveUserProfilePresenter : GenericPresenter<ResponseModel>
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package br.all.application.user.find
import java.util.UUID

interface RetrieveUserProfileService {
fun retrieveData(presenter: RetrieveUserProfilePresenter, request: RequestModel)

data class RequestModel(
val userId: UUID
)

data class ResponseModel(
val userId: UUID,
val username: String,
val email: String,
val affiliation: String,
val country: String,
val authorities: Set<String>,
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package br.all.application.user.find

import br.all.application.user.find.RetrieveUserProfileService.RequestModel
import br.all.application.user.find.RetrieveUserProfileService.ResponseModel
import br.all.application.user.repository.UserAccountRepository

class RetrieveUserProfileServiceImpl(
private val userAccountRepository: UserAccountRepository
) : RetrieveUserProfileService {
override fun retrieveData(
presenter: RetrieveUserProfilePresenter,
request: RequestModel
) {
val userProfile = userAccountRepository.loadUserProfileById(request.userId)
if (userProfile == null) {
presenter.prepareFailView(NoSuchElementException("User with id ${request.userId} doesn't exist!"))
return
}

val userCredentials = userAccountRepository.loadCredentialsById(request.userId)
if (userCredentials == null) {
presenter.prepareFailView(NoSuchElementException("Account credentials with id ${request.userId} doesn't exist!"))
return
}


val profile = ResponseModel(
userId = userProfile.id,
username = userCredentials.username,
email = userProfile.email,
affiliation = userProfile.affiliation,
country = userProfile.country,
authorities = userCredentials.authorities
)

presenter.prepareSuccessView(profile)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ fun UserAccount.toDto() = UserAccountDto(
id.value(),
accountCredentials.username.value,
accountCredentials.password,
email.value,
email.email,
country.value,
affiliation,
createdAt,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ interface UserAccountRepository {
fun existsByEmail(email: String): Boolean
fun existsByUsername(username: String): Boolean
fun deleteById(id: UUID)
fun loadUserProfileById(id: UUID): UserProfileDto?
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package br.all.application.user.repository

import java.util.UUID

data class UserProfileDto(
val id: UUID,
val email: String,
val country: String,
val affiliation: String,
)
13 changes: 0 additions & 13 deletions account/src/main/kotlin/br/all/domain/shared/ddd/Entity.kt

This file was deleted.

66 changes: 0 additions & 66 deletions account/src/main/kotlin/br/all/domain/user/Email.kt

This file was deleted.

1 change: 1 addition & 0 deletions account/src/main/kotlin/br/all/domain/user/UserAccount.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package br.all.domain.user

import br.all.domain.shared.ddd.Entity
import br.all.domain.shared.user.Email
import java.time.LocalDateTime
import java.util.UUID

Expand Down
4 changes: 2 additions & 2 deletions account/src/main/kotlin/br/all/domain/user/Username.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package br.all.domain.user
import br.all.domain.shared.ddd.Notification
import br.all.domain.shared.ddd.ValueObject

data class Username(val value: String) : ValueObject (){
data class Username(val value: String) : ValueObject(){

init {
val notification = validate()
Expand All @@ -16,6 +16,6 @@ data class Username(val value: String) : ValueObject (){
notification.addError("Username must not be blank!")
else if (!value.matches( Regex("[a-zA-Z0-9-_]*")))
notification.addError("Username must contain only letters and numbers, dashes and underscores!")
return notification;
return notification
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package br.all.infrastructure.user

import br.all.application.user.repository.AccountCredentialsDto
import br.all.application.user.repository.UserAccountDto
import br.all.application.user.repository.UserProfileDto

fun UserAccountDto.toUserAccountEntity(): UserAccountEntity {
val credentials = AccountCredentialsEntity(
Expand All @@ -18,4 +19,11 @@ fun UserAccountDto.toUserAccountEntity(): UserAccountEntity {
return UserAccountEntity(id, credentials, email, country, affiliation, createdAt)
}

fun AccountCredentialsEntity.toAccountCredentialsDto() = AccountCredentialsDto(id, username, password, authorities, refreshToken)
fun AccountCredentialsEntity.toAccountCredentialsDto() = AccountCredentialsDto(id, username, password, authorities, refreshToken)

fun UserAccountEntity.toUserProfileDto() = UserProfileDto(
id = this.id,
email = this.email,
country = this.country,
affiliation = this.affiliation
)
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package br.all.infrastructure.user
import br.all.application.user.repository.AccountCredentialsDto
import br.all.application.user.repository.UserAccountDto
import br.all.application.user.repository.UserAccountRepository
import br.all.application.user.repository.UserProfileDto
import org.springframework.stereotype.Repository
import java.util.*

Expand All @@ -22,6 +23,9 @@ class UserAccountRepositoryImpl(
credentialsRepository.deleteById(id)
}

override fun loadUserProfileById(id: UUID): UserProfileDto? =
userAccountRepository.findById(id).orElse(null)?.toUserProfileDto()

override fun loadCredentialsByUsername(username: String) =
credentialsRepository.findByUsername(username)?.toAccountCredentialsDto()

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package br.all.application.user.create

import br.all.application.shared.UniquenessViolationException
import br.all.application.user.repository.UserAccountRepository
import br.all.application.user.utils.TestDataFactory
import io.mockk.every
Expand All @@ -9,6 +8,7 @@ import io.mockk.junit5.MockKExtension
import io.mockk.verifyOrder
import org.junit.jupiter.api.*
import org.junit.jupiter.api.extension.ExtendWith
import br.all.domain.shared.exception.UniquenessViolationException

@Tag("UnitTest")
@Tag("ServiceTest")
Expand Down
Loading