Files
quicklanch-server/dist/app/modules/profile/profile.service.js
T
abumahid 0f7af70b90 ♻️ refactor(account, order, plan, profile, support, email): restructure application modules and enhance error handling
Updated Docker configuration, refactored middleware for improved error handling, and restructured account, order, plan, profile, and support modules, including their routes, services, and validations. Enhanced email processing queues and utilities for token generation, pagination, and response management to streamline the application architecture and enhance maintainability.
2026-04-21 03:12:39 +06:00

23 lines
630 B
JavaScript

import uploadCloud from "../../utils/cloudinary.js";
import { prisma } from "../../lib/prisma.js";
const update_profile_into_db = async (req) => {
const user = req?.user;
const payload = req?.body;
const file = req?.file;
// check file and upload to cloud
if (file) {
const cloudRes = await uploadCloud(file);
payload.profilePhoto = cloudRes?.secure_url;
}
const result = await prisma.profile.update({
where: {
accountId: user.accountId,
},
data: payload,
});
return result;
};
export const profile_service = {
update_profile_into_db,
};