Skip to content

Commit

Permalink
feat: Add project dashboard page #915 - add controller
Browse files Browse the repository at this point in the history
  • Loading branch information
JanCizmar committed Apr 22, 2022
1 parent e008ecc commit 206433b
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
@@ -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)
}
}
Expand Up @@ -120,7 +120,7 @@ class V2ProjectsController(
return arrayResourcesAssembler.toModel(projects, projectModelAssembler)
}

@Operation(summary = "Returns all projects (includingStatistics) where current user has any permission")
@Operation(summary = "Returns all projects (including statistics) where current user has any permission")
@GetMapping("/with-stats", produces = [MediaTypes.HAL_JSON_VALUE])
fun getAllWithStatistics(
@ParameterObject pageable: Pageable,
Expand Down

0 comments on commit 206433b

Please sign in to comment.