Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add project dashboard page #915 - add controller
- Loading branch information
Showing
2 changed files
with
36 additions
and
1 deletion.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
backend/app/src/main/kotlin/io/tolgee/api/v2/controllers/V2ProjectStatsController.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,35 @@ | ||
/* | ||
* Copyright (c) 2020. Tolgee | ||
*/ | ||
|
||
package io.tolgee.api.v2.controllers | ||
|
||
import io.swagger.v3.oas.annotations.Operation | ||
import io.swagger.v3.oas.annotations.tags.Tag | ||
import io.tolgee.security.api_key_auth.AccessWithApiKey | ||
import io.tolgee.security.project_auth.AccessWithAnyProjectPermission | ||
import io.tolgee.service.ProjectStatsService | ||
import org.springframework.hateoas.MediaTypes | ||
import org.springframework.web.bind.annotation.CrossOrigin | ||
import org.springframework.web.bind.annotation.GetMapping | ||
import org.springframework.web.bind.annotation.RequestMapping | ||
import org.springframework.web.bind.annotation.RestController | ||
|
||
@Suppress("MVCPathVariableInspection") | ||
@RestController | ||
@CrossOrigin(origins = ["*"]) | ||
@RequestMapping(value = ["/v2/projects"]) | ||
@Tag(name = "Projects") | ||
class V2ProjectStatsController( | ||
private val projectStatsService: ProjectStatsService | ||
) { | ||
|
||
@Operation(summary = "Returns project stats") | ||
@GetMapping("/{projectId}/stats", produces = [MediaTypes.HAL_JSON_VALUE]) | ||
@AccessWithAnyProjectPermission | ||
@AccessWithApiKey | ||
fun getProjectStats(projectId: Long) { | ||
val projectStats = projectStatsService.getProjectStats(projectId) | ||
val languageStats = projectStatsService.getProjectStats(projectId) | ||
} | ||
} |
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