sending the presigned url in getAMDetailById
This commit is contained in:
@@ -1322,7 +1322,7 @@ export class MinglarService {
|
||||
}
|
||||
|
||||
async getAMdetailById(id: number) {
|
||||
return this.prisma.user.findUnique({
|
||||
const user = await this.prisma.user.findUnique({
|
||||
where: { id: id, isActive: true, userStatus: USER_STATUS.ACTIVE },
|
||||
include: {
|
||||
userAddressDetails: {
|
||||
@@ -1352,6 +1352,31 @@ export class MinglarService {
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const bucket = config.aws.bucketName;
|
||||
|
||||
if (user.userDocuments?.length) {
|
||||
for (const media of user.userDocuments) {
|
||||
|
||||
if (!media.fileName) continue;
|
||||
|
||||
// Extract S3 key if URL or keep raw key
|
||||
const key = media.fileName.startsWith("http")
|
||||
? media.fileName.split(".com/")[1]
|
||||
: media.fileName;
|
||||
|
||||
media.fileName = await getPresignedUrl(bucket, key);
|
||||
}
|
||||
}
|
||||
|
||||
if (user.profileImage) {
|
||||
const key = user.profileImage.startsWith('http')
|
||||
? user.profileImage.split('.com/')[1]
|
||||
: user.profileImage;
|
||||
|
||||
user.profileImage = await getPresignedUrl(bucket, key);
|
||||
}
|
||||
return user;
|
||||
}
|
||||
|
||||
async getBasicUserDetails(user_xid) {
|
||||
|
||||
Reference in New Issue
Block a user