-
-
Notifications
You must be signed in to change notification settings - Fork 221
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Visual editor & Formats support (#2145)
Co-authored-by: Štěpán Granát <[email protected]>
- Loading branch information
Showing
597 changed files
with
29,052 additions
and
9,021 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
...d/api/src/main/kotlin/io/tolgee/api/v2/controllers/dataImport/ImportSettingsController.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/* | ||
* Copyright (c) 2020. Tolgee | ||
*/ | ||
|
||
package io.tolgee.api.v2.controllers.dataImport | ||
|
||
import io.swagger.v3.oas.annotations.Operation | ||
import io.swagger.v3.oas.annotations.tags.Tag | ||
import io.tolgee.dtos.request.dataImport.ImportSettingsRequest | ||
import io.tolgee.hateoas.dataImport.ImportSettingsModel | ||
import io.tolgee.security.ProjectHolder | ||
import io.tolgee.security.authentication.AllowApiAccess | ||
import io.tolgee.security.authentication.AuthenticationFacade | ||
import io.tolgee.security.authorization.UseDefaultPermissions | ||
import io.tolgee.service.dataImport.ImportSettingsService | ||
import jakarta.validation.Valid | ||
import org.springframework.web.bind.annotation.CrossOrigin | ||
import org.springframework.web.bind.annotation.GetMapping | ||
import org.springframework.web.bind.annotation.PutMapping | ||
import org.springframework.web.bind.annotation.RequestBody | ||
import org.springframework.web.bind.annotation.RequestMapping | ||
import org.springframework.web.bind.annotation.RestController | ||
|
||
@Suppress("MVCPathVariableInspection") | ||
@RestController | ||
@CrossOrigin(origins = ["*"]) | ||
@RequestMapping(value = ["/v2/projects/{projectId:\\d+}/import-settings", "/v2/projects/import-settings"]) | ||
@Tag( | ||
name = "Import Settings", | ||
description = | ||
"These endpoints enable you to store default settings for import. " + | ||
"These settings are only used in the UI of Tolgee platform. " + | ||
"It's not the default for importing via API endpoints. " + | ||
"The settings are stored per user and per project.", | ||
) | ||
class ImportSettingsController( | ||
private val projectHolder: ProjectHolder, | ||
private val importSettingsService: ImportSettingsService, | ||
private val authenticationFacade: AuthenticationFacade, | ||
) { | ||
@GetMapping("") | ||
@Operation(description = "Returns import settings for the authenticated user and the project.") | ||
@AllowApiAccess | ||
@UseDefaultPermissions | ||
fun get(): ImportSettingsModel { | ||
val projectId = projectHolder.project.id | ||
val settings = importSettingsService.get(authenticationFacade.authenticatedUserEntity, projectId) | ||
return ImportSettingsModel(settings) | ||
} | ||
|
||
@PutMapping("") | ||
@Operation(description = "Stores import settings for the authenticated user and the project.") | ||
@AllowApiAccess | ||
@UseDefaultPermissions | ||
fun store( | ||
@Valid @RequestBody dto: ImportSettingsRequest, | ||
): ImportSettingsModel { | ||
val projectId = projectHolder.project.id | ||
val settings = importSettingsService.store(authenticationFacade.authenticatedUserEntity, projectId, dto) | ||
return ImportSettingsModel(settings) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.