-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature Admin update role 187584923 (#36)
* [delivers #187584923] Delivered with testing * [finished #187584923] Feature admin should update user role * [finishes #187584923] Feature admin should update user role * mend * [finishes #187584923] Feature admin should update user role 1 * mend * mend * mend * mend * [delivers #187584915] Added user login (#35) * mend * mend * mend * mend * [delivers #187584923] Delivered with testing * [finished #187584923] Feature admin should update user role * mend * [finishes #187584923] Feature admin should update user role 1 * mend * mend * mend * mend * mend * mend * mend * mend * [Delivers #187584922] Admin should be able to disable an account (#25) * [Delivers #187584922] Admin should be able to disable an account * Admin should be able to disable or enable an account * Admin should be able to disable or enable an account * Admin should be able to disable or enable an account * Admin should be able to disable or enable an account * Admin should be able to disable or enable an account * Adjusted the database * DB adjusted * adjusted info * done rebase * mend * mend * [delivers #187584923] Delivered with testing * [finished #187584923] Feature admin should update user role * mend * mend * mend * mend * mend * mend * mend * mend * mend * [delivers #187584923] Delivered with testing * [finished #187584923] Feature admin should update user role * mend * [finishes #187584923] Feature admin should update user role 1 * mend * mend * mend * mend * mend * mend * mend * mend * mend * mend * [finishes #187584923] finishes fix the errors * mend * mend * mend * mend --------- Co-authored-by: Mr. David <[email protected]> Co-authored-by: Saddock Kabandana <[email protected]>
- Loading branch information
1 parent
64cf94d
commit 7582873
Showing
14 changed files
with
342 additions
and
113 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
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 was deleted.
Oops, something went wrong.
Binary file not shown.
Empty file.
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
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 |
---|---|---|
@@ -1,14 +1,35 @@ | ||
// user Controllers | ||
import { Request, Response } from "express"; | ||
import httpStatus from "http-status"; | ||
|
||
import authRepositories from "../../auth/repository/authRepositories"; | ||
import httpStatus from "http-status"; | ||
|
||
const updateUserRole = async (req: Request, res: Response) => { | ||
try { | ||
const data = await authRepositories.updateUserByAttributes("role", req.body.role, "id", req.params.id) | ||
return res.status(httpStatus.OK).json({ | ||
message: "User role updated successfully", | ||
data | ||
}); | ||
} catch (error) { | ||
return res.status(httpStatus.INTERNAL_SERVER_ERROR).json({ | ||
status: httpStatus.INTERNAL_SERVER_ERROR, | ||
message: error.message | ||
}); | ||
} | ||
}; | ||
|
||
|
||
const updateUserStatus = async (req: Request, res: Response): Promise<void> => { | ||
try { | ||
const userId: number = Number(req.params.id); | ||
const data = await authRepositories.UpdateUserByAttributes("status", req.body.status, "id", userId); | ||
const data = await authRepositories.updateUserByAttributes("status", req.body.status, "id", userId); | ||
res.status(httpStatus.OK).json({ message: "Status updated successfully.", data }); | ||
} catch (error) { | ||
res.status(httpStatus.INTERNAL_SERVER_ERROR).json({ status: httpStatus.INTERNAL_SERVER_ERROR, message: error.message }); | ||
} | ||
}; | ||
export default { updateUserStatus }; | ||
|
||
|
||
|
||
export default { updateUserStatus,updateUserRole }; |
Oops, something went wrong.