-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2646 from objectcomputing/bugfix-2641/unconstrain…
…ed-review-assignments Bugfix 2641/unconstrained review assignments
- Loading branch information
Showing
5 changed files
with
80 additions
and
78 deletions.
There are no files selected for viewing
This file contains 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
7 changes: 7 additions & 0 deletions
7
server/src/main/resources/db/common/V115__review_assignments_modify_primary_key.sql
This file contains 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,7 @@ | ||
DELETE FROM review_assignments o USING review_assignments n | ||
WHERE o.id < n.id AND (o.reviewee_id = n.reviewee_id AND | ||
o.reviewer_id = n.reviewer_id AND | ||
o.review_period_id = n.review_period_id); | ||
|
||
ALTER TABLE review_assignments | ||
ADD CONSTRAINT unique_assignment UNIQUE (reviewee_id, reviewer_id, review_period_id) |
This file contains 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 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 { resolve } from './api.js'; | ||
|
||
const reviewAssignmentsUrl = '/services/review-assignments'; | ||
|
||
export const getReviewAssignments = async (id, cookie) => { | ||
return resolve({ | ||
url: `${reviewAssignmentsUrl}/period/${id}`, | ||
headers: { 'X-CSRF-Header': cookie, Accept: 'application/json' } | ||
}); | ||
}; | ||
|
||
export const createReviewAssignments = async (id, assignments, cookie) => { | ||
return resolve({ | ||
method: 'POST', | ||
url: `${reviewAssignmentsUrl}/${id}`, | ||
data: assignments, | ||
headers: { | ||
'X-CSRF-Header': cookie, | ||
Accept: 'application/json', | ||
'Content-Type': 'application/json;charset=UTF-8' | ||
} | ||
}); | ||
}; | ||
|
||
export const updateReviewAssignment = async (assignment, cookie) => { | ||
return resolve({ | ||
method: assignment.id === null ? 'POST' : 'PUT', | ||
url: reviewAssignmentsUrl, | ||
data: assignment, | ||
headers: { | ||
'X-CSRF-Header': cookie, | ||
Accept: 'application/json', | ||
'Content-Type': 'application/json;charset=UTF-8' | ||
} | ||
}); | ||
}; | ||
|
||
export const removeReviewAssignment = async (id, cookie) => { | ||
return resolve({ | ||
method: 'DELETE', | ||
url: `${reviewAssignmentsUrl}/${id}`, | ||
headers: { 'X-CSRF-Header': cookie } | ||
}); | ||
}; |
This file contains 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