Files
quicklanch-server/dist/app/modules/profile/profile.service.js
T

23 lines
630 B
JavaScript
Raw Normal View History

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,
};