Add ActivityTrack model to schema and update User and Activities models to include activityTracks relation. Modify seed data to reflect new interest names and activity types. Implement activity reference number generation in HostService for activity creation.

This commit is contained in:
2025-12-02 13:42:14 +05:30
parent 3f921febe0
commit e72c260b18
5 changed files with 199 additions and 73 deletions

View File

@@ -192,6 +192,18 @@ export class MinglarService {
isActive: true,
userStatus: USER_STATUS.ACTIVE,
},
select: {
id: true,
firstName: true,
lastName: true,
emailAddress: true,
mobileNumber: true,
roleXid: true,
isProfileUpdated: true,
userStatus: true,
profileImage: true,
userPassword: true,
}
});
if (!existingUser) {
@@ -214,6 +226,16 @@ export class MinglarService {
throw new ApiError(401, 'Invalid credentials');
}
if (existingUser?.profileImage) {
const key = existingUser.profileImage.startsWith("http")
? existingUser.profileImage.split(".com/")[1]
: existingUser.profileImage;
existingUser.profileImage = await getPresignedUrl(bucket, key);
}
delete existingUser.userPassword;
return existingUser;
}
@@ -742,19 +764,36 @@ export class MinglarService {
}
/** APPLICATION STATUS FILTER (NEW) **/
const APPLICATION_STATUS_MAP: Record<string, string> = {
"New": MINGLAR_STATUS_INTERNAL.AM_TO_REVIEW && MINGLAR_STATUS_DISPLAY.NEW,
"To_Review": MINGLAR_STATUS_INTERNAL.AM_TO_REVIEW && MINGLAR_STATUS_DISPLAY.TO_REVIEW,
"Enchancing": MINGLAR_STATUS_INTERNAL.AM_REJECTED,
const APPLICATION_STATUS_MAP: Record<
string,
{ internal: string; display: string }
> = {
New: {
internal: MINGLAR_STATUS_INTERNAL.AM_TO_REVIEW,
display: MINGLAR_STATUS_DISPLAY.NEW,
},
To_Review: {
internal: MINGLAR_STATUS_INTERNAL.AM_TO_REVIEW,
display: MINGLAR_STATUS_DISPLAY.TO_REVIEW,
},
Enhancing: {
internal: MINGLAR_STATUS_INTERNAL.AM_REJECTED,
display: MINGLAR_STATUS_DISPLAY.ENHANCING,
},
};
if (applicationStatus?.trim()) {
const key = applicationStatus.trim();
if (APPLICATION_STATUS_MAP[key]) {
filters.adminStatusInternal = APPLICATION_STATUS_MAP[key];
const statusObj = APPLICATION_STATUS_MAP[key];
if (statusObj) {
filters.adminStatusInternal = statusObj.internal;
filters.adminStatusDisplay = statusObj.display;
}
}
/** ROLE-BASED FILTER **/
if (userRoleXid === ROLE.CO_ADMIN || userRoleXid === ROLE.ACCOUNT_MANAGER) {
filters.accountManagerXid = userId;
@@ -1513,7 +1552,21 @@ export class MinglarService {
async getAMdetailById(id: number) {
const user = await this.prisma.user.findUnique({
where: { id: id, isActive: true, userStatus: USER_STATUS.ACTIVE },
include: {
select: {
id: true,
firstName: true,
lastName: true,
emailAddress: true,
isdCode: true,
mobileNumber: true,
roleXid: true,
userStatus: true,
isProfileUpdated: true,
dateOfBirth: true,
profileImage: true,
isEmailVerfied: true,
isMobileVerfied: true,
isBiometric: true,
userAddressDetails: {
select: {
id: true,