Skip to content
Snippets Groups Projects
Verified Commit 52ec076d authored by Jan-Niclas Strüwer's avatar Jan-Niclas Strüwer
Browse files

Updated visualization consent path

parent b94239e5
No related branches found
No related tags found
No related merge requests found
Pipeline #27395 canceled
......@@ -18,6 +18,6 @@ object ApiPaths {
const val REPOSITORY_ID = "$REPOSITORY/{id}"
const val REPOSITORY_TOOL_RUN = "$REPOSITORY/{id}/toolrun"
const val REPOSITORY_UPDATE_CONSENT = "$REPOSITORY/consent"
const val REPOSITORY_UPDATE_CONSENT = "$REPOSITORY/{id}/consent"
const val REPOSITORY_VALIDATE_USER = "$REPOSITORY/{id}/validateUser"
}
......@@ -158,8 +158,11 @@ class RepositoryController(
}
@PostMapping(ApiPaths.REPOSITORY_UPDATE_CONSENT)
suspend fun updateRepositoryConsent(@RequestBody repositoryConsentDto: RepositoryConsentDto) {
repositoryService.updateVisualizationConsent(repositoryConsentDto)
suspend fun updateRepositoryConsent(
@PathVariable id: Long,
@RequestBody repositoryConsentDto: RepositoryConsentDto
) {
repositoryService.updateVisualizationConsent(id, repositoryConsentDto)
}
@PostMapping(ApiPaths.REPOSITORY_VALIDATE_USER)
......
package de.fraunhofer.iem.dataprovider.repository.dto
data class RepositoryConsentDto(val consent: Boolean, val projectId: Long)
data class RepositoryConsentDto(val consent: Boolean)
......@@ -7,6 +7,7 @@ import de.fraunhofer.iem.dataprovider.repository.dto.RepositoryCreateDto
import de.fraunhofer.iem.dataprovider.repository.entity.RepositoryEntity
import de.fraunhofer.iem.dataprovider.repository.repository.RepositoryRepository
import org.springframework.stereotype.Service
import org.springframework.transaction.annotation.Transactional
@Service
class RepositoryService(
......@@ -20,6 +21,7 @@ class RepositoryService(
* Either creates or returns a repository entity based upon its
* opencode repository id.
*/
@Transactional
fun getOrCreate(gitRepository: RepositoryCreateDto): RepositoryEntity {
logger.info("Checking if repository with ${gitRepository.id} exists")
var repo = repositoryRepository.findByProjectId(gitRepository.id)
......@@ -45,8 +47,8 @@ class RepositoryService(
return repositoryRepository.findAll()
}
fun updateVisualizationConsent(repositoryConsentDto: RepositoryConsentDto) {
val repo = findRepoById(repositoryConsentDto.projectId)
fun updateVisualizationConsent(projectId: Long, repositoryConsentDto: RepositoryConsentDto) {
val repo = findRepoById(projectId)
if (repo != null) {
repo.visualizationConsent = repositoryConsentDto.consent
logger.info("Updated visualization consent $repositoryConsentDto")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment

Consent

On this website, we use the web analytics service Matomo to analyze and review the use of our website. Through the collected statistics, we can improve our offerings and make them more appealing for you. Here, you can decide whether to allow us to process your data and set corresponding cookies for these purposes, in addition to technically necessary cookies. Further information on data protection—especially regarding "cookies" and "Matomo"—can be found in our privacy policy. You can withdraw your consent at any time.