0f7af70b90
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.
23 lines
630 B
JavaScript
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,
|
|
};
|