archetecture security fix
This commit is contained in:
+43
@@ -0,0 +1,43 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.presentEmployeeSession = presentEmployeeSession;
|
||||
exports.presentCompanySignup = presentCompanySignup;
|
||||
exports.presentRenterProfile = presentRenterProfile;
|
||||
function presentEmployeeSession(employee, token) {
|
||||
const data = {
|
||||
employee: {
|
||||
id: employee.id,
|
||||
email: employee.email,
|
||||
firstName: employee.firstName,
|
||||
lastName: employee.lastName,
|
||||
role: employee.role,
|
||||
preferredLanguage: employee.preferredLanguage,
|
||||
companyId: employee.companyId,
|
||||
companyName: employee.company.name,
|
||||
companySlug: employee.company.slug,
|
||||
},
|
||||
};
|
||||
return token ? { token, ...data } : data;
|
||||
}
|
||||
function presentCompanySignup(result) {
|
||||
return {
|
||||
companyId: result.company.id,
|
||||
companyName: result.company.name,
|
||||
slug: result.company.slug,
|
||||
invitationId: null,
|
||||
trialEndsAt: result.trialEndAt.toISOString(),
|
||||
nextStep: 'workspace_created',
|
||||
emailDelivery: result.emailDelivery ?? { attempted: false, success: false, error: null },
|
||||
};
|
||||
}
|
||||
function presentRenterProfile(renter, companies) {
|
||||
const companyMap = new Map(companies.map((company) => [company.id, company]));
|
||||
return {
|
||||
...renter,
|
||||
savedCompanies: renter.savedCompanies.map((savedCompany) => ({
|
||||
id: savedCompany.companyId,
|
||||
brand: companyMap.get(savedCompany.companyId)?.brand ?? null,
|
||||
})),
|
||||
};
|
||||
}
|
||||
//# sourceMappingURL=auth.presenter.js.map
|
||||
Reference in New Issue
Block a user