Added formatting

This commit is contained in:
Daniel Hougaard
2024-01-29 16:05:18 +04:00
parent 3eba4815c8
commit 3702d411ca
@@ -36,8 +36,19 @@ export const registerServiceTokenRouter = async (server: FastifyZodProvider) =>
actor: req.permission.type actor: req.permission.type
}); });
const formattedUser = {
...user,
_id: user.id,
__v: 0
} as const;
const formattedServiceToken = {
...serviceToken,
_id: serviceToken.id
} as const;
// We return the user here because older versions of the deprecated Python SDK depend on it to properly parse the API response. // We return the user here because older versions of the deprecated Python SDK depend on it to properly parse the API response.
return { ...serviceToken, workspace: serviceToken.projectId, user }; return { ...formattedServiceToken, workspace: serviceToken.projectId, user: formattedUser };
} }
}); });