Merge branch 'sprint1' of http://git.wdipl.com/Mayank.Mishra/MinglarBackendNestJS into paritosh
This commit is contained in:
@@ -25,23 +25,23 @@ export const MINGLAR_INVITATION_STATUS = {
|
||||
INVITED: 'Invited',
|
||||
};
|
||||
|
||||
export const HOST_SUGGESTION_TITLES = {
|
||||
COMPANY_DETAILS: 'Complete Details',
|
||||
COMPANY_DOCUMENTATION: 'Company documentataion',
|
||||
COMPANY_SOCIAL_PROOF: 'Social Proof',
|
||||
ACTIVITY_INFORMATION: 'Activity Information',
|
||||
ACTIVITY_LOCATION: 'Activity Location',
|
||||
PICKUP_DROP_LOCATION: 'Pickup-Drop Location',
|
||||
NUMBER_OF_PEOPLE: 'Number of People',
|
||||
INCLUSION: 'Inclusion',
|
||||
TAX_SETUP: 'Tax Setup',
|
||||
ENERGY_LEVEL: 'Energy Level',
|
||||
ELIGIBILITY_CRITERIA: 'Eligibility Criteria',
|
||||
AMENITIES: 'Amenities',
|
||||
EXLUSIVE_NOTES: 'Exclusive Notes',
|
||||
CANCELLATION_POLICY: 'Cancellation Policy',
|
||||
DOs_AND_DONTs: 'Do’s and Dont’s',
|
||||
TIPS_FOR_USERS: 'Tips for Users',
|
||||
SUSTAINABILITY: 'Sustainability',
|
||||
TERMS_AND_CONDITION_FOR_USER: 'Terms and Conditions for User'
|
||||
};
|
||||
// export const HOST_SUGGESTION_TITLES = {
|
||||
// COMPANY_DETAILS: 'Complete Details',
|
||||
// COMPANY_DOCUMENTATION: 'Company documentataion',
|
||||
// COMPANY_SOCIAL_PROOF: 'Social Proof',
|
||||
// ACTIVITY_INFORMATION: 'Activity Information',
|
||||
// ACTIVITY_LOCATION: 'Activity Location',
|
||||
// PICKUP_DROP_LOCATION: 'Pickup-Drop Location',
|
||||
// NUMBER_OF_PEOPLE: 'Number of People',
|
||||
// INCLUSION: 'Inclusion',
|
||||
// TAX_SETUP: 'Tax Setup',
|
||||
// ENERGY_LEVEL: 'Energy Level',
|
||||
// ELIGIBILITY_CRITERIA: 'Eligibility Criteria',
|
||||
// AMENITIES: 'Amenities',
|
||||
// EXLUSIVE_NOTES: 'Exclusive Notes',
|
||||
// CANCELLATION_POLICY: 'Cancellation Policy',
|
||||
// DOs_AND_DONTs: 'Do’s and Dont’s',
|
||||
// TIPS_FOR_USERS: 'Tips for Users',
|
||||
// SUSTAINABILITY: 'Sustainability',
|
||||
// TERMS_AND_CONDITION_FOR_USER: 'Terms and Conditions for User'
|
||||
// };
|
||||
|
||||
@@ -100,8 +100,19 @@ export class HostService {
|
||||
companyTypeName: true,
|
||||
},
|
||||
},
|
||||
HostSuggestion: true,
|
||||
HostTrack: true,
|
||||
HostSuggestion: {
|
||||
where: {
|
||||
isActive: true,
|
||||
isreviewed: false,
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
hostXid: true,
|
||||
title: true,
|
||||
comments: true,
|
||||
isparent: true,
|
||||
}
|
||||
},
|
||||
countries: true,
|
||||
currencies: true,
|
||||
states: true,
|
||||
@@ -350,6 +361,7 @@ export class HostService {
|
||||
where: { id: hostDetails.id },
|
||||
data: {
|
||||
stepper: STEPPER.AGREEMENT_ACCEPTED,
|
||||
isApproved: true,
|
||||
agreementAccepted: true,
|
||||
},
|
||||
});
|
||||
|
||||
@@ -4,7 +4,6 @@ import { PrismaService } from '../../../../../common/database/prisma.service';
|
||||
import { MinglarService } from '../../../services/minglar.service';
|
||||
import ApiError from '../../../../../common/utils/helper/ApiError';
|
||||
import { verifyMinglarAdminToken } from '../../../../../common/middlewares/jwt/authForMinglarAdmin';
|
||||
import { HOST_SUGGESTION_TITLES } from '../../../../../common/utils/constants/minglar.constant';
|
||||
|
||||
const prismaService = new PrismaService();
|
||||
const minglarService = new MinglarService(prismaService);
|
||||
@@ -69,10 +68,10 @@ export const handler = safeHandler(async (
|
||||
}
|
||||
|
||||
// Validate title is one of the allowed types
|
||||
const allowedTitles = Object.values(HOST_SUGGESTION_TITLES);
|
||||
if (!allowedTitles.includes(title)) {
|
||||
throw new ApiError(400, `Invalid title. Allowed values: ${allowedTitles.join(', ')}`);
|
||||
}
|
||||
// const allowedTitles = Object.values(HOST_SUGGESTION_TITLES);
|
||||
// if (!allowedTitles.includes(title)) {
|
||||
// throw new ApiError(400, `Invalid title. Allowed values: ${allowedTitles.join(', ')}`);
|
||||
// }
|
||||
|
||||
// Add suggestion using service
|
||||
await minglarService.addHostSuggestion(hostXid, title, comments, user.id, isParent);
|
||||
|
||||
@@ -28,6 +28,8 @@ import { getPresignedUrl } from '@/common/middlewares/aws/getPreSignedUrl';
|
||||
import config from '@/config/config';
|
||||
import { PaginationOptions } from '@/common/utils/pagination/pagination.types';
|
||||
|
||||
const bucket = config.aws.bucketName;
|
||||
|
||||
@Injectable()
|
||||
export class MinglarService {
|
||||
constructor(private prisma: PrismaService) { }
|
||||
@@ -264,8 +266,6 @@ export class MinglarService {
|
||||
},
|
||||
});
|
||||
|
||||
const bucket = config.aws.bucketName;
|
||||
|
||||
// Process each activity
|
||||
for (const activity of hostActivities) {
|
||||
|
||||
@@ -786,6 +786,7 @@ export class MinglarService {
|
||||
emailAddress: true,
|
||||
mobileNumber: true,
|
||||
userRefNumber: true,
|
||||
profileImage: true
|
||||
},
|
||||
},
|
||||
accountManager: {
|
||||
@@ -796,6 +797,7 @@ export class MinglarService {
|
||||
emailAddress: true,
|
||||
mobileNumber: true,
|
||||
roleXid: true,
|
||||
profileImage: true
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -804,6 +806,18 @@ export class MinglarService {
|
||||
take: paginationOptions?.limit || 10,
|
||||
});
|
||||
|
||||
for (const user of results) {
|
||||
const am = user.accountManager;
|
||||
|
||||
if (am?.profileImage) {
|
||||
const key = am.profileImage.startsWith("http")
|
||||
? am.profileImage.split(".com/")[1]
|
||||
: am.profileImage;
|
||||
|
||||
am.profileImage = await getPresignedUrl(bucket, key);
|
||||
}
|
||||
}
|
||||
|
||||
const transformedData = results.map((h) => ({
|
||||
hostId: h.id,
|
||||
host: h.user,
|
||||
@@ -917,7 +931,6 @@ export class MinglarService {
|
||||
take: paginationOptions?.limit ?? undefined,
|
||||
});
|
||||
|
||||
const bucket = config.aws.bucketName;
|
||||
|
||||
/** ---------------------------------
|
||||
* Add presigned URL for AM profile
|
||||
@@ -1050,7 +1063,6 @@ export class MinglarService {
|
||||
take: paginationOptions?.limit ?? 10,
|
||||
});
|
||||
|
||||
const bucket = config.aws.bucketName;
|
||||
|
||||
/** ---------------------------------
|
||||
* Add presigned URL for AM profile
|
||||
@@ -1098,6 +1110,7 @@ export class MinglarService {
|
||||
},
|
||||
isActive: true,
|
||||
userStatus: USER_STATUS.ACTIVE,
|
||||
isProfileUpdated: true,
|
||||
...searchFilter,
|
||||
},
|
||||
include: {
|
||||
@@ -1287,7 +1300,6 @@ export class MinglarService {
|
||||
comments: comments,
|
||||
isparent: isParent,
|
||||
isreviewed: false,
|
||||
reviewedByXid: reviewedByXid,
|
||||
reviewOn: null,
|
||||
isActive: true,
|
||||
},
|
||||
@@ -1405,7 +1417,6 @@ export class MinglarService {
|
||||
amountPerBooking: amountPerBooking ? Number(amountPerBooking) : null, // Convert to number if exists
|
||||
payoutDurationNum: Number(payoutDurationNum), // Convert to number
|
||||
payoutDurationFrequency: payoutDurationFrequency,
|
||||
isApproved: true,
|
||||
hostStatusInternal: HOST_STATUS_INTERNAL.HOST_SUBMITTED,
|
||||
hostStatusDisplay: HOST_STATUS_DISPLAY.UNDER_REVIEW,
|
||||
adminStatusInternal: MINGLAR_STATUS_INTERNAL.AM_NOT_ASSIGNED,
|
||||
@@ -1531,7 +1542,6 @@ export class MinglarService {
|
||||
},
|
||||
});
|
||||
|
||||
const bucket = config.aws.bucketName;
|
||||
|
||||
if (user.userDocuments?.length) {
|
||||
for (const media of user.userDocuments) {
|
||||
@@ -1611,6 +1621,24 @@ export class MinglarService {
|
||||
documentType: true
|
||||
}
|
||||
},
|
||||
cities: {
|
||||
select: {
|
||||
id: true,
|
||||
cityName: true,
|
||||
}
|
||||
},
|
||||
countries: {
|
||||
select: {
|
||||
id: true,
|
||||
countryName: true
|
||||
}
|
||||
},
|
||||
states: {
|
||||
select: {
|
||||
id: true,
|
||||
stateName: true
|
||||
}
|
||||
},
|
||||
companyTypes: {
|
||||
select: {
|
||||
id: true,
|
||||
@@ -1646,7 +1674,6 @@ export class MinglarService {
|
||||
},
|
||||
});
|
||||
|
||||
const bucket = config.aws.bucketName;
|
||||
|
||||
if (host.HostDocuments?.length) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user