Merge pull request #22 from internship-humic/fix/assign-active-project
fix: mengabaikan non-active project ketika assign member
This commit is contained in:
@@ -428,6 +428,9 @@ class ProjectRepository {
|
|||||||
in: userIds.map((id) => parseInt(id)),
|
in: userIds.map((id) => parseInt(id)),
|
||||||
},
|
},
|
||||||
status: "active",
|
status: "active",
|
||||||
|
project: {
|
||||||
|
status: "active"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
include: {
|
include: {
|
||||||
user: {
|
user: {
|
||||||
|
|||||||
@@ -541,6 +541,9 @@ class ProjectService {
|
|||||||
if (!project) {
|
if (!project) {
|
||||||
return error(new NotFoundError("Project not found"));
|
return error(new NotFoundError("Project not found"));
|
||||||
}
|
}
|
||||||
|
if (project.status !== "active") {
|
||||||
|
return error(new ConflictError("Cannot assign member to a non-active project"));
|
||||||
|
}
|
||||||
|
|
||||||
const user = await projectRepository.findUserByIdAndActive(id_user);
|
const user = await projectRepository.findUserByIdAndActive(id_user);
|
||||||
if (!user) {
|
if (!user) {
|
||||||
|
|||||||
@@ -853,7 +853,7 @@ router.get('/interns', verifyJWT, isMentorOrAdmin, projectController.getInterns)
|
|||||||
* 404:
|
* 404:
|
||||||
* description: Project or User not found
|
* description: Project or User not found
|
||||||
* 409:
|
* 409:
|
||||||
* description: Conflict (User is already an active member of this project)
|
* description: Conflict (User is already an active member of this project or target project is not active)
|
||||||
* 500:
|
* 500:
|
||||||
* description: Internal server error
|
* description: Internal server error
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user