Repository navigation
Swathi promotion eligibility button func #5574
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
base: development
Are you sure you want to change the base?
Changes from 21 commits
65e6eaa
5907637
595eae5
d7f0039
07d7179
325ad52
56a0cde
5853c6c
5090460
e1a7ff8
09a44e8
b439525
66b020b
be1acda
7fd6477
9a1841f
1501351
ac98c85
0952e47
7e1e951
62ccad8
b62cd15
651f26b
642f58c
06dbd1b
274d4bd
1468b4c
f3ba84c
4db4ebe
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,7 +2,9 @@ import axios from 'axios'; | |
| import { ENDPOINTS } from '../utils/URL'; | ||
|
|
||
| export const getPromotionEligibility = async requestor => { | ||
| const res = await axios.post(ENDPOINTS.PROMOTION_ELIGIBILITY, { requestor }); | ||
| const res = await axios.post(ENDPOINTS.PROMOTION_ELIGIBILITY, { | ||
| requestor, | ||
| }); | ||
| return res.data; | ||
| }; | ||
|
|
||
|
|
@@ -13,3 +15,194 @@ export const postPromotionEligibility = async (memberIds, requestor) => { | |
| }); | ||
| return res.data; | ||
| }; | ||
|
|
||
| export const fetchReviewerGroups = async currentUser => { | ||
| const res = await axios.post(ENDPOINTS.REVIEWER_GROUPS, { | ||
| requestor: currentUser, | ||
| }); | ||
|
|
||
| return res.data; | ||
| }; | ||
|
|
||
| export const createReviewerGroup = async (groupData, currentUser) => { | ||
| const res = await axios.post(ENDPOINTS.REVIEWER_GROUPS, { | ||
| ...groupData, | ||
| requestor: currentUser, | ||
| }); | ||
|
|
||
| return res.data; | ||
| }; | ||
|
|
||
| export const updateReviewerGroup = async (groupId, groupData, currentUser) => { | ||
| const res = await axios.put(`${ENDPOINTS.REVIEWER_GROUPS}/${groupId}`, { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The backend registers PATCH /reviewer-groups/:groupKey, not PUT. The actual current action returns 404 through the real router, with no update call; the PATCH control returns 200 and invokes the mocked update once. Please restore PATCH and keep passing the stable group key (the page already supplies selectedOption.key). |
||
| ...groupData, | ||
| requestor: currentUser, | ||
| }); | ||
|
|
||
| return res.data; | ||
| }; | ||
|
|
||
| /* ========================================================= | ||
| PR GRADING | ||
| ========================================================= */ | ||
|
|
||
| /** | ||
| * Get PR entries for multiple reviewers. | ||
| * | ||
| * Backend: | ||
| * POST /api/promotion-eligibility/pr-entries | ||
| */ | ||
| export const fetchPREntriesBulk = async (reviewerIds, currentUser) => { | ||
| const res = await axios.post(ENDPOINTS.PROMOTION_PR_ENTRIES_BULK, { | ||
| reviewerIds, | ||
| requestor: { | ||
| requestorId: currentUser?.userid, | ||
| }, | ||
| }); | ||
|
|
||
| return res.data; | ||
| }; | ||
|
|
||
| /** | ||
| * Get the available PR rating options. | ||
| * | ||
| * Backend: | ||
| * POST /api/promotion-eligibility/pr-ratings | ||
| */ | ||
| export const fetchPRRatings = async currentUser => { | ||
| const res = await axios.post(ENDPOINTS.PR_RATINGS, { | ||
| requestor: { | ||
| requestorId: currentUser?.userid, | ||
| }, | ||
| }); | ||
|
|
||
| return res.data; | ||
| }; | ||
|
|
||
| /** | ||
| * Get PR entries for a single reviewer. | ||
| * | ||
| * Backend: | ||
| * POST /api/promotion-eligibility/:reviewerId/pr-entries | ||
| */ | ||
| export const fetchPREntries = async (reviewerId, currentUser) => { | ||
| const res = await axios.post(ENDPOINTS.PROMOTION_PR_ENTRIES(reviewerId), { | ||
| requestor: { | ||
| requestorId: currentUser?.userid, | ||
| }, | ||
| }); | ||
|
|
||
| return res.data; | ||
| }; | ||
|
|
||
| /** | ||
| * Manually add a PR entry. | ||
| * | ||
| * Backend: | ||
| * POST /api/promotion-eligibility/:reviewerId/pr-entries/new | ||
| */ | ||
| export const addPREntry = async (reviewerId, prNumber, currentUser) => { | ||
| const res = await axios.post(ENDPOINTS.PR_GRADING_ADD_ENTRY(reviewerId), { | ||
| prNumber, | ||
| requestor: { | ||
| requestorId: currentUser?.userid, | ||
| }, | ||
| }); | ||
|
|
||
| return res.data; | ||
| }; | ||
|
|
||
| /** | ||
| * Import PR entries from the weekly summary. | ||
| * | ||
| * Backend: | ||
| * POST /api/promotion-eligibility/:reviewerId/pr-entries/import | ||
| */ | ||
| export const importPREntries = async (reviewerId, currentUser) => { | ||
| const res = await axios.post(`${ENDPOINTS.PROMOTION_PR_ENTRIES(reviewerId)}/import`, { | ||
| requestor: { | ||
| requestorId: currentUser?.userid, | ||
| }, | ||
| }); | ||
|
|
||
| return res.data; | ||
| }; | ||
|
|
||
| /** | ||
| * Update or clear a PR rating. | ||
| * | ||
| * Backend: | ||
| * PATCH /api/promotion-eligibility/pr-entries/:entryId/rating | ||
| */ | ||
| export const updatePRRating = async (entryId, rating, currentUser) => { | ||
| const res = await axios.patch(ENDPOINTS.PR_GRADING_UPDATE_RATING(entryId), { | ||
| rating, | ||
| requestor: { | ||
| requestorId: currentUser?.userid, | ||
| }, | ||
| }); | ||
|
|
||
| return res.data; | ||
| }; | ||
|
|
||
| /** | ||
| * Owner override for PRs Needed. | ||
| * | ||
| * Sending a number sets an override. | ||
| * Sending null clears the override and returns to automatic | ||
| * committed-hours calculation. | ||
| * | ||
| * Backend: | ||
| * PATCH /api/promotion-eligibility/:reviewerId/prs-needed | ||
| */ | ||
| export const updatePRsNeeded = async (reviewerId, prsNeeded, currentUser) => { | ||
| const res = await axios.patch(`${ENDPOINTS.PROMOTION_ELIGIBILITY}/${reviewerId}/prs-needed`, { | ||
| prsNeeded, | ||
| requestor: { | ||
| requestorId: currentUser?.userid, | ||
| }, | ||
| }); | ||
|
|
||
| return res.data; | ||
| }; | ||
|
|
||
| /** | ||
| * Preview promotion team placements. | ||
| * | ||
| * Backend: | ||
| * POST /api/promote-members/preview | ||
| * | ||
| * This does NOT promote anyone or modify team membership. | ||
| */ | ||
| export const previewPromotionEligibility = async (memberIds, requestor) => { | ||
| const res = await axios.post(ENDPOINTS.PROMOTE_MEMBERS_PREVIEW, { | ||
| memberIds, | ||
| requestor, | ||
| }); | ||
|
|
||
| return res.data; | ||
| }; | ||
|
|
||
| /** | ||
| * Process promotions and optionally assign reviewers to teams. | ||
| * | ||
| * Backend: | ||
| * POST /api/promote-members | ||
| * | ||
| * placements: | ||
| * [ | ||
| * { | ||
| * reviewerId: '...', | ||
| * teamId: '...' | ||
| * } | ||
| * ] | ||
| */ | ||
| export const processPromotions = async (memberIds, requestor, placements) => { | ||
| const res = await axios.post(ENDPOINTS.PROMOTE_MEMBERS, { | ||
| memberIds, | ||
| requestor, | ||
| placements, | ||
| }); | ||
|
|
||
| return res.data; | ||
| }; | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This follow-up changes create to the collection read URL. The current backend intentionally uses POST /reviewer-groups for listing and POST /reviewer-groups/new for creation. Running this actual action through the real router/controller returns 200 with { groups, warnings } and zero create calls, even with an allowed Owner requestor. Please use REVIEWER_GROUPS_NEW again and cover the routed create response. The correct /new control returns 201 and invokes the mocked create once.