sending the host ref number and company name and the energylevel in the list api
This commit is contained in:
@@ -107,7 +107,7 @@ const bucket = config.aws.bucketName;
|
||||
|
||||
@Injectable()
|
||||
export class HostService {
|
||||
constructor(private prisma: PrismaClient) {}
|
||||
constructor(private prisma: PrismaClient) { }
|
||||
|
||||
async createHost(data: CreateHostDto) {
|
||||
return this.prisma.user.create({ data });
|
||||
@@ -544,6 +544,14 @@ export class HostService {
|
||||
interestName: true,
|
||||
},
|
||||
},
|
||||
energyLevel: {
|
||||
select: {
|
||||
id: true,
|
||||
energyLevelName: true,
|
||||
energyIcon: true,
|
||||
energyColor: true
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -762,7 +770,7 @@ export class HostService {
|
||||
if (
|
||||
existingHostCompany &&
|
||||
existingHostCompany.hostStatusInternal ===
|
||||
HOST_STATUS_INTERNAL.HOST_TO_UPDATE &&
|
||||
HOST_STATUS_INTERNAL.HOST_TO_UPDATE &&
|
||||
!isDraft
|
||||
) {
|
||||
hostStatusInternal = HOST_STATUS_INTERNAL.HOST_SUBMITTED;
|
||||
@@ -775,7 +783,7 @@ export class HostService {
|
||||
else if (
|
||||
existingHostCompany &&
|
||||
existingHostCompany.hostStatusInternal ===
|
||||
HOST_STATUS_INTERNAL.HOST_TO_UPDATE &&
|
||||
HOST_STATUS_INTERNAL.HOST_TO_UPDATE &&
|
||||
isDraft
|
||||
) {
|
||||
// keep original
|
||||
@@ -886,19 +894,19 @@ export class HostService {
|
||||
// Safely handle city connection - only connect if valid ID exists
|
||||
cities:
|
||||
parentCompanyData?.cityXid &&
|
||||
!isNaN(Number(parentCompanyData.cityXid))
|
||||
!isNaN(Number(parentCompanyData.cityXid))
|
||||
? { connect: { id: Number(parentCompanyData.cityXid) } }
|
||||
: undefined,
|
||||
|
||||
states:
|
||||
parentCompanyData?.stateXid &&
|
||||
!isNaN(Number(parentCompanyData.stateXid))
|
||||
!isNaN(Number(parentCompanyData.stateXid))
|
||||
? { connect: { id: Number(parentCompanyData.stateXid) } }
|
||||
: undefined,
|
||||
|
||||
countries:
|
||||
parentCompanyData?.countryXid &&
|
||||
!isNaN(Number(parentCompanyData.countryXid))
|
||||
!isNaN(Number(parentCompanyData.countryXid))
|
||||
? { connect: { id: Number(parentCompanyData.countryXid) } }
|
||||
: undefined,
|
||||
pinCode: parentCompanyData.pinCode || null,
|
||||
@@ -1048,19 +1056,19 @@ export class HostService {
|
||||
address2: parentCompanyData.address2 || null,
|
||||
cities:
|
||||
parentCompanyData?.cityXid &&
|
||||
!isNaN(Number(parentCompanyData.cityXid))
|
||||
!isNaN(Number(parentCompanyData.cityXid))
|
||||
? { connect: { id: Number(parentCompanyData.cityXid) } }
|
||||
: undefined,
|
||||
|
||||
states:
|
||||
parentCompanyData?.stateXid &&
|
||||
!isNaN(Number(parentCompanyData.stateXid))
|
||||
!isNaN(Number(parentCompanyData.stateXid))
|
||||
? { connect: { id: Number(parentCompanyData.stateXid) } }
|
||||
: undefined,
|
||||
|
||||
countries:
|
||||
parentCompanyData?.countryXid &&
|
||||
!isNaN(Number(parentCompanyData.countryXid))
|
||||
!isNaN(Number(parentCompanyData.countryXid))
|
||||
? { connect: { id: Number(parentCompanyData.countryXid) } }
|
||||
: undefined,
|
||||
pinCode: parentCompanyData.pinCode || null,
|
||||
@@ -1106,19 +1114,19 @@ export class HostService {
|
||||
address2: parentCompanyData.address2 || null,
|
||||
cities:
|
||||
parentCompanyData?.cityXid &&
|
||||
!isNaN(Number(parentCompanyData.cityXid))
|
||||
!isNaN(Number(parentCompanyData.cityXid))
|
||||
? { connect: { id: Number(parentCompanyData.cityXid) } }
|
||||
: undefined,
|
||||
|
||||
states:
|
||||
parentCompanyData?.stateXid &&
|
||||
!isNaN(Number(parentCompanyData.stateXid))
|
||||
!isNaN(Number(parentCompanyData.stateXid))
|
||||
? { connect: { id: Number(parentCompanyData.stateXid) } }
|
||||
: undefined,
|
||||
|
||||
countries:
|
||||
parentCompanyData?.countryXid &&
|
||||
!isNaN(Number(parentCompanyData.countryXid))
|
||||
!isNaN(Number(parentCompanyData.countryXid))
|
||||
? { connect: { id: Number(parentCompanyData.countryXid) } }
|
||||
: undefined,
|
||||
pinCode: parentCompanyData.pinCode || null,
|
||||
@@ -2017,15 +2025,23 @@ export class HostService {
|
||||
// mobileNumber: true,
|
||||
// }
|
||||
// },
|
||||
// host: {
|
||||
// select: {
|
||||
// id: true,
|
||||
// companyName: true,
|
||||
// stepper: true,
|
||||
// adminStatusDisplay: true,
|
||||
// adminStatusInternal: true,
|
||||
// }
|
||||
// }
|
||||
host: {
|
||||
select: {
|
||||
id: true,
|
||||
companyName: true,
|
||||
stepper: true,
|
||||
adminStatusDisplay: true,
|
||||
adminStatusInternal: true,
|
||||
user: {
|
||||
select: {
|
||||
id: true,
|
||||
userRefNumber: true,
|
||||
firstName: true,
|
||||
lastName: true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
@@ -2486,9 +2502,9 @@ export class HostService {
|
||||
const rootTaxes =
|
||||
taxIds.length > 0
|
||||
? await this.prisma.taxes.findMany({
|
||||
where: { id: { in: taxIds }, isActive: true },
|
||||
select: { id: true, taxPer: true },
|
||||
})
|
||||
where: { id: { in: taxIds }, isActive: true },
|
||||
select: { id: true, taxPer: true },
|
||||
})
|
||||
: [];
|
||||
|
||||
if (taxIds.length !== rootTaxes.length) {
|
||||
|
||||
Reference in New Issue
Block a user