HotTRDealsBackend/services/profile/myProfileService.js

29 lines
589 B
JavaScript

const { PrismaClient } = require("@prisma/client")
const prisma = new PrismaClient()
async function updateAvatarUrl(userId, url) {
return await prisma.user.update({
where: { id: userId },
data: { avatarUrl: url },
select: { id: true, username: true, avatarUrl: true },
})
}
async function getUserProfile(userId) {
return await prisma.user.findUnique({
where: { id: userId },
select: {
id: true,
username: true,
email: true,
avatarUrl: true,
createdAt: true,
},
})
}
module.exports = {
updateAvatarUrl,
getUserProfile,
}