diff --git a/src/api/enrollment/participant/participant.controller.delegate.ts b/src/api/enrollment/participant/participant.controller.delegate.ts index c10f9a3..84f59d0 100644 --- a/src/api/enrollment/participant/participant.controller.delegate.ts +++ b/src/api/enrollment/participant/participant.controller.delegate.ts @@ -133,6 +133,10 @@ export class ParticipantControllerDelegate { if (lastUpdatedByUserId != null) { filters['LastUpdatedByUserId'] = lastUpdatedByUserId; } + var phone = query.phone ? query.phone : null; + if (phone != null) { + filters['Phone'] = phone; + } return filters; }; diff --git a/src/api/user/user.controller.delegate.ts b/src/api/user/user.controller.delegate.ts index 0f2b5f4..f41e76c 100644 --- a/src/api/user/user.controller.delegate.ts +++ b/src/api/user/user.controller.delegate.ts @@ -178,8 +178,8 @@ export class UserControllerDelegate { sendOtp = async (requestBody) => { await validator.validateSendOtpRequest(requestBody); - const countryCode = (typeof requestBody.CountryCode !== undefined) ? requestBody.CountryCode : '+91'; - const phone = (typeof requestBody.Phone !== undefined) ? requestBody.Phone : null; + const countryCode = (requestBody.CountryCode) ? requestBody.CountryCode : '+91'; + const phone = (requestBody.Phone) ? requestBody.Phone : null; const user = await this._service.getUser(countryCode, phone, null, null); if (user === null) { ErrorHandler.throwNotFoundError('User does not exist!'); diff --git a/src/common/helper.ts b/src/common/helper.ts index 3fa7707..e2c3501 100644 --- a/src/common/helper.ts +++ b/src/common/helper.ts @@ -325,14 +325,14 @@ export class Helper { }; static checkStr(val: any) { - if (typeof val === null || typeof val === undefined || typeof val !== 'string') { + if (val === null || val === undefined || typeof val !== 'string') { return null; } return val; } static isStr(val: any): boolean { - if (typeof val === null || typeof val === undefined || typeof val !== 'string') { + if (val === null || val === undefined || typeof val !== 'string') { return false; } return true; diff --git a/src/database/models/api.client.model.ts b/src/database/models/api.client.model.ts index 8f7da77..1b002c9 100644 --- a/src/database/models/api.client.model.ts +++ b/src/database/models/api.client.model.ts @@ -85,7 +85,7 @@ export class ApiClientModel { tableName : ApiClientModel.TableName, }); - static associate = (models) => { + static associate = () => { //Add associations here... // models.ApiClient.belongsTo(models.User, { diff --git a/src/database/models/assets/action.plan.model.ts b/src/database/models/assets/action.plan.model.ts index cd7aa74..7f7f782 100644 --- a/src/database/models/assets/action.plan.model.ts +++ b/src/database/models/assets/action.plan.model.ts @@ -79,7 +79,7 @@ export class ActionPlanModel { tableName : ActionPlanModel.TableName, }); - static associate = (models) => { + static associate = () => { //Add associations here... diff --git a/src/database/models/assets/appointment.model.ts b/src/database/models/assets/appointment.model.ts index 6cb894d..f953694 100644 --- a/src/database/models/assets/appointment.model.ts +++ b/src/database/models/assets/appointment.model.ts @@ -85,7 +85,7 @@ export class AppointmentModel { tableName : AppointmentModel.TableName, }); - static associate = (models) => { + static associate = () => { //Add associations here... diff --git a/src/database/models/assets/assessment.model.ts b/src/database/models/assets/assessment.model.ts index 5700783..c0034a6 100644 --- a/src/database/models/assets/assessment.model.ts +++ b/src/database/models/assets/assessment.model.ts @@ -92,7 +92,7 @@ export class AssessmentModel { tableName : AssessmentModel.TableName, }); - static associate = (models) => { + static associate = () => { //Add associations here... diff --git a/src/database/models/assets/biometrics.model.ts b/src/database/models/assets/biometrics.model.ts index a85fc46..441952e 100644 --- a/src/database/models/assets/biometrics.model.ts +++ b/src/database/models/assets/biometrics.model.ts @@ -89,7 +89,7 @@ export class BiometricsModel { tableName : BiometricsModel.TableName, }); - static associate = (models) => { + static associate = () => { //Add associations here... diff --git a/src/database/models/assets/challenge.model.ts b/src/database/models/assets/challenge.model.ts index be3161b..ecdaa89 100644 --- a/src/database/models/assets/challenge.model.ts +++ b/src/database/models/assets/challenge.model.ts @@ -79,7 +79,7 @@ export class ChallengeModel { tableName : ChallengeModel.TableName, }); - static associate = (models) => { + static associate = () => { //Add associations here... diff --git a/src/database/models/assets/checkup.model.ts b/src/database/models/assets/checkup.model.ts index c809aba..116af22 100644 --- a/src/database/models/assets/checkup.model.ts +++ b/src/database/models/assets/checkup.model.ts @@ -79,7 +79,7 @@ export class CheckupModel { tableName : CheckupModel.TableName, }); - static associate = (models) => { + static associate = () => { //Add associations here... diff --git a/src/database/models/assets/consultation.model.ts b/src/database/models/assets/consultation.model.ts index a7ac02c..d593a9b 100644 --- a/src/database/models/assets/consultation.model.ts +++ b/src/database/models/assets/consultation.model.ts @@ -85,7 +85,7 @@ export class ConsultationModel { tableName : ConsultationModel.TableName, }); - static associate = (models) => { + static associate = () => { //Add associations here... diff --git a/src/database/models/assets/exercise.model.ts b/src/database/models/assets/exercise.model.ts index a359d4f..80e4c6e 100644 --- a/src/database/models/assets/exercise.model.ts +++ b/src/database/models/assets/exercise.model.ts @@ -96,7 +96,7 @@ export class ExerciseModel { tableName : ExerciseModel.TableName, }); - static associate = (models) => { + static associate = () => { //Add associations here... diff --git a/src/database/models/assets/goal.model.ts b/src/database/models/assets/goal.model.ts index e8e25ee..696c22b 100644 --- a/src/database/models/assets/goal.model.ts +++ b/src/database/models/assets/goal.model.ts @@ -79,7 +79,7 @@ export class GoalModel { tableName : GoalModel.TableName, }); - static associate = (models) => { + static associate = () => { //Add associations here... diff --git a/src/database/models/assets/medication.model.ts b/src/database/models/assets/medication.model.ts index f2e2558..e805105 100644 --- a/src/database/models/assets/medication.model.ts +++ b/src/database/models/assets/medication.model.ts @@ -79,7 +79,7 @@ export class MedicationModel { tableName : MedicationModel.TableName, }); - static associate = (models) => { + static associate = () => { //Add associations here... diff --git a/src/database/models/assets/meditation.model.ts b/src/database/models/assets/meditation.model.ts index 176ffc8..b549db7 100644 --- a/src/database/models/assets/meditation.model.ts +++ b/src/database/models/assets/meditation.model.ts @@ -90,7 +90,7 @@ export class MeditationModel { tableName : MeditationModel.TableName, }); - static associate = (models) => { + static associate = () => { //Add associations here... diff --git a/src/database/models/assets/message.model.ts b/src/database/models/assets/message.model.ts index a582f57..8b3e406 100644 --- a/src/database/models/assets/message.model.ts +++ b/src/database/models/assets/message.model.ts @@ -105,7 +105,7 @@ export class MessageModel { tableName : MessageModel.TableName, }); - static associate = (models) => { + static associate = () => { //Add associations here... diff --git a/src/database/models/assets/nutrition.model.ts b/src/database/models/assets/nutrition.model.ts index 0a17d85..c667d42 100644 --- a/src/database/models/assets/nutrition.model.ts +++ b/src/database/models/assets/nutrition.model.ts @@ -79,7 +79,7 @@ export class NutritionModel { tableName : NutritionModel.TableName, }); - static associate = (models) => { + static associate = () => { //Add associations here... diff --git a/src/database/models/assets/priority.model.ts b/src/database/models/assets/priority.model.ts index fe1ed48..e7688be 100644 --- a/src/database/models/assets/priority.model.ts +++ b/src/database/models/assets/priority.model.ts @@ -79,7 +79,7 @@ export class PriorityModel { tableName : PriorityModel.TableName, }); - static associate = (models) => { + static associate = () => { //Add associations here... diff --git a/src/database/models/assets/reflection.model.ts b/src/database/models/assets/reflection.model.ts index 1b3b161..1e5aa44 100644 --- a/src/database/models/assets/reflection.model.ts +++ b/src/database/models/assets/reflection.model.ts @@ -79,7 +79,7 @@ export class ReflectionModel { tableName : ReflectionModel.TableName, }); - static associate = (models) => { + static associate = () => { //Add associations here... diff --git a/src/database/models/assets/reminder.model.ts b/src/database/models/assets/reminder.model.ts index fbe0c08..b2f4223 100644 --- a/src/database/models/assets/reminder.model.ts +++ b/src/database/models/assets/reminder.model.ts @@ -79,7 +79,7 @@ export class ReminderModel { tableName : ReminderModel.TableName, }); - static associate = (models) => { + static associate = () => { //Add associations here... diff --git a/src/database/models/assets/web.link.model.ts b/src/database/models/assets/web.link.model.ts index 53c598b..7b64879 100644 --- a/src/database/models/assets/web.link.model.ts +++ b/src/database/models/assets/web.link.model.ts @@ -83,7 +83,7 @@ export class WebLinkModel { tableName : WebLinkModel.TableName, }); - static associate = (models) => { + static associate = () => { //Add associations here... diff --git a/src/database/models/assets/web.newsfeed.model.ts b/src/database/models/assets/web.newsfeed.model.ts index 5699f28..3e2b169 100644 --- a/src/database/models/assets/web.newsfeed.model.ts +++ b/src/database/models/assets/web.newsfeed.model.ts @@ -83,7 +83,7 @@ export class WebNewsfeedModel { tableName : WebNewsfeedModel.TableName, }); - static associate = (models) => { + static associate = () => { //Add associations here... diff --git a/src/database/models/assets/word.power.model.ts b/src/database/models/assets/word.power.model.ts index 1ceea9f..fc561eb 100644 --- a/src/database/models/assets/word.power.model.ts +++ b/src/database/models/assets/word.power.model.ts @@ -84,7 +84,7 @@ export class WordPowerModel { tableName : WordPowerModel.TableName, }); - static associate = (models) => { + static associate = () => { //Add associations here... diff --git a/src/database/models/careplan/careplan.category.model.ts b/src/database/models/careplan/careplan.category.model.ts index a03239e..df5f03a 100644 --- a/src/database/models/careplan/careplan.category.model.ts +++ b/src/database/models/careplan/careplan.category.model.ts @@ -44,7 +44,7 @@ export class CareplanCategoryModel { tableName : CareplanCategoryModel.TableName, }); - static associate = (models) => { + static associate = () => { //Add associations here... }; diff --git a/src/database/models/enrollment/participant.model.ts b/src/database/models/enrollment/participant.model.ts index cf0de28..a7e41be 100644 --- a/src/database/models/enrollment/participant.model.ts +++ b/src/database/models/enrollment/participant.model.ts @@ -86,7 +86,7 @@ export class ParticipantModel { tableName : ParticipantModel.TableName, }); - static associate = (models) => { + static associate = () => { //Add associations here... }; diff --git a/src/database/repository.services/enrollment/participant.service.ts b/src/database/repository.services/enrollment/participant.service.ts index ea82a73..a2889f2 100644 --- a/src/database/repository.services/enrollment/participant.service.ts +++ b/src/database/repository.services/enrollment/participant.service.ts @@ -76,6 +76,9 @@ export class ParticipantService { [Op.like] : '%' + filters.Country + '%' }; } + if (filters.Phone) { + search.where['Phone'] = filters.Phone; + } //Sorting let orderByColumn = 'CreatedAt';