Add getAddActivityPrePopulate handler and implement prepopulate data retrieval

- Introduced a new handler for adding activity prepopulation.
- Enhanced the PrePopulateService to fetch all necessary prepopulate data for the new activity.
- Updated the updateBankDetails handler to correctly inject host ID.
- Improved user data retrieval in HostService to include additional fields.
- Added validation for host ID in showSuggestionToAM handler.
This commit is contained in:
2025-12-17 16:17:55 +05:30
parent 8ec8cf4854
commit a906dc5635
6 changed files with 126 additions and 5 deletions

View File

@@ -43,7 +43,7 @@ export const handler = safeHandler(async (
// ✅ Validate payload using Zod
const validationResult = hostBankDetailsSchema.safeParse({
...(body as object),
hostXid: host.id, // inject hostId from token (not from user input)
hostXid: host.host.id, // inject hostId from token (not from user input)
});
if (!validationResult.success) {

View File

@@ -308,11 +308,14 @@ export class HostService {
select: {
id: true,
roleXid: true,
firstName: true,
lastName: true,
emailAddress: true,
mobileNumber: true,
userPassword: true,
userStatus: true
}
});
console.log(existingUser, "ajsbfkjd")
if (!existingUser) {
throw new ApiError(404, 'User not found');
@@ -991,7 +994,7 @@ export class HostService {
? { connect: { id: Number(parentCompanyData.countryXid) } }
: undefined,
pinCode: parentCompanyData.pinCode || null,
logoPath: parentCompanyData.logoPath || existingParentCompany.logoPath,
logoPath: parentCompanyData?.logoPath || existingParentCompany?.logoPath || null,
registrationNumber: parentCompanyData.registrationNumber || null,
panNumber: parentCompanyData.panNumber || null,
gstNumber: parentCompanyData.gstNumber || null,
@@ -1040,7 +1043,7 @@ export class HostService {
? { connect: { id: Number(parentCompanyData.countryXid) } }
: undefined,
pinCode: parentCompanyData.pinCode || null,
logoPath: parentCompanyData.logoPath || existingParentCompany.logoPath,
logoPath: parentCompanyData?.logoPath || existingParentCompany?.logoPath || null,
registrationNumber: parentCompanyData.registrationNumber || null,
panNumber: parentCompanyData.panNumber || null,
gstNumber: parentCompanyData.gstNumber || null,