chore: Remove redundant roleId from user serializer

This commit is contained in:
Faruk AYDIN
2024-02-23 01:30:57 +01:00
parent 14923d4cd6
commit 3abf61152a
5 changed files with 2 additions and 6 deletions

View File

@@ -9,7 +9,6 @@ const userSerializer = (user) => {
createdAt: user.createdAt,
updatedAt: user.updatedAt,
fullName: user.fullName,
roleId: user.roleId,
};
if (user.role) {

View File

@@ -33,7 +33,6 @@ describe('userSerializer', () => {
email: user.email,
fullName: user.fullName,
id: user.id,
roleId: user.roleId,
updatedAt: user.updatedAt,
};

View File

@@ -15,7 +15,6 @@ const getCurrentUserMock = (currentUser, role) => {
name: role.name,
updatedAt: role.updatedAt.toISOString(),
},
roleId: role.id,
trialExpiryDate: currentUser.trialExpiryDate.toISOString(),
updatedAt: currentUser.updatedAt.toISOString(),
},

View File

@@ -14,7 +14,6 @@ const getUserMock = (currentUser, role) => {
name: role.name,
updatedAt: role.updatedAt.toISOString(),
},
roleId: role.id,
trialExpiryDate: currentUser.trialExpiryDate.toISOString(),
updatedAt: currentUser.updatedAt.toISOString(),
},

View File

@@ -1,6 +1,7 @@
const getUsersMock = async (users, roles) => {
const data = users.map((user) => {
const role = roles.find((r) => r.id === user.roleId);
return {
createdAt: user.createdAt.toISOString(),
email: user.email,
@@ -16,8 +17,7 @@ const getUsersMock = async (users, roles) => {
name: role.name,
updatedAt: role.updatedAt.toISOString(),
}
: null, // Fallback to null if role not found
roleId: user.roleId,
: null,
trialExpiryDate: user.trialExpiryDate.toISOString(),
updatedAt: user.updatedAt.toISOString(),
};