Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions backend/apps/github/graphql/nodes/repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class Meta:
"license",
"name",
"open_issues_count",
"organization",
"size",
"stars_count",
"subscribers_count",
Expand Down
6 changes: 6 additions & 0 deletions backend/apps/github/graphql/nodes/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import graphene

from apps.common.graphql.nodes import BaseNode
from apps.github.graphql.nodes.organization import OrganizationNode
from apps.github.models.user import User


Expand All @@ -18,6 +19,7 @@ class UserNode(BaseNode):

created_at = graphene.Float()
issues_count = graphene.Int()
organization = graphene.Field(OrganizationNode)
releases_count = graphene.Int()
updated_at = graphene.Float()
url = graphene.String()
Expand Down Expand Up @@ -46,6 +48,10 @@ def resolve_issues_count(self, info):
"""Resolve issues count."""
return self.idx_issues_count

def resolve_organization(self, info):
"""Resolve organization."""
return self.organization

def resolve_releases_count(self, info):
"""Resolve releases count."""
return self.idx_releases_count
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def test_meta_configuration(self):
"license",
"name",
"open_issues_count",
"organization",
"owner_key",
"latest_release",
"releases",
Expand Down
1 change: 1 addition & 0 deletions backend/tests/apps/github/graphql/nodes/user_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ def test_meta_configuration(self):
"location",
"login",
"name",
"organization",
"public_repositories_count",
"releases_count",
"updated_at",
Expand Down
2 changes: 1 addition & 1 deletion frontend/__tests__/e2e/pages/ProjectDetails.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,6 @@ test.describe('Project Details Page', () => {
await expect(page.getByText('Issues3', { exact: true })).toBeVisible()

await page.getByText('Repo One').click()
await expect(page).toHaveURL('repositories/repo-1')
await expect(page).toHaveURL('organizations/OWASP/repositories/repo-1')
})
})
2 changes: 1 addition & 1 deletion frontend/__tests__/e2e/pages/RepositoryDetails.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ test.describe('Repository Details Page', () => {
path: '/',
},
])
await page.goto('/repositories/test-repository')
await page.goto('organizations/OWASP/repositories/test-repository')
})

test('should have a heading and summary', async ({ page }) => {
Expand Down
6 changes: 6 additions & 0 deletions frontend/__tests__/unit/data/mockProjectDetailsData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ export const mockProjectDetailsData = {
key: 'repo-1',
name: 'Repo One',
openIssuesCount: 6,
organization: {
login: 'OWASP',
},
starsCount: 95,
subscribersCount: 15,
url: 'https://github.com/example-project/repo-1',
Expand All @@ -65,6 +68,9 @@ export const mockProjectDetailsData = {
key: 'repo-2',
name: 'Repo Two',
openIssuesCount: 3,
organization: {
login: 'OWASP',
},
starsCount: 60,
subscribersCount: 10,
url: 'https://github.com/example-project/repo-2',
Expand Down
2 changes: 1 addition & 1 deletion frontend/__tests__/unit/pages/RepositoryDetails.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { addToast } from '@heroui/toast'
import { act, fireEvent, screen, waitFor, within } from '@testing-library/react'
import { mockRepositoryData } from '@unit/data/mockRepositoryData'
import { render } from 'wrappers/testUtil'
import RepositoryDetailsPage from 'app/repositories/[repositoryKey]/page'
import RepositoryDetailsPage from 'app/organizations/[organizationKey]/repositories/[repositoryKey]/page'

jest.mock('@apollo/client', () => ({
...jest.requireActual('@apollo/client'),
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/components/RepositoriesCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@ const RepositoriesCard: React.FC<RepositoriesCardProps> = ({ repositories }) =>
const RepositoryItem = ({ details }: { details: RepositoryCardProps }) => {
const router = useRouter()
const handleClick = () => {
router.push('/repositories/' + details?.key)
router.push(`/organizations/${details.organization.login}/repositories/${details.key}`)
}

return (
<div className="h-46 flex w-full flex-col gap-3 rounded-lg border p-4 shadow-sm ease-in-out hover:shadow-md dark:border-gray-700 dark:bg-gray-800">
<button
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/server/queries/organizationQueries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ export const GET_ORGANIZATION_DATA = gql`
key
name
openIssuesCount
organization {
login
}
starsCount
url
}
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/server/queries/projectQueries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ export const GET_PROJECT_DATA = gql`
key
name
openIssuesCount
organization {
login
}
starsCount
subscribersCount
url
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/server/queries/userQueries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ export const GET_USER_DATA = gql`
key
name
openIssuesCount
organization {
login
}
starsCount
subscribersCount
url
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/types/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ export interface RepositoryCardProps {
key?: string
name: string
openIssuesCount: number
organization?: {
login: string
}
starsCount: number
subscribersCount: number
url: string
Expand Down