fun getProjectDetailsByName()

in core/project/src/main/kotlin/io/klibs/core/project/ProjectService.kt [30:50]


    fun getProjectDetailsByName(ownerLogin: String, projectName: String): ProjectDetails? {
        val scmRepositoryEntity = scmRepositoryRepository.findByName(ownerLogin, projectName) ?: return null
        val projectEntity = requireNotNull(projectRepository.findByScmRepoId(scmRepositoryEntity.idNotNull)) {
            "Unable to find the corresponding project for an existing SCM repo: $scmRepositoryEntity"
        }

        // Check if project has any packages
        if (!packageRepository.existsByProjectId(projectEntity.idNotNull)) {
            return null
        }

        val projectPlatforms = packageRepository.findPlatformsOf(projectEntity.idNotNull)

        return projectEntity.toDetails(
            projectEntity = projectEntity,
            scmRepositoryEntity = scmRepositoryEntity,
            projectPlatforms = projectPlatforms,
            projectMarkers = markerRepository.findAllByProjectId(projectEntity.idNotNull),
            projectTags = tagRepository.getTagsByProjectId(projectEntity.idNotNull)
        )
    }