u
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import * as db from '../../db/company.js';
|
||||
import * as googleAuth from '../../db/googleAuth.js';
|
||||
import { clearCachedUser } from '../middleware/auth.js';
|
||||
import { initCompanyVfs } from '../../tools/vfs.js';
|
||||
|
||||
function userPayload(authRow) {
|
||||
return {
|
||||
@@ -169,6 +170,11 @@ export function register(app, basePath = '') {
|
||||
const company = await db.createCompany(req.user.id, body);
|
||||
await googleAuth.setSelectedCompany(req.user.id, company.id);
|
||||
clearCachedUser(req.user.id);
|
||||
try {
|
||||
await initCompanyVfs({ googleAuthId: req.user.id });
|
||||
} catch (vfsErr) {
|
||||
console.error('Failed to initialize company VFS:', vfsErr);
|
||||
}
|
||||
const authRow = await googleAuth.getAllowedEmail(req.user.email);
|
||||
res.status(201).json({ company, user: userPayload(authRow) });
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user