sending the presigned url in getAMDetailById
This commit is contained in:
@@ -335,14 +335,14 @@ export const handler = safeHandler(async (event: APIGatewayProxyEvent): Promise<
|
||||
details.hostDetails.accountManager.emailAddress,
|
||||
details.hostDetails.accountManager.firstName,
|
||||
details.hostDetails.companyName,
|
||||
details.hostDetails.hostRefNumber,
|
||||
details.hostDetails.user.userRefNumber,
|
||||
);
|
||||
} else {
|
||||
await sendEmailToMinglarAdmin(
|
||||
config.MinglarAdminEmail,
|
||||
config.MinglarAdminName,
|
||||
details.hostDetails.companyName,
|
||||
details.hostDetails.hostRefNumber,
|
||||
details.hostDetails.user.userRefNumber,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -359,7 +359,6 @@ export const handler = safeHandler(async (event: APIGatewayProxyEvent): Promise<
|
||||
message: isDraft ? 'Company details saved as draft successfully.' : 'Company details uploaded successfully.',
|
||||
data: {
|
||||
id: createdOrUpdated.id,
|
||||
hostRefNumber: createdOrUpdated.hostRefNumber,
|
||||
isDraft,
|
||||
},
|
||||
}),
|
||||
|
||||
@@ -720,6 +720,7 @@ export class HostService {
|
||||
id: true,
|
||||
emailAddress: true,
|
||||
firstName: true,
|
||||
userRefNumber: true
|
||||
},
|
||||
},
|
||||
accountManager: {
|
||||
|
||||
@@ -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