Skip to content

Commit

Permalink
fix merged conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
abhayymishraa committed Jan 24, 2025
1 parent 401419c commit 1173139
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 28 deletions.
8 changes: 3 additions & 5 deletions backend/apps/owasp/graphql/queries/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,10 @@
class ProjectQueries(graphene.ObjectType):
"""GraphQL queries for OWASP projects."""

project = graphene.Field(ProjectType, project_id=graphene.ID(), key=graphene.String())
project = graphene.Field(ProjectType, key=graphene.String())

def resolve_project(self, info, project_id=None, key=None):
"""Resolve a project by its ID or key."""
if id:
return Project.objects.get(id=id)
def resolve_project(self, info, key=None):
"""Resolve a project by its key."""
if key:
return Project.objects.get(key=key)
return None
2 changes: 1 addition & 1 deletion backend/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 0 additions & 20 deletions frontend/src/pages/ProjectDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,6 @@ import SecondaryCard from 'components/SecondaryCard'
import TopContributors from 'components/ToggleContributors'
import ToggleableList from 'components/ToogleList'

export const formatDate = (input: number | string) => {
const date =
typeof input === 'number'
? new Date(input * 1000) // Unix timestamp in seconds
: new Date(input) // ISO date string

if (isNaN(date.getTime())) {
throw new Error('Invalid date')
}

return date.toLocaleDateString('en-US', {
year: 'numeric',
month: 'long',
day: 'numeric',
})
}


const ProjectDetailsPage = () => {
const { projectKey } = useParams()
const [project, setProject] = useState(null)
Expand Down Expand Up @@ -72,8 +54,6 @@ const ProjectDetailsPage = () => {
}
}, [data])

const navigate = useNavigate()

if (isLoading || loading)
return (
<div className="flex min-h-[60vh] items-center justify-center">
Expand Down
13 changes: 11 additions & 2 deletions frontend/src/utils/dateFormatter.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
export const formatDate = (timestamp: number) => {
return new Date(timestamp * 1000).toLocaleDateString('en-US', {
export const formatDate = (input: number | string) => {
const date =
typeof input === 'number'
? new Date(input * 1000) // Unix timestamp in seconds
: new Date(input) // ISO date string

if (isNaN(date.getTime())) {
throw new Error('Invalid date')
}

return date.toLocaleDateString('en-US', {
year: 'numeric',
month: 'long',
day: 'numeric',
Expand Down

0 comments on commit 1173139

Please sign in to comment.