Skip to content

Commit df1040c

Browse files
authored
Merge pull request #2225 from Real-Dev-Squad/develop
Dev to Main Sync
2 parents a74136b + 2097bb7 commit df1040c

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

controllers/users.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,13 +390,27 @@ const generateUsername = async (req, res) => {
390390
* @param req {Object} - Express request object
391391
* @param res {Object} - Express response object
392392
*/
393-
393+
/**
394+
* @deprecated
395+
* WARNING: This API endpoint is being deprecated and will be removed in future versions.
396+
* Please use the updated API endpoint: `/users?profile=true` for retrieving user profile details.
397+
*
398+
* For more information, refer to this PR:
399+
* https://github.com/Real-Dev-Squad/website-backend/pull/2201
400+
*
401+
* This API is kept temporarily for backward compatibility.
402+
*/
394403
const getSelfDetails = async (req, res) => {
395404
try {
396405
if (req.userData) {
397406
const user = await dataAccess.retrieveUsers({
398407
userdata: req.userData,
399408
});
409+
410+
res.set(
411+
"X-Deprecation-Warning",
412+
"WARNING: This endpoint is deprecated and will be removed in the future. Please use /users?profile=true to get the updated profile details."
413+
);
400414
return res.send(user);
401415
}
402416
return res.boom.notFound("User doesn't exist");

test/integration/users.test.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -978,6 +978,11 @@ describe("Users", function () {
978978
expect(res.body).to.not.have.property("phone");
979979
expect(res.body).to.not.have.property("email");
980980
expect(res.body).to.not.have.property("chaincode");
981+
expect(res).to.have.header(
982+
"X-Deprecation-Warning",
983+
"WARNING: This endpoint is deprecated and will be removed in the future. Please use /users?profile=true to get the updated profile details."
984+
);
985+
981986
return done();
982987
});
983988
});

0 commit comments

Comments
 (0)