49 lines
1.5 KiB
JavaScript
49 lines
1.5 KiB
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.findRenterProfile = findRenterProfile;
|
|
exports.findSavedCompanies = findSavedCompanies;
|
|
exports.updateRenterProfile = updateRenterProfile;
|
|
exports.updateRenterFcmToken = updateRenterFcmToken;
|
|
const prisma_1 = require("../../lib/prisma");
|
|
function findRenterProfile(id) {
|
|
return prisma_1.prisma.renter.findUniqueOrThrow({
|
|
where: { id },
|
|
select: {
|
|
id: true,
|
|
firstName: true,
|
|
lastName: true,
|
|
email: true,
|
|
phone: true,
|
|
preferredLocale: true,
|
|
preferredCurrency: true,
|
|
emailVerified: true,
|
|
savedCompanies: { select: { companyId: true } },
|
|
},
|
|
});
|
|
}
|
|
function findSavedCompanies(companyIds) {
|
|
return companyIds.length === 0
|
|
? Promise.resolve([])
|
|
: prisma_1.prisma.company.findMany({
|
|
where: { id: { in: companyIds } },
|
|
select: {
|
|
id: true,
|
|
brand: {
|
|
select: { displayName: true, subdomain: true, logoUrl: true },
|
|
},
|
|
},
|
|
});
|
|
}
|
|
function updateRenterProfile(id, data) {
|
|
return prisma_1.prisma.renter.update({
|
|
where: { id },
|
|
data,
|
|
});
|
|
}
|
|
function updateRenterFcmToken(id, fcmToken) {
|
|
return prisma_1.prisma.renter.update({
|
|
where: { id },
|
|
data: { fcmToken },
|
|
});
|
|
}
|
|
//# sourceMappingURL=auth.renter.repo.js.map
|