Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
e043f92
feat: add new patch profile presenter
matheusspacifico Aug 9, 2025
e97b072
feat: add new patch profile service
matheusspacifico Aug 9, 2025
7ace4b7
wip: implement patch user profile service
matheusspacifico Aug 11, 2025
a2bb129
Merge branch 'dev' into patch-user
matheusspacifico Aug 12, 2025
51e2391
Merge branch 'dev' into patch-user
matheusspacifico Aug 13, 2025
dd9c766
chore: move account/text value object to shared
matheusspacifico Aug 13, 2025
98ca907
chore: delete review/text value object and move tests to shared module
matheusspacifico Aug 13, 2025
f7cbaae
chore: remove unneeded comments
matheusspacifico Aug 13, 2025
cb9f0a1
Merge pull request #179 from pet-ads/patch-user
matheusspacifico Aug 14, 2025
a91eaea
feat: add name value object
matheusspacifico Aug 14, 2025
69ea2af
refactor: allow apostrophe in name value object
matheusspacifico Aug 14, 2025
cdc5d70
refactor: move username value object to shared module
matheusspacifico Aug 14, 2025
47a3fc2
refactor!: add name attribute to user table and modify every needed file
matheusspacifico Aug 14, 2025
bddae34
fix: add apostrophes word in name value object error message
matheusspacifico Aug 14, 2025
402864f
test: add name and username value objects test
matheusspacifico Aug 14, 2025
673e63a
fix: change "keyword" to "keywords"
matheusspacifico Aug 18, 2025
aa50074
refactor: allow semicolon delimiter in bibtex keywords
matheusspacifico Aug 18, 2025
6f04d27
Merge branch 'dev' into update-user-table
matheusspacifico Aug 18, 2025
4387f7b
Merge pull request #185 from pet-ads/update-user-table
matheusspacifico Aug 19, 2025
ec5e0c6
refactor(doi): update regex to allow prefix
matheusspacifico Aug 20, 2025
7a3465e
refactor(bib): allow singular keyword alongside plural keywords
matheusspacifico Aug 20, 2025
35350e9
fix(bib): properly formating doi
matheusspacifico Aug 20, 2025
3f01525
refactor(doi): add more valid doi url in regex
matheusspacifico Aug 20, 2025
ffa5aa5
test: change data factory to use first name for username
matheusspacifico Aug 20, 2025
269308b
fix: add missing name attribute to restful user profile presenter
matheusspacifico Aug 23, 2025
55fc08b
test: add missing name parameter at retrieve user profile tests
matheusspacifico Aug 25, 2025
cc5785b
feat: add pick many question class
matheusspacifico Aug 25, 2025
c74bdc4
feat: add pick many building option to question builder
matheusspacifico Aug 25, 2025
662017c
feat: update question mapper to allow pick many questions
matheusspacifico Aug 25, 2025
122819d
feat: add pick many questions to question service
matheusspacifico Aug 25, 2025
268abf9
test: add pick many dto options to question test data factory
matheusspacifico Aug 25, 2025
0079fbd
test: add pick many question option to create find and update tests
matheusspacifico Aug 25, 2025
d1bb4ea
feat: add pick many question option to link factory
matheusspacifico Aug 25, 2025
4765ca8
feat: update all question restful presenter to allow pick many
matheusspacifico Aug 25, 2025
0c56e30
feat: add create pick many question endpoints for extraction and rob
matheusspacifico Aug 25, 2025
6a51f83
fix: fix pick many endpoint returning the wrong requestion type in json
matheusspacifico Aug 25, 2025
2514b98
fix: fix code and description get question response model field being…
matheusspacifico Aug 25, 2025
9fde190
chore: mock two pick many questions into web application
matheusspacifico Aug 26, 2025
78d391d
feat: implement answering pick many question
matheusspacifico Aug 26, 2025
5e530bf
chore: add pick many to dictionary
matheusspacifico Aug 26, 2025
28f8038
refactor: add pick many options guard clause
matheusspacifico Aug 26, 2025
cd12110
refactor: add error catching when building a question
matheusspacifico Aug 26, 2025
348c292
test: add new invalid entries tests for update question service
matheusspacifico Aug 26, 2025
c62ea3d
test: add new invalid entries tests for create question service
matheusspacifico Aug 26, 2025
bf780b9
test: add pick many value object tests
matheusspacifico Aug 26, 2025
5ef4f02
fix: add missing return statement
matheusspacifico Aug 26, 2025
66448c1
test: add test data for pick many controller tests
matheusspacifico Aug 26, 2025
3eef601
test: add new pick many controller tests
matheusspacifico Aug 26, 2025
3079503
test: add test data for answering pick many questions
matheusspacifico Aug 26, 2025
03aa108
test: add more tests for answer service
matheusspacifico Aug 26, 2025
13d846f
chore: add custom spring startup banner
matheusspacifico Aug 26, 2025
7607cee
Merge pull request #188 from pet-ads/pick-many
matheusspacifico Aug 27, 2025
8c423c2
refactor: adapt protocol stage service to new modularization
matheusspacifico Aug 29, 2025
3a3d2aa
test: adapt protocol stage tests to new modularization
matheusspacifico Aug 29, 2025
03340a5
fix: fix service crash when parsing dto with a blank title
matheusspacifico Aug 29, 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
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.

Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ interface RegisterUserAccountService {
fun register(presenter: RegisterUserAccountPresenter, request: RequestModel)

data class RequestModel(
val name: String,
val username: String,
val password: String,
val email: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ 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.shared.user.Name
import br.all.domain.shared.user.Text
import br.all.domain.shared.user.Username
import br.all.domain.user.*

class RegisterUserAccountServiceImpl(private val repository: UserAccountRepository) : RegisterUserAccountService {
Expand All @@ -20,12 +23,14 @@ class RegisterUserAccountServiceImpl(private val repository: UserAccountReposito
if (presenter.isDone()) return

val userAccountId = UserAccountId()
val name = Name(request.name)
val username = Username(request.username)
val email = Email(request.email)
val country = Text(request.country)

val userAccount = UserAccount(
id = userAccountId,
name = name,
username = username,
password = request.password,
email = email,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ interface RetrieveUserProfileService {

data class ResponseModel(
val userId: UUID,
val name: String,
val username: String,
val email: String,
val affiliation: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class RetrieveUserProfileServiceImpl(

val profile = ResponseModel(
userId = userProfile.id,
name = userProfile.name,
username = userCredentials.username,
email = userProfile.email,
affiliation = userProfile.affiliation,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import java.util.*

data class UserAccountDto(
val id: UUID,
val name: String,
val username: String,
val password: String,
val email: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import br.all.domain.user.UserAccount

fun UserAccount.toDto() = UserAccountDto(
id.value(),
name.value,
accountCredentials.username.value,
accountCredentials.password,
email.email,
Expand All @@ -17,4 +18,3 @@ fun UserAccount.toDto() = UserAccountDto(
accountCredentials.isCredentialsNonExpired,
accountCredentials.isEnabled
)

Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import java.util.UUID

data class UserProfileDto(
val id: UUID,
val name: String,
val email: String,
val country: String,
val affiliation: String,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package br.all.application.user.update

import br.all.domain.shared.presenter.GenericPresenter
import br.all.application.user.update.PatchUserProfileService.ResponseModel

interface PatchUserProfilePresenter : GenericPresenter<ResponseModel>
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package br.all.application.user.update

import java.util.UUID

interface PatchUserProfileService {
fun patchProfile(presenter: PatchUserProfilePresenter, request: RequestModel)

data class RequestModel(
val userId: UUID,
val name: String?,
val username: String?,
val email: String?,
val affiliation: String?,
val country: String?
)

data class ResponseModel(
val userId: UUID,
val name: String,
val username: String,
val email: String,
val affiliation: String,
val country: String,
val invalidEntries: List<String>
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package br.all.application.user.update

import br.all.application.user.repository.UserAccountRepository
import br.all.application.user.update.PatchUserProfileService.RequestModel
import br.all.application.user.update.PatchUserProfileService.ResponseModel
import br.all.domain.shared.user.Email
import br.all.domain.shared.user.Text
import br.all.domain.shared.user.Username

class PatchUserProfileServiceImpl(
private val repository: UserAccountRepository
) : PatchUserProfileService {
override fun patchProfile(
presenter: PatchUserProfilePresenter,
request: RequestModel
) {
if (repository.loadCredentialsById(request.userId) == null) {
presenter.prepareFailView(NoSuchElementException("User with id ${request.userId} not found!"))
}

if (presenter.isDone()) return

// val newUsername = Username(request.username)
// val newEmail = Email(request.email)
// val affiliation = Text(request.affiliation)
// val country = Text(request.country)

// TODO(): add invalid entries to the response model array
// TODO(): update only the valid entries

// data class RequestModel(
// val userId: UUID,
// val username: String,
// val email: String,
// val affiliation: String,
// val country: String
// )
//
// data class ResponseModel(
// val userId: UUID,
// val username: String,
// val email: String,
// val affiliation: String,
// val country: String,
// val invalidEntries: List<String>
// )
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package br.all.domain.user

import br.all.domain.shared.user.Username

class AccountCredentials (
val username: Username,
val password: String,
Expand Down
4 changes: 4 additions & 0 deletions account/src/main/kotlin/br/all/domain/user/UserAccount.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@ package br.all.domain.user

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

class UserAccount(
id: UserAccountId,
var name: Name,
val createdAt: LocalDateTime = LocalDateTime.now(),
var email: Email,
var country: Text,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import java.util.*
@Table(name = "USER_ACCOUNTS")
class UserAccountEntity (
@Id var id: UUID,
@Column(nullable = false)
var name: String,
@OneToOne( mappedBy = "userAccount", cascade = [CascadeType.ALL])
@PrimaryKeyJoinColumn
var accountCredentialsEntity: AccountCredentialsEntity,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@ fun UserAccountDto.toUserAccountEntity(): UserAccountEntity {
isCredentialsNonExpired,
isEnabled
)
return UserAccountEntity(id, credentials, email, country, affiliation, createdAt)
return UserAccountEntity(id, name, credentials, email, country, affiliation, createdAt)
}

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

fun UserAccountEntity.toUserProfileDto() = UserProfileDto(
id = this.id,
name = this.name,
email = this.email,
country = this.country,
affiliation = this.affiliation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ class RetrieveUserProfileServiceImplTest {

val capturedResponse = responseSlot.captured
assertEquals(userProfile.id, capturedResponse.userId)
assertEquals(userProfile.name, capturedResponse.name)
assertEquals(userCredentials.username, capturedResponse.username)
assertEquals(userProfile.email, capturedResponse.email)
assertEquals(userProfile.affiliation, capturedResponse.affiliation)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ class TestDataFactory {
password = faker.pearlJam.songs(),
email = faker.internet.email(),
country = faker.address.countryCode(),
affiliation = faker.lorem.words()
affiliation = faker.lorem.words(),
name = faker.name.neutralFirstName()
)

fun accountCredentials()
Expand All @@ -31,5 +32,6 @@ class TestDataFactory {
email = faker.internet.email(),
country = faker.address.countryCode(),
affiliation = faker.leagueOfLegends.rank(),
name = faker.name.firstName()
)
}
13 changes: 10 additions & 3 deletions account/src/test/kotlin/br/all/domain/user/UserAccountTest.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package br.all.domain.user

import br.all.domain.shared.user.Email
import br.all.domain.shared.user.Name
import br.all.domain.shared.user.Text
import br.all.domain.shared.user.Username
import io.github.serpro69.kfaker.Faker
import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.Tag
Expand Down Expand Up @@ -53,6 +56,8 @@ class UserAccountTest{
Assertions.assertTrue(user.accountCredentials.isEnabled)
}

// Although the user won't be able to change their username through the front-end,
// I think we should still let this test here.
@Test
fun `should change username in account credentials`(){
val user = createUser()
Expand All @@ -71,16 +76,18 @@ class UserAccountTest{

private fun createUser(
id: UUID = UUID.randomUUID(),
name: Name = Name(faker.name.name()),
createdAt: LocalDateTime = LocalDateTime.now(),
email: Email = Email(faker.internet.email()),
country: Text = Text(faker.address.countryCode()),
affiliation: String = faker.lorem.words(),
username: Username = Username(faker.name.firstName()),
password: String = faker.pearlJam.songs(),
authorities: Set<Authority> = setOf(Authority.USER)
) = UserAccount(
UserAccountId(id),
createdAt, email, country, affiliation, username, password, authorities
) = UserAccount(
id = UserAccountId(id),
name = name,
createdAt = createdAt, email = email, country = country, affiliation = affiliation, username = username, password = password, authorities = authorities
)

}
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,18 @@ interface FindProtocolStageService {
)

enum class ProtocolStage {
PROTOCOL_PART_I,
GENERAL_DEFINITION,
RESEARCH_QUESTIONS,
PICOC,
PROTOCOL_PART_II,
PROTOCOL_PART_III,
ELIGIBILITY_CRITERIA,
INFORMATION_SOURCES_AND_SEARCH_STRATEGY,
SELECTION_AND_EXTRACTION,
RISK_OF_BIAS,
ANALYSIS_AND_SYNTHESIS_METHOD,

IDENTIFICATION,
SELECTION,
EXTRACTION,
GRAPHICS,
FINALIZATION
GRAPHICS
}
}
Loading