-
Notifications
You must be signed in to change notification settings - Fork 10
feat: add competence management system #669
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
MaxiLein
wants to merge
27
commits into
main
Choose a base branch
from
usertask-matching-prototype
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
4d69ebc
feat: add competence management system
MaxiLein b45cca0
updated API configuration and adjust pagination position in competenc…
MaxiLein f76e14f
trivial
MaxiLein 455befb
Debug logging
MaxiLein beb3d25
Merge branch 'main' into usertask-matching-prototype
MaxiLein 45645db
Add competence matching env variable
MaxiLein 81d1739
format displayed description
MaxiLein 3ce5cfa
Add competence-matching as feature-flag (TRUE)
MaxiLein 6a5c1b2
Merge branch 'main' into usertask-matching-prototype
MaxiLein a41e93b
Merge branch 'main' into usertask-matching-prototype
MaxiLein 5d367ce
fix: update imports for potential owner store and options generation
MaxiLein 91d3b2f
Update src/management-system-v2/components/competence/utils/debug.ts
MaxiLein b508a97
fix: update import path for potential owner store and fix typo in com…
MaxiLein 222cf4e
fix: ensure type safety for competence in user competence functions
MaxiLein bbe32a8
env-variables: competence matching configuration and validation
MaxiLein 3d5f65c
refactor: move competence matching API config to fetch-matches.ts and…
MaxiLein b7ed4b9
revert refine for values (will look at it later)
MaxiLein afa0bad
remove competence service paths from setable env vars
MaxiLein e93a7af
Merge branch 'main' into usertask-matching-prototype
MaxiLein 546e70f
Merge branch 'main' into usertask-matching-prototype
MaxiLein ad1352a
Merge branch 'main' into usertask-matching-prototype
MaxiLein 200dac4
deactivate contradiction indicator for now
MaxiLein 7679c6c
Merge branch 'main' into usertask-matching-prototype
MaxiLein 3d7570a
Merge branch 'main' into usertask-matching-prototype
MaxiLein b27ede8
Merge branch 'main' into usertask-matching-prototype
MaxiLein 0370fff
Adress comments
MaxiLein a45368b
Merge branch 'main' into usertask-matching-prototype
MaxiLein File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
...anagement-system-v2/app/(dashboard)/[environmentId]/(competence)/user-competence/page.tsx
This file contains hidden or 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,30 @@ | ||
| import { getCurrentUser } from '@/components/auth'; | ||
| import Content from '@/components/content'; | ||
| import { notFound } from 'next/navigation'; | ||
| import { env } from '@/lib/ms-config/env-vars'; | ||
| import { getMSConfig } from '@/lib/ms-config/ms-config'; | ||
| import UserCompetenceManager from '@/components/competence/user-competences/user-competence-manager'; | ||
| import { getAllCompetencesOfUser } from '@/lib/data/db/competence'; | ||
| import UnauthorizedFallback from '@/components/unauthorized-fallback'; | ||
|
|
||
| const UserCompetencePage = async () => { | ||
| const { user, userId } = await getCurrentUser(); | ||
|
|
||
| if (user?.isGuest) return <UnauthorizedFallback />; | ||
|
|
||
| if (!env.PROCEED_PUBLIC_IAM_ACTIVE) return notFound(); | ||
|
|
||
| const msConfig = await getMSConfig(); | ||
| if (!msConfig.PROCEED_PUBLIC_COMPETENCE_MATCHING_ACTIVE) return notFound(); | ||
|
|
||
| // Fetch user's competences | ||
| const userCompetences = await getAllCompetencesOfUser(userId); | ||
|
|
||
| return ( | ||
| <Content title="My Competences"> | ||
| <UserCompetenceManager initialUserCompetences={userCompetences} userId={userId} /> | ||
| </Content> | ||
| ); | ||
| }; | ||
|
|
||
| export default UserCompetencePage; |
44 changes: 44 additions & 0 deletions
44
src/management-system-v2/app/(dashboard)/[environmentId]/iam/competences/page.tsx
This file contains hidden or 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,44 @@ | ||
| import { getCurrentUser, getCurrentEnvironment } from '@/components/auth'; | ||
| import Content from '@/components/content'; | ||
| import { notFound } from 'next/navigation'; | ||
| import { env } from '@/lib/ms-config/env-vars'; | ||
| import { getMSConfig } from '@/lib/ms-config/ms-config'; | ||
| import UnauthorizedFallback from '@/components/unauthorized-fallback'; | ||
| import CompetencesDashboard from '@/components/competence/organization/competences-dashboard'; | ||
| import { getAllSpaceCompetences } from '@/lib/data/db/competence'; | ||
| import { getUsersInSpace } from '@/lib/data/db/iam/memberships'; | ||
| import { User } from '@/lib/data/user-schema'; | ||
|
|
||
| const OrganizationCompetencesPage = async ({ params }: { params: { environmentId: string } }) => { | ||
| const { user, userId } = await getCurrentUser(); | ||
| const { activeEnvironment } = await getCurrentEnvironment(params.environmentId); | ||
|
|
||
| if (user?.isGuest) return <UnauthorizedFallback />; | ||
|
|
||
| if (!env.PROCEED_PUBLIC_IAM_ACTIVE) return notFound(); | ||
|
|
||
| const msConfig = await getMSConfig(); | ||
| if (!msConfig.PROCEED_PUBLIC_COMPETENCE_MATCHING_ACTIVE) return notFound(); | ||
|
|
||
| // Only show for organization spaces | ||
| if (!activeEnvironment.isOrganization) return notFound(); | ||
|
|
||
| // TODO: Add authorization check - can('view', 'Competence') or can('manage', 'User') | ||
|
|
||
| // Fetch organization data | ||
| const spaceCompetences = await getAllSpaceCompetences(activeEnvironment.spaceId); | ||
| const organizationMembers = (await getUsersInSpace(activeEnvironment.spaceId)) as User[]; | ||
|
|
||
| return ( | ||
| <Content title="Organization Competences"> | ||
| <CompetencesDashboard | ||
| spaceId={activeEnvironment.spaceId} | ||
| initialSpaceCompetences={spaceCompetences} | ||
| organizationMembers={organizationMembers} | ||
| currentUserId={userId} | ||
| /> | ||
| </Content> | ||
| ); | ||
| }; | ||
|
|
||
| export default OrganizationCompetencesPage; |
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
34 changes: 34 additions & 0 deletions
34
src/management-system-v2/app/api/spaces/[spaceId]/competences/route.ts
This file contains hidden or 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,34 @@ | ||
| import { NextRequest, NextResponse } from 'next/server'; | ||
| import { getAllSpaceCompetences, getAllCompetencesOfUser } from '@/lib/data/db/competence'; | ||
| import { getCurrentUser } from '@/components/auth'; | ||
| import { getMSConfig } from '@/lib/ms-config/ms-config'; | ||
|
|
||
| export async function GET(request: NextRequest, { params }: { params: { spaceId: string } }) { | ||
| try { | ||
| const msConfig = await getMSConfig(); | ||
|
|
||
| // Check if competence matching is enabled via environment variable | ||
| if (!msConfig.PROCEED_PUBLIC_COMPETENCE_MATCHING_ACTIVE) { | ||
| return NextResponse.json({ error: 'Competence matching is not enabled' }, { status: 404 }); | ||
| } | ||
|
|
||
| const { userId } = await getCurrentUser(); | ||
|
|
||
| // Get all space competences | ||
| const spaceCompetences = await getAllSpaceCompetences(params.spaceId); | ||
|
|
||
| // Get user's claimed competences | ||
| const userCompetences = await getAllCompetencesOfUser(userId); | ||
|
|
||
| // Mark which competences are already claimed | ||
| const competencesWithClaimStatus = spaceCompetences.map((comp) => ({ | ||
| ...comp, | ||
| isClaimed: userCompetences.some((uc) => uc.competenceId === comp.id), | ||
| })); | ||
|
|
||
| return NextResponse.json(competencesWithClaimStatus); | ||
| } catch (error) { | ||
| console.error('Failed to fetch space competences:', error); | ||
| return NextResponse.json({ error: 'Failed to fetch competences' }, { status: 500 }); | ||
| } | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.