Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[_] feat: added rootFolderId (uuid) to refresh endpoint #459

Merged
merged 1 commit into from
Oct 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/app/routes/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import NewsletterRoutes from './newsletter';
import UserRoutes from './user';
import AnalyticsRoutes from './analytics';
import { Sign, passportAuth } from '../middleware/passport';
import { Sign, passportAuth, SignNewToken } from '../middleware/passport';
import logger from '../../lib/logger';
import * as ReCaptchaV3 from '../../lib/recaptcha';
import * as AnalyticsService from '../../lib/analytics/AnalyticsService';
Expand Down Expand Up @@ -58,7 +58,7 @@
const { publicKey, privateKey, revocateKey } = req.body;
const userData: any = (req as AuthorizedUser).user;

let [keys, userBucket] = await Promise.all([

Check failure on line 61 in src/app/routes/routes.ts

View workflow job for this annotation

GitHub Actions / run-tests (16.x)

'userBucket' is never reassigned. Use 'const' instead

Check failure on line 61 in src/app/routes/routes.ts

View workflow job for this annotation

GitHub Actions / build (16.x)

'userBucket' is never reassigned. Use 'const' instead
service.KeyServer.getKeys(userData),
service.User.GetUserBucket(userData),
]);
Expand All @@ -71,12 +71,16 @@
}

const token = Sign(userData.email, App.config.get('secrets').JWT, true);
const newToken = SignNewToken(userData, App.config.get('secrets').JWT, true);

const rootFolder = await service.Folder.getById(userData.root_folder_id);

const user = {
email: userData.email,
userId: userData.userId,
mnemonic: userData.mnemonic,
root_folder_id: userData.root_folder_id,
rootFolderId: rootFolder?.uuid,
name: userData.name,
lastname: userData.lastname,
uuid: userData.uuid,
Expand All @@ -99,7 +103,7 @@
lastPasswordChangedAt: userData.lastPasswordChangedAt,
};

res.status(200).json({ user, token });
res.status(200).json({ user, token, newToken });
});

router.post('/initialize', async (req, res) => {
Expand Down
Loading