@culturefy/shared 1.0.31 → 1.0.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/middlewares/token-validation.js +4 -2
- package/build/cjs/middlewares/token-validation.js.map +1 -1
- package/build/cjs/models/user.model.js +272 -366
- package/build/cjs/models/user.model.js.map +1 -1
- package/build/cjs/service/user.service.js +89 -84
- package/build/cjs/service/user.service.js.map +1 -1
- package/build/esm/middlewares/token-validation.js +4 -2
- package/build/esm/middlewares/token-validation.js.map +1 -1
- package/build/esm/models/user.model.js +272 -366
- package/build/esm/models/user.model.js.map +1 -1
- package/build/esm/service/user.service.js +89 -85
- package/build/esm/service/user.service.js.map +1 -1
- package/build/src/middlewares/token-validation.js +4 -2
- package/build/src/middlewares/token-validation.js.map +1 -1
- package/build/src/models/user.model.d.ts +0 -5
- package/build/src/models/user.model.js +266 -263
- package/build/src/models/user.model.js.map +1 -1
- package/build/src/service/user.service.d.ts +0 -6
- package/build/src/service/user.service.js +1 -107
- package/build/src/service/user.service.js.map +1 -1
- package/package.json +1 -1
- package/src/middlewares/token-validation.ts +4 -2
- package/src/models/user.model.ts +265 -265
- package/src/service/user.service.ts +79 -77
- package/build/package.json +0 -62
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user.model.js","names":["_dto","require","_mongoose","USER_DOCUMENT_NAME","exports","USER_COLLECTION_NAME","USER_TYPE","SocialLinksDTO","constructor","facebook","linkedin","instagram","twitter","MentorshipDTO","isOpenToMentorship","isLookingForMentorship","ThirdPartyAccounts_Enums","UserEmailAuthTokensDTO","refresh_token","access_token","accountType","GOOGLE","email","token_expiry","UserYoutubeAuthTokensDTO","RewardDTO","points","pointsToSend","pointsToReedem","amount","User","_id","Schema","Types","ObjectId","userId","id","fcm_token","google_id","cultureGroup","facebook_id","stripe_customerId","employeeId","password","profilePicUrl","role","roleId","verified","status","createdAt","Date","updatedAt","type","USER","firstName","lastName","dateOfBirth","phoneNumber","location","LocationDTO","socialLinks","business","businessId","bio","gender","skills","reward","profileviews","website","lifeExperience","position","isMentor","permissions","businessQuestionsAnswered","following","invitationHash","invitationHashExpiryDate","isinvitationHashExpired","coverPicUrl","isDeleted","isActive","departmentId","undefined","mentorship","ethnicity","personOfColor","tenure","satisfactionLevel","satisfactionLevelDate","performanceLevel","performanceLevelDate","salary","hireDate","jobLevel","supervisorId","enpsRating","disability","diverse","women","poc","isMfaVerified","mfaVerificationType","verificationOtp","otp","expiresAt","thirdPartyAuthTokens","youtubeAuthTokens","otpSchema","String","required","schema","trim","select","Number","default","ref","Mixed","Array","Boolean","min","blocked_transactions","versionKey","timestamps","collection","UserModel","model"],"sources":["../../../src/models/user.model.ts"],"sourcesContent":["// @ts-nocheck \n\nimport { LocationDTO } from '../dto';\nimport { model, Schema } from 'mongoose';\n\nexport const USER_DOCUMENT_NAME = 'User';\nexport const USER_COLLECTION_NAME = 'users';\n\nexport enum USER_TYPE {\n USER = \"USER\",\n ADMIN = \"ADMIN\",\n SUPER_ADMIN = \"SUPER_ADMIN\",\n}\n\nexport class SocialLinksDTO {\n facebook: string | null = ''\n linkedin: string | null = ''\n instagram: string | null = ''\n twitter: string | null = ''\n}\n\nexport interface ISocialLinks {\n facebook: string | null,\n linkedin: string | null,\n instagram: string | null,\n twitter: string | null,\n}\n\n\nexport class MentorshipDTO {\n isOpenToMentorship: boolean = false\n isLookingForMentorship: boolean = false\n}\n\nexport enum ThirdPartyAccounts_Enums {\n GOOGLE = \"GOOGLE\",\n MICROSOFT = \"MICROSOFT\",\n}\n\nexport class UserEmailAuthTokensDTO {\n refresh_token: string = ''\n access_token: string = ''\n accountType: ThirdPartyAccounts_Enums.GOOGLE | ThirdPartyAccounts_Enums.MICROSOFT = ThirdPartyAccounts_Enums.GOOGLE\n email: string = ''\n token_expiry: number = 0\n}\n\nexport class UserYoutubeAuthTokensDTO {\n refresh_token: string = ''\n access_token: string = ''\n email: string = ''\n token_expiry: number = 0\n}\n\nexport class RewardDTO {\n points: number | null = 0;\n pointsToSend: number | null = 0;\n pointsToReedem: number | null = 0;\n amount: number | null = 0;\n}\n\nexport class User implements IUser {\n _id: Schema.Types.ObjectId = new Schema.Types.ObjectId('');\n userId?: Schema.Types.ObjectId = new Schema.Types.ObjectId('');\n id: Schema.Types.ObjectId = new Schema.Types.ObjectId('');\n fcm_token: Array<any> = [];\n google_id?: string | undefined = '';\n cultureGroup?: Array<Schema.Types.ObjectId> = [];\n facebook_id?: string | undefined = '';\n stripe_customerId: string | null = '';\n email?: string | undefined = '';\n // employeeId?: number | null = null;\n employeeId?: string = '';\n password?: string | null | undefined = '';\n profilePicUrl?: string | undefined = '';\n role?: Schema.Types.ObjectId | undefined;\n roleId?: Schema.Types.ObjectId | null = new Schema.Types.ObjectId('');\n verified?: boolean | undefined = true;\n status?: boolean | undefined = true;\n createdAt: Date = new Date();\n updatedAt?: Date | undefined = new Date();\n type?: USER_TYPE.ADMIN | USER_TYPE.SUPER_ADMIN | USER_TYPE.USER = USER_TYPE.USER\n firstName?: string = '';\n lastName?: string = '';\n dateOfBirth?: Date | null = null;\n phoneNumber?: string = '';\n location?: LocationDTO = new LocationDTO()\n socialLinks?: SocialLinksDTO = new SocialLinksDTO()\n business?: Schema.Types.ObjectId = new Schema.Types.ObjectId('');\n businessId?: Schema.Types.ObjectId = new Schema.Types.ObjectId('');\n bio?: string = '';\n gender?: string = '';\n skills?: Array<Schema.Types.ObjectId> = [];\n reward?: RewardDTO = new RewardDTO();\n profileviews?: number = 0;\n website?: string = '';\n lifeExperience?: Array<Schema.Types.ObjectId> = [];\n position?: string = '';\n isMentor?: boolean = false;\n permissions?: string[] | undefined = [];\n\n businessQuestionsAnswered?: boolean = true;\n following?: Schema.Types.ObjectId[] = [];\n\n invitationHash?: string = ''\n invitationHashExpiryDate?: Date = new Date()\n isinvitationHashExpired?: boolean = false\n coverPicUrl?: string = ''\n isDeleted?: boolean = false\n isActive?: boolean = false\n departmentId?: Schema.Types.ObjectId | undefined = undefined;\n mentorship?: MentorshipDTO = new MentorshipDTO()\n ethnicity?: string = ''\n // race?: string = ''\n personOfColor?: string = ''\n tenure?: Number = 0\n satisfactionLevel?: Number = 1\n satisfactionLevelDate?: Date = new Date()\n performanceLevel?: Number = 1\n performanceLevelDate?: Date = new Date()\n salary?: Number = 0\n hireDate?: Date = new Date();\n jobLevel?: ''\n supervisorId?: Schema.Types.ObjectId | undefined = new Schema.Types.ObjectId('')\n enpsRating?: number = 0\n disability?: 'yes' | 'no' = 'no'\n diverse?: boolean = false\n women?: boolean = false\n poc?: boolean = false\n isMfaVerified?: boolean = false\n mfaVerificationType?: string = \"none\"\n verificationOtp?: {\n otp: string;\n expiresAt: Date;\n } = {\n otp: '',\n expiresAt: new Date(),\n }\n\n thirdPartyAuthTokens?: UserEmailAuthTokensDTO = new UserEmailAuthTokensDTO()\n youtubeAuthTokens?: UserYoutubeAuthTokensDTO = new UserYoutubeAuthTokensDTO()\n\n\n}\n\nexport default interface IUser {\n _id: Schema.Types.ObjectId,\n userId?: Schema.Types.ObjectId;\n email?: string;\n // employeeId?: number | null;\n employeeId?: string;\n profileviews?: number;\n password?: string | null;\n profilePicUrl?: string;\n role?: Schema.Types.ObjectId;\n fcm_token?: Array<any>;\n roleId?: Schema.Types.ObjectId | null;\n verified?: boolean;\n blocked_transactions?: boolean;\n status?: boolean;\n createdAt: Date;\n updatedAt?: Date;\n cultureGroup?: Array<Schema.Types.ObjectId>;\n type?: USER_TYPE.ADMIN | USER_TYPE.SUPER_ADMIN | USER_TYPE.USER\n\n firstName?: string,\n lastName?: string,\n dateOfBirth?: Date | null,\n\n phoneNumber?: string,\n location?: LocationDTO,\n reward?: RewardDTO,\n business?: Schema.Types.ObjectId,\n bio?: string,\n gender?: string,\n skills?: Array<Schema.Types.ObjectId>,\n website?: string,\n socialLinks?: ISocialLinks\n lifeExperience?: Array<Schema.Types.ObjectId>,\n businessId?: Schema.Types.ObjectId,\n position?: string,\n isMentor?: boolean,\n permissions?: string[],\n\n businessQuestionsAnswered?: boolean,\n following?: Schema.Types.ObjectId[],\n\n invitationHash?: string\n invitationHashExpiryDate?: Date\n isinvitationHashExpired?: boolean\n coverPicUrl?: string\n isDeleted?: boolean\n isActive?: boolean\n\n departmentId?: Schema.Types.ObjectId | undefined\n mentorship?: MentorshipDTO\n ethnicity?: string\n // race?: string\n personOfColor?: string\n tenure?: Number\n satisfactionLevel?: Number\n satisfactionLevelDate?: Date\n performanceLevel?: Number\n performanceLevelDate?: Date\n salary?: Number\n hireDate?: Date\n jobLevel?: ''\n supervisorId?: Schema.Types.ObjectId | undefined\n enpsRating?: number\n disability?: 'yes' | 'no'\n diverse?: boolean\n women?: boolean\n poc?: boolean\n isMfaVerified?: boolean\n mfaVerificationType?: string\n verificationOtp?: Object\n thirdPartyAuthTokens?: UserEmailAuthTokensDTO\n youtubeAuthTokens?: UserYoutubeAuthTokensDTO\n}\n\nconst otpSchema = new Schema({\n otp: { type: String, required: true },\n expiresAt: { type: Date, required: true }\n});\n\nconst schema = new Schema<IUser>(\n {\n email: {\n type: Schema.Types.String,\n required: false,\n // unique: true,\n trim: true,\n // select: false,\n },\n userId: {\n type: Schema.Types.ObjectId,\n required: false,\n },\n employeeId: {\n type: Schema.Types.String,\n required: false,\n },\n password: {\n type: Schema.Types.String,\n required: false,\n select: false,\n },\n profileviews: {\n type: Schema.Types.Number,\n required: false,\n default: 0,\n },\n profilePicUrl: {\n type: Schema.Types.String,\n required: false,\n trim: true,\n },\n cultureGroup: [{ type: Schema.Types.ObjectId, required: false, ref: 'Cultur' }],\n firstName: {\n type: Schema.Types.String,\n required: false,\n trim: true,\n },\n lastName: {\n type: Schema.Types.String,\n required: false,\n trim: true,\n },\n dateOfBirth: {\n type: Schema.Types.Date,\n required: false,\n },\n phoneNumber: {\n type: Schema.Types.String,\n required: false,\n },\n location: {\n type: Schema.Types.Mixed,\n required: false,\n },\n role: {\n type: Schema.Types.ObjectId,\n required: false,\n },\n roleId: {\n type: Schema.Types.ObjectId,\n required: false,\n },\n business: {\n type: Schema.Types.ObjectId,\n ref: 'Businesses',\n required: false,\n },\n following: {\n type: [Schema.Types.ObjectId],\n ref: USER_DOCUMENT_NAME,\n required: false,\n default: []\n },\n businessId: {\n type: Schema.Types.ObjectId,\n ref: 'Businesses',\n required: false,\n // strictPopulate: false,\n },\n fcm_token: { type: Schema.Types.Array, required: false },\n bio: { type: Schema.Types.String, required: false },\n gender: { type: Schema.Types.String, required: false },\n skills: [{ type: Schema.Types.ObjectId, required: false, ref: 'userSkills' }],\n website: { type: Schema.Types.String, required: false },\n socialLinks: {\n facebook: { type: Schema.Types.String, required: false },\n linkedin: { type: Schema.Types.String, required: false },\n instagram: { type: Schema.Types.String, required: false },\n twitter: { type: Schema.Types.String, required: false },\n },\n lifeExperience: [{ type: Schema.Types.ObjectId, required: false, ref: 'Life' }],\n\n position: { type: Schema.Types.String, required: false },\n isMentor: { type: Schema.Types.Boolean, required: false },\n\n permissions: [{ type: Schema.Types.Mixed, required: false }],\n businessQuestionsAnswered: {\n type: Schema.Types.Boolean,\n required: false,\n default: true\n },\n\n type: {\n type: Schema.Types.String,\n required: false,\n // enum: [USER_TYPE.ADMIN, USER_TYPE.SUPER_ADMIN, USER_TYPE.USER]\n },\n reward: {\n points: { type: Schema.Types.Number, default: 0, min: 0 },\n pointsToSend: { type: Schema.Types.Number, default: 0, min: 0 },\n pointsToReedem: { type: Schema.Types.Number, default: 0, min: 0 },\n amount: { type: Schema.Types.Number, default: 0, min: 0 },\n },\n verified: {\n type: Schema.Types.Boolean,\n default: false,\n },\n blocked_transactions: {\n type: Schema.Types.Boolean,\n default: false,\n },\n status: {\n type: Schema.Types.Boolean,\n default: true,\n },\n createdAt: {\n type: Date,\n required: false,\n select: false,\n },\n updatedAt: {\n type: Date,\n required: false,\n select: false,\n },\n invitationHash: { type: Schema.Types.String, required: false },\n invitationHashExpiryDate: { type: Schema.Types.Date, required: false },\n isinvitationHashExpired: { type: Schema.Types.Boolean, default: false },\n coverPicUrl: { type: Schema.Types.String, required: false },\n isDeleted: {\n type: Schema.Types.Boolean,\n default: false,\n },\n isActive: {\n type: Schema.Types.Boolean,\n default: false,\n },\n departmentId: {\n type: Schema.Types.ObjectId,\n required: false,\n },\n mentorship: {\n isOpenToMentorship: { type: Schema.Types.Boolean, default: false },\n isLookingForMentorship: { type: Schema.Types.Boolean, default: false }\n },\n ethnicity: {\n type: Schema.Types.String,\n required: false,\n },\n personOfColor: {\n type: Schema.Types.String,\n required: false,\n },\n tenure: {\n type: Schema.Types.Number,\n required: false,\n },\n satisfactionLevel: {\n type: Schema.Types.Number,\n required: false,\n },\n satisfactionLevelDate: {\n type: Schema.Types.Date,\n required: false,\n },\n performanceLevel: {\n type: Schema.Types.Number,\n required: false,\n },\n performanceLevelDate: {\n type: Schema.Types.Date,\n required: false,\n },\n salary: {\n type: Schema.Types.Number,\n required: false,\n },\n hireDate: {\n type: Schema.Types.Date,\n required: false,\n },\n jobLevel: {\n type: Schema.Types.String,\n required: false,\n default: ''\n },\n supervisorId: {\n type: Schema.Types.ObjectId,\n required: false,\n },\n enpsRating: {\n type: Schema.Types.Number,\n required: false,\n },\n disability: {\n type: Schema.Types.String,\n required: false,\n default: 'no'\n },\n diverse: {\n type: Schema.Types.Boolean,\n required: false,\n // default: false\n },\n women: {\n type: Schema.Types.Boolean,\n required: false,\n // default: false\n },\n poc: {\n type: Schema.Types.Boolean,\n required: false,\n // default: false\n },\n isMfaVerified: {\n type: Schema.Types.Boolean,\n default: false,\n required: false,\n // default: false\n },\n mfaVerificationType: {\n type: Schema.Types.String,\n default: 'none',\n required: false,\n // default: false\n },\n verificationOtp: {\n type: otpSchema,\n default: null,\n required: false,\n // default: false\n },\n thirdPartyAuthTokens: {\n access_token: { type: Schema.Types.String },\n refresh_token: { type: Schema.Types.String },\n accountType: { type: Schema.Types.String },\n email: { type: Schema.Types.String },\n token_expiry: { type: Schema.Types.Number }\n },\n youtubeAuthTokens: {\n access_token: { type: Schema.Types.String },\n refresh_token: { type: Schema.Types.String },\n email: { type: Schema.Types.String },\n token_expiry: { type: Schema.Types.Number }\n }\n },\n {\n versionKey: false,\n timestamps: true,\n collection: USER_COLLECTION_NAME\n },\n);\n\nexport const UserModel = model<IUser>(USER_DOCUMENT_NAME, schema, USER_COLLECTION_NAME);"],"mappings":";;;;AAEA,IAAAA,IAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AAHA;;AAKO,MAAME,kBAAkB,GAAAC,OAAA,CAAAD,kBAAA,GAAG,MAAM;AACjC,MAAME,oBAAoB,GAAAD,OAAA,CAAAC,oBAAA,GAAG,OAAO;AAAC,IAEhCC,SAAS,GAAAF,OAAA,CAAAE,SAAA,0BAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAAA,OAATA,SAAS;AAAA;AAMd,MAAMC,cAAc,CAAC;EAAAC,YAAA;IAAA,KACxBC,QAAQ,GAAkB,EAAE;IAAA,KAC5BC,QAAQ,GAAkB,EAAE;IAAA,KAC5BC,SAAS,GAAkB,EAAE;IAAA,KAC7BC,OAAO,GAAkB,EAAE;EAAA;AAC/B;AAACR,OAAA,CAAAG,cAAA,GAAAA,cAAA;AAUM,MAAMM,aAAa,CAAC;EAAAL,YAAA;IAAA,KACvBM,kBAAkB,GAAY,KAAK;IAAA,KACnCC,sBAAsB,GAAY,KAAK;EAAA;AAC3C;AAACX,OAAA,CAAAS,aAAA,GAAAA,aAAA;AAAA,IAEWG,wBAAwB,GAAAZ,OAAA,CAAAY,wBAAA,0BAAxBA,wBAAwB;EAAxBA,wBAAwB;EAAxBA,wBAAwB;EAAA,OAAxBA,wBAAwB;AAAA;AAK7B,MAAMC,sBAAsB,CAAC;EAAAT,YAAA;IAAA,KAChCU,aAAa,GAAW,EAAE;IAAA,KAC1BC,YAAY,GAAW,EAAE;IAAA,KACzBC,WAAW,GAAyEJ,wBAAwB,CAACK,MAAM;IAAA,KACnHC,KAAK,GAAW,EAAE;IAAA,KAClBC,YAAY,GAAW,CA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I,EAAEpB,gBAAM,CAACC,KAAK,CAACgF;IAAO;EAC9C,CAAC;EACDP,iBAAiB,EAAE;IACfvF,YAAY,EAAE;MAAEiC,IAAI,EAAEpB,gBAAM,CAACC,KAAK,CAAC2E;IAAO,CAAC;IAC3C1F,aAAa,EAAE;MAAEkC,IAAI,EAAEpB,gBAAM,CAACC,KAAK,CAAC2E;IAAO,CAAC;IAC5CtF,KAAK,EAAE;MAAE8B,IAAI,EAAEpB,gBAAM,CAACC,KAAK,CAAC2E;IAAO,CAAC;IACpCrF,YAAY,EAAE;MAAE6B,IAAI,EAAEpB,gBAAM,CAACC,KAAK,CAACgF;IAAO;EAC9C;AACJ,CAAC,EACD;EACIQ,UAAU,EAAE,KAAK;EACjBC,UAAU,EAAE,IAAI;EAChBC,UAAU,EAAEtH;AAChB,CACJ,CAAC;AAEM,MAAMuH,SAAS,GAAAxH,OAAA,CAAAwH,SAAA,GAAG,IAAAC,eAAK,EAAQ1H,kBAAkB,EAAE2G,MAAM,EAAEzG,oBAAoB,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"user.model.js","names":["_dto","require","_mongoose","USER_DOCUMENT_NAME","exports","USER_COLLECTION_NAME","USER_TYPE","SocialLinksDTO","constructor","facebook","linkedin","instagram","twitter","MentorshipDTO","isOpenToMentorship","isLookingForMentorship","ThirdPartyAccounts_Enums","UserEmailAuthTokensDTO","refresh_token","access_token","accountType","GOOGLE","email","token_expiry","UserYoutubeAuthTokensDTO","RewardDTO","points","pointsToSend","pointsToReedem","amount","User","_id","Schema","Types","ObjectId","userId","id","fcm_token","google_id","cultureGroup","facebook_id","stripe_customerId","employeeId","password","profilePicUrl","role","roleId","verified","status","createdAt","Date","updatedAt","type","USER","firstName","lastName","dateOfBirth","phoneNumber","location","LocationDTO","socialLinks","business","businessId","bio","gender","skills","reward","profileviews","website","lifeExperience","position","isMentor","permissions","businessQuestionsAnswered","following","invitationHash","invitationHashExpiryDate","isinvitationHashExpired","coverPicUrl","isDeleted","isActive","departmentId","undefined","mentorship","ethnicity","personOfColor","tenure","satisfactionLevel","satisfactionLevelDate","performanceLevel","performanceLevelDate","salary","hireDate","jobLevel","supervisorId","enpsRating","disability","diverse","women","poc","isMfaVerified","mfaVerificationType","verificationOtp","otp","expiresAt","thirdPartyAuthTokens","youtubeAuthTokens"],"sources":["../../../src/models/user.model.ts"],"sourcesContent":["// @ts-nocheck \n\nimport { LocationDTO } from '../dto';\nimport { model, Schema } from 'mongoose';\n\nexport const USER_DOCUMENT_NAME = 'User';\nexport const USER_COLLECTION_NAME = 'users';\n\nexport enum USER_TYPE {\n USER = \"USER\",\n ADMIN = \"ADMIN\",\n SUPER_ADMIN = \"SUPER_ADMIN\",\n}\n\nexport class SocialLinksDTO {\n facebook: string | null = ''\n linkedin: string | null = ''\n instagram: string | null = ''\n twitter: string | null = ''\n}\n\nexport interface ISocialLinks {\n facebook: string | null,\n linkedin: string | null,\n instagram: string | null,\n twitter: string | null,\n}\n\n\nexport class MentorshipDTO {\n isOpenToMentorship: boolean = false\n isLookingForMentorship: boolean = false\n}\n\nexport enum ThirdPartyAccounts_Enums {\n GOOGLE = \"GOOGLE\",\n MICROSOFT = \"MICROSOFT\",\n}\n\nexport class UserEmailAuthTokensDTO {\n refresh_token: string = ''\n access_token: string = ''\n accountType: ThirdPartyAccounts_Enums.GOOGLE | ThirdPartyAccounts_Enums.MICROSOFT = ThirdPartyAccounts_Enums.GOOGLE\n email: string = ''\n token_expiry: number = 0\n}\n\nexport class UserYoutubeAuthTokensDTO {\n refresh_token: string = ''\n access_token: string = ''\n email: string = ''\n token_expiry: number = 0\n}\n\nexport class RewardDTO {\n points: number | null = 0;\n pointsToSend: number | null = 0;\n pointsToReedem: number | null = 0;\n amount: number | null = 0;\n}\n\nexport class User implements IUser {\n _id: Schema.Types.ObjectId = new Schema.Types.ObjectId('');\n userId?: Schema.Types.ObjectId = new Schema.Types.ObjectId('');\n id: Schema.Types.ObjectId = new Schema.Types.ObjectId('');\n fcm_token: Array<any> = [];\n google_id?: string | undefined = '';\n cultureGroup?: Array<Schema.Types.ObjectId> = [];\n facebook_id?: string | undefined = '';\n stripe_customerId: string | null = '';\n email?: string | undefined = '';\n // employeeId?: number | null = null;\n employeeId?: string = '';\n password?: string | null | undefined = '';\n profilePicUrl?: string | undefined = '';\n role?: Schema.Types.ObjectId | undefined;\n roleId?: Schema.Types.ObjectId | null = new Schema.Types.ObjectId('');\n verified?: boolean | undefined = true;\n status?: boolean | undefined = true;\n createdAt: Date = new Date();\n updatedAt?: Date | undefined = new Date();\n type?: USER_TYPE.ADMIN | USER_TYPE.SUPER_ADMIN | USER_TYPE.USER = USER_TYPE.USER\n firstName?: string = '';\n lastName?: string = '';\n dateOfBirth?: Date | null = null;\n phoneNumber?: string = '';\n location?: LocationDTO = new LocationDTO()\n socialLinks?: SocialLinksDTO = new SocialLinksDTO()\n business?: Schema.Types.ObjectId = new Schema.Types.ObjectId('');\n businessId?: Schema.Types.ObjectId = new Schema.Types.ObjectId('');\n bio?: string = '';\n gender?: string = '';\n skills?: Array<Schema.Types.ObjectId> = [];\n reward?: RewardDTO = new RewardDTO();\n profileviews?: number = 0;\n website?: string = '';\n lifeExperience?: Array<Schema.Types.ObjectId> = [];\n position?: string = '';\n isMentor?: boolean = false;\n permissions?: string[] | undefined = [];\n\n businessQuestionsAnswered?: boolean = true;\n following?: Schema.Types.ObjectId[] = [];\n\n invitationHash?: string = ''\n invitationHashExpiryDate?: Date = new Date()\n isinvitationHashExpired?: boolean = false\n coverPicUrl?: string = ''\n isDeleted?: boolean = false\n isActive?: boolean = false\n departmentId?: Schema.Types.ObjectId | undefined = undefined;\n mentorship?: MentorshipDTO = new MentorshipDTO()\n ethnicity?: string = ''\n // race?: string = ''\n personOfColor?: string = ''\n tenure?: Number = 0\n satisfactionLevel?: Number = 1\n satisfactionLevelDate?: Date = new Date()\n performanceLevel?: Number = 1\n performanceLevelDate?: Date = new Date()\n salary?: Number = 0\n hireDate?: Date = new Date();\n jobLevel?: ''\n supervisorId?: Schema.Types.ObjectId | undefined = new Schema.Types.ObjectId('')\n enpsRating?: number = 0\n disability?: 'yes' | 'no' = 'no'\n diverse?: boolean = false\n women?: boolean = false\n poc?: boolean = false\n isMfaVerified?: boolean = false\n mfaVerificationType?: string = \"none\"\n verificationOtp?: {\n otp: string;\n expiresAt: Date;\n } = {\n otp: '',\n expiresAt: new Date(),\n }\n\n thirdPartyAuthTokens?: UserEmailAuthTokensDTO = new UserEmailAuthTokensDTO()\n youtubeAuthTokens?: UserYoutubeAuthTokensDTO = new UserYoutubeAuthTokensDTO()\n\n\n}\n\nexport default interface IUser {\n _id: Schema.Types.ObjectId,\n userId?: Schema.Types.ObjectId;\n email?: string;\n // employeeId?: number | null;\n employeeId?: string;\n profileviews?: number;\n password?: string | null;\n profilePicUrl?: string;\n role?: Schema.Types.ObjectId;\n fcm_token?: Array<any>;\n roleId?: Schema.Types.ObjectId | null;\n verified?: boolean;\n blocked_transactions?: boolean;\n status?: boolean;\n createdAt: Date;\n updatedAt?: Date;\n cultureGroup?: Array<Schema.Types.ObjectId>;\n type?: USER_TYPE.ADMIN | USER_TYPE.SUPER_ADMIN | USER_TYPE.USER\n\n firstName?: string,\n lastName?: string,\n dateOfBirth?: Date | null,\n\n phoneNumber?: string,\n location?: LocationDTO,\n reward?: RewardDTO,\n business?: Schema.Types.ObjectId,\n bio?: string,\n gender?: string,\n skills?: Array<Schema.Types.ObjectId>,\n website?: string,\n socialLinks?: ISocialLinks\n lifeExperience?: Array<Schema.Types.ObjectId>,\n businessId?: Schema.Types.ObjectId,\n position?: string,\n isMentor?: boolean,\n permissions?: string[],\n\n businessQuestionsAnswered?: boolean,\n following?: Schema.Types.ObjectId[],\n\n invitationHash?: string\n invitationHashExpiryDate?: Date\n isinvitationHashExpired?: boolean\n coverPicUrl?: string\n isDeleted?: boolean\n isActive?: boolean\n\n departmentId?: Schema.Types.ObjectId | undefined\n mentorship?: MentorshipDTO\n ethnicity?: string\n // race?: string\n personOfColor?: string\n tenure?: Number\n satisfactionLevel?: Number\n satisfactionLevelDate?: Date\n performanceLevel?: Number\n performanceLevelDate?: Date\n salary?: Number\n hireDate?: Date\n jobLevel?: ''\n supervisorId?: Schema.Types.ObjectId | undefined\n enpsRating?: number\n disability?: 'yes' | 'no'\n diverse?: boolean\n women?: boolean\n poc?: boolean\n isMfaVerified?: boolean\n mfaVerificationType?: string\n verificationOtp?: Object\n thirdPartyAuthTokens?: UserEmailAuthTokensDTO\n youtubeAuthTokens?: UserYoutubeAuthTokensDTO\n}\n\n// const otpSchema = new Schema({\n// otp: { type: String, required: true },\n// expiresAt: { type: Date, required: true }\n// });\n\n// const schema = new Schema<IUser>(\n// {\n// email: {\n// type: Schema.Types.String,\n// required: false,\n// // unique: true,\n// trim: true,\n// // select: false,\n// },\n// userId: {\n// type: Schema.Types.ObjectId,\n// required: false,\n// },\n// employeeId: {\n// type: Schema.Types.String,\n// required: false,\n// },\n// password: {\n// type: Schema.Types.String,\n// required: false,\n// select: false,\n// },\n// profileviews: {\n// type: Schema.Types.Number,\n// required: false,\n// default: 0,\n// },\n// profilePicUrl: {\n// type: Schema.Types.String,\n// required: false,\n// trim: true,\n// },\n// cultureGroup: [{ type: Schema.Types.ObjectId, required: false, ref: 'Cultur' }],\n// firstName: {\n// type: Schema.Types.String,\n// required: false,\n// trim: true,\n// },\n// lastName: {\n// type: Schema.Types.String,\n// required: false,\n// trim: true,\n// },\n// dateOfBirth: {\n// type: Schema.Types.Date,\n// required: false,\n// },\n// phoneNumber: {\n// type: Schema.Types.String,\n// required: false,\n// },\n// location: {\n// type: Schema.Types.Mixed,\n// required: false,\n// },\n// role: {\n// type: Schema.Types.ObjectId,\n// required: false,\n// },\n// roleId: {\n// type: Schema.Types.ObjectId,\n// required: false,\n// },\n// business: {\n// type: Schema.Types.ObjectId,\n// ref: 'Businesses',\n// required: false,\n// },\n// following: {\n// type: [Schema.Types.ObjectId],\n// ref: USER_DOCUMENT_NAME,\n// required: false,\n// default: []\n// },\n// businessId: {\n// type: Schema.Types.ObjectId,\n// ref: 'Businesses',\n// required: false,\n// // strictPopulate: false,\n// },\n// fcm_token: { type: Schema.Types.Array, required: false },\n// bio: { type: Schema.Types.String, required: false },\n// gender: { type: Schema.Types.String, required: false },\n// skills: [{ type: Schema.Types.ObjectId, required: false, ref: 'userSkills' }],\n// website: { type: Schema.Types.String, required: false },\n// socialLinks: {\n// facebook: { type: Schema.Types.String, required: false },\n// linkedin: { type: Schema.Types.String, required: false },\n// instagram: { type: Schema.Types.String, required: false },\n// twitter: { type: Schema.Types.String, required: false },\n// },\n// lifeExperience: [{ type: Schema.Types.ObjectId, required: false, ref: 'Life' }],\n\n// position: { type: Schema.Types.String, required: false },\n// isMentor: { type: Schema.Types.Boolean, required: false },\n\n// permissions: [{ type: Schema.Types.Mixed, required: false }],\n// businessQuestionsAnswered: {\n// type: Schema.Types.Boolean,\n// required: false,\n// default: true\n// },\n\n// type: {\n// type: Schema.Types.String,\n// required: false,\n// // enum: [USER_TYPE.ADMIN, USER_TYPE.SUPER_ADMIN, USER_TYPE.USER]\n// },\n// reward: {\n// points: { type: Schema.Types.Number, default: 0, min: 0 },\n// pointsToSend: { type: Schema.Types.Number, default: 0, min: 0 },\n// pointsToReedem: { type: Schema.Types.Number, default: 0, min: 0 },\n// amount: { type: Schema.Types.Number, default: 0, min: 0 },\n// },\n// verified: {\n// type: Schema.Types.Boolean,\n// default: false,\n// },\n// blocked_transactions: {\n// type: Schema.Types.Boolean,\n// default: false,\n// },\n// status: {\n// type: Schema.Types.Boolean,\n// default: true,\n// },\n// createdAt: {\n// type: Date,\n// required: false,\n// select: false,\n// },\n// updatedAt: {\n// type: Date,\n// required: false,\n// select: false,\n// },\n// invitationHash: { type: Schema.Types.String, required: false },\n// invitationHashExpiryDate: { type: Schema.Types.Date, required: false },\n// isinvitationHashExpired: { type: Schema.Types.Boolean, default: false },\n// coverPicUrl: { type: Schema.Types.String, required: false },\n// isDeleted: {\n// type: Schema.Types.Boolean,\n// default: false,\n// },\n// isActive: {\n// type: Schema.Types.Boolean,\n// default: false,\n// },\n// departmentId: {\n// type: Schema.Types.ObjectId,\n// required: false,\n// },\n// mentorship: {\n// isOpenToMentorship: { type: Schema.Types.Boolean, default: false },\n// isLookingForMentorship: { type: Schema.Types.Boolean, default: false }\n// },\n// ethnicity: {\n// type: Schema.Types.String,\n// required: false,\n// },\n// personOfColor: {\n// type: Schema.Types.String,\n// required: false,\n// },\n// tenure: {\n// type: Schema.Types.Number,\n// required: false,\n// },\n// satisfactionLevel: {\n// type: Schema.Types.Number,\n// required: false,\n// },\n// satisfactionLevelDate: {\n// type: Schema.Types.Date,\n// required: false,\n// },\n// performanceLevel: {\n// type: Schema.Types.Number,\n// required: false,\n// },\n// performanceLevelDate: {\n// type: Schema.Types.Date,\n// required: false,\n// },\n// salary: {\n// type: Schema.Types.Number,\n// required: false,\n// },\n// hireDate: {\n// type: Schema.Types.Date,\n// required: false,\n// },\n// jobLevel: {\n// type: Schema.Types.String,\n// required: false,\n// default: ''\n// },\n// supervisorId: {\n// type: Schema.Types.ObjectId,\n// required: false,\n// },\n// enpsRating: {\n// type: Schema.Types.Number,\n// required: false,\n// },\n// disability: {\n// type: Schema.Types.String,\n// required: false,\n// default: 'no'\n// },\n// diverse: {\n// type: Schema.Types.Boolean,\n// required: false,\n// // default: false\n// },\n// women: {\n// type: Schema.Types.Boolean,\n// required: false,\n// // default: false\n// },\n// poc: {\n// type: Schema.Types.Boolean,\n// required: false,\n// // default: false\n// },\n// isMfaVerified: {\n// type: Schema.Types.Boolean,\n// default: false,\n// required: false,\n// // default: false\n// },\n// mfaVerificationType: {\n// type: Schema.Types.String,\n// default: 'none',\n// required: false,\n// // default: false\n// },\n// verificationOtp: {\n// type: otpSchema,\n// default: null,\n// required: false,\n// // default: false\n// },\n// thirdPartyAuthTokens: {\n// access_token: { type: Schema.Types.String },\n// refresh_token: { type: Schema.Types.String },\n// accountType: { type: Schema.Types.String },\n// email: { type: Schema.Types.String },\n// token_expiry: { type: Schema.Types.Number }\n// },\n// youtubeAuthTokens: {\n// access_token: { type: Schema.Types.String },\n// refresh_token: { type: Schema.Types.String },\n// email: { type: Schema.Types.String },\n// token_expiry: { type: Schema.Types.Number }\n// }\n// },\n// {\n// versionKey: false,\n// timestamps: true,\n// collection: USER_COLLECTION_NAME\n// },\n// );\n\n// export const UserModel = model<IUser>(USER_DOCUMENT_NAME, schema, USER_COLLECTION_NAME);"],"mappings":";;;;AAEA,IAAAA,IAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AAHA;;AAKO,MAAME,kBAAkB,GAAAC,OAAA,CAAAD,kBAAA,GAAG,MAAM;AACjC,MAAME,oBAAoB,GAAAD,OAAA,CAAAC,oBAAA,GAAG,OAAO;AAAC,IAEhCC,SAAS,GAAAF,OAAA,CAAAE,SAAA,0BAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAAA,OAATA,SAAS;AAAA;AAMd,MAAMC,cAAc,CAAC;EAAAC,YAAA;IAAA,KACxBC,QAAQ,GAAkB,EAAE;IAAA,KAC5BC,QAAQ,GAAkB,EAAE;IAAA,KAC5BC,SAAS,GAAkB,EAAE;IAAA,KAC7BC,OAAO,GAAkB,EAAE;EAAA;AAC/B;AAACR,OAAA,CAAAG,cAAA,GAAAA,cAAA;AAUM,MAAMM,aAAa,CAAC;EAAAL,YAAA;IAAA,KACvBM,kBAAkB,GAAY,KAAK;IAAA,KACnCC,sBAAsB,GAAY,KAAK;EAAA;AAC3C;AAACX,OAAA,CAAAS,aAAA,GAAAA,aAAA;AAAA,IAEWG,wBAAwB,GAAAZ,OAAA,CAAAY,wBAAA,0BAAxBA,wBAAwB;EAAxBA,wBAAwB;EAAxBA,wBAAwB;EAAA,OAAxBA,wBAAwB;AAAA;AAK7B,MAAMC,sBAAsB,CAAC;EAAAT,YAAA;IAAA,KAChCU,aAAa,GAAW,EAAE;IAAA,KAC1BC,YAAY,GAAW,EAAE;IAAA,KACzBC,WAAW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ACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AAAApB,OAAA,CAAA0B,IAAA,GAAAA,IAAA","ignoreList":[]}
|
|
@@ -2,94 +2,99 @@
|
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
4
|
exports.UserService = void 0;
|
|
5
|
-
var _mongoose = require("mongoose");
|
|
6
|
-
var _user = require("../models/user.model");
|
|
7
5
|
var _shared = require("@culturefy/shared");
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
let UserService = exports.UserService = (_class = class UserService extends _shared.Initializers {
|
|
6
|
+
class UserService extends _shared.Initializers {
|
|
7
|
+
// private readonly schema = UserModel.schema;
|
|
11
8
|
constructor(context, dbUrl) {
|
|
12
9
|
super(context, dbUrl);
|
|
13
|
-
this.schema = _user.UserModel.schema;
|
|
14
10
|
}
|
|
15
|
-
getModel() {
|
|
16
|
-
const connection = this.getConnection();
|
|
17
|
-
if (!connection) {
|
|
18
|
-
throw new Error('Database connection not established');
|
|
19
|
-
}
|
|
20
|
-
return connection.model(_user.UserModel.modelName, this.schema);
|
|
21
|
-
}
|
|
22
|
-
async getUserById(userId) {
|
|
23
|
-
try {
|
|
24
|
-
let model = this.getModel();
|
|
25
|
-
this.context.log("UserId:", JSON.stringify(userId));
|
|
26
11
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
objectId = new _mongoose.Types.ObjectId(userIdString);
|
|
35
|
-
}
|
|
36
|
-
this.context.log("ObjectId:", JSON.stringify(objectId));
|
|
37
|
-
const user = await model.findById(objectId);
|
|
38
|
-
this.context.log("User:", JSON.stringify(user));
|
|
39
|
-
return user;
|
|
40
|
-
} catch (error) {
|
|
41
|
-
this.context.error("Error in getUserById", error);
|
|
42
|
-
throw error;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
async getUserByBusinessId(businessId, email) {
|
|
46
|
-
try {
|
|
47
|
-
let model = this.getModel();
|
|
48
|
-
this.context.log("BusinessId:", JSON.stringify(businessId));
|
|
49
|
-
this.context.log("Email:", JSON.stringify(email));
|
|
50
|
-
if (!businessId) return null;
|
|
51
|
-
if (!email) return null;
|
|
52
|
-
businessId = businessId.toLowerCase();
|
|
53
|
-
businessId = businessId.trim();
|
|
54
|
-
email = email.toLowerCase();
|
|
55
|
-
email = email.trim();
|
|
12
|
+
// private getModel() {
|
|
13
|
+
// const connection = (this as any).getConnection();
|
|
14
|
+
// if (!connection) {
|
|
15
|
+
// throw new Error('Database connection not established');
|
|
16
|
+
// }
|
|
17
|
+
// return connection.model(UserModel.modelName, this.schema);
|
|
18
|
+
// }
|
|
56
19
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
20
|
+
// @WithDb
|
|
21
|
+
// async getUserById(userId: string): Promise<IUser | null> {
|
|
22
|
+
// try {
|
|
23
|
+
// let model = this.getModel();
|
|
24
|
+
// this.context.log("UserId:", JSON.stringify(userId));
|
|
25
|
+
|
|
26
|
+
// // Handle both string and SchemaObjectId inputs
|
|
27
|
+
// let objectId: Types.ObjectId;
|
|
28
|
+
// if (typeof userId === 'string') {
|
|
29
|
+
// objectId = new Types.ObjectId(userId);
|
|
30
|
+
// } else {
|
|
31
|
+
// // If it's already a SchemaObjectId, extract the string value
|
|
32
|
+
// const userIdString = (userId as any).path || (userId as any).toString();
|
|
33
|
+
// objectId = new Types.ObjectId(userIdString);
|
|
34
|
+
// }
|
|
35
|
+
|
|
36
|
+
// this.context.log("ObjectId:", JSON.stringify(objectId));
|
|
37
|
+
// const user = await model.findById(objectId);
|
|
38
|
+
// this.context.log("User:", JSON.stringify(user));
|
|
39
|
+
// return user;
|
|
40
|
+
// } catch (error) {
|
|
41
|
+
// this.context.error("Error in getUserById", error);
|
|
42
|
+
// throw error;
|
|
43
|
+
// }
|
|
44
|
+
// }
|
|
45
|
+
|
|
46
|
+
// @WithDb
|
|
47
|
+
// async getUserByBusinessId(businessId: string, email: string): Promise<IUser | null> {
|
|
48
|
+
// try {
|
|
49
|
+
// let model = this.getModel();
|
|
50
|
+
// this.context.log("BusinessId:", JSON.stringify(businessId));
|
|
51
|
+
// this.context.log("Email:", JSON.stringify(email));
|
|
52
|
+
|
|
53
|
+
// if(!businessId) return null;
|
|
54
|
+
// if(!email) return null;
|
|
55
|
+
|
|
56
|
+
// businessId = businessId.toLowerCase();
|
|
57
|
+
// businessId = businessId.trim();
|
|
58
|
+
|
|
59
|
+
// email = email.toLowerCase();
|
|
60
|
+
// email = email.trim();
|
|
61
|
+
|
|
62
|
+
// // Handle both string and SchemaObjectId inputs
|
|
63
|
+
// let objectId: Types.ObjectId;
|
|
64
|
+
// if (typeof businessId === 'string') {
|
|
65
|
+
// objectId = new Types.ObjectId(businessId);
|
|
66
|
+
// } else {
|
|
67
|
+
// // If it's already a SchemaObjectId, extract the string value
|
|
68
|
+
// const businessIdString = (businessId as any).path || (businessId as any).toString();
|
|
69
|
+
// objectId = new Types.ObjectId(businessIdString);
|
|
70
|
+
// }
|
|
71
|
+
|
|
72
|
+
// this.context.log("ObjectId:", JSON.stringify(objectId));
|
|
73
|
+
// const user = await model.findOne({ businessId: objectId, email: email });
|
|
74
|
+
// this.context.log("User:", JSON.stringify(user));
|
|
75
|
+
// return user;
|
|
76
|
+
// } catch (error) {
|
|
77
|
+
// this.context.error("Error in getUserByBusinessId", error);
|
|
78
|
+
// throw error;
|
|
79
|
+
// }
|
|
80
|
+
// }
|
|
81
|
+
|
|
82
|
+
// @WithDb
|
|
83
|
+
// async getUserByEmail(email: string) {
|
|
84
|
+
// try {
|
|
85
|
+
// let model = this.getModel();
|
|
86
|
+
// this.context.log("Email:", JSON.stringify(email));
|
|
87
|
+
|
|
88
|
+
// email = email.toLowerCase();
|
|
89
|
+
// email = email.trim();
|
|
90
|
+
// const user = await model.findOne({ email: email });
|
|
91
|
+
// this.context.log("User:", JSON.stringify(user));
|
|
92
|
+
// return user;
|
|
93
|
+
// } catch (error) {
|
|
94
|
+
// this.context.error("Error in getUserByEmail", error);
|
|
95
|
+
// throw error;
|
|
96
|
+
// }
|
|
97
|
+
// }
|
|
98
|
+
}
|
|
99
|
+
exports.UserService = UserService;
|
|
95
100
|
//# sourceMappingURL=user.service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user.service.js","names":["
|
|
1
|
+
{"version":3,"file":"user.service.js","names":["_shared","require","UserService","Initializers","constructor","context","dbUrl","exports"],"sources":["../../../src/service/user.service.ts"],"sourcesContent":["import { Types } from \"mongoose\";\nimport { InvocationContext } from \"@azure/functions\";\nimport IUser\n// { UserModel }\n from \"../models/user.model\";\nimport { Initializers, WithDb } from \"@culturefy/shared\";\n\nexport class UserService extends Initializers {\n\n // private readonly schema = UserModel.schema;\n constructor(context: InvocationContext, dbUrl:string) {\n super(context, dbUrl);\n }\n\n // private getModel() {\n // const connection = (this as any).getConnection();\n // if (!connection) {\n // throw new Error('Database connection not established');\n // }\n // return connection.model(UserModel.modelName, this.schema);\n // }\n\n // @WithDb\n // async getUserById(userId: string): Promise<IUser | null> {\n // try {\n // let model = this.getModel();\n // this.context.log(\"UserId:\", JSON.stringify(userId));\n \n // // Handle both string and SchemaObjectId inputs\n // let objectId: Types.ObjectId;\n // if (typeof userId === 'string') {\n // objectId = new Types.ObjectId(userId);\n // } else {\n // // If it's already a SchemaObjectId, extract the string value\n // const userIdString = (userId as any).path || (userId as any).toString();\n // objectId = new Types.ObjectId(userIdString);\n // }\n \n // this.context.log(\"ObjectId:\", JSON.stringify(objectId));\n // const user = await model.findById(objectId);\n // this.context.log(\"User:\", JSON.stringify(user));\n // return user;\n // } catch (error) {\n // this.context.error(\"Error in getUserById\", error);\n // throw error;\n // }\n // }\n\n // @WithDb\n // async getUserByBusinessId(businessId: string, email: string): Promise<IUser | null> {\n // try {\n // let model = this.getModel();\n // this.context.log(\"BusinessId:\", JSON.stringify(businessId));\n // this.context.log(\"Email:\", JSON.stringify(email));\n\n // if(!businessId) return null;\n // if(!email) return null;\n\n // businessId = businessId.toLowerCase();\n // businessId = businessId.trim();\n\n // email = email.toLowerCase();\n // email = email.trim();\n\n // // Handle both string and SchemaObjectId inputs\n // let objectId: Types.ObjectId;\n // if (typeof businessId === 'string') {\n // objectId = new Types.ObjectId(businessId);\n // } else {\n // // If it's already a SchemaObjectId, extract the string value\n // const businessIdString = (businessId as any).path || (businessId as any).toString();\n // objectId = new Types.ObjectId(businessIdString);\n // }\n \n // this.context.log(\"ObjectId:\", JSON.stringify(objectId));\n // const user = await model.findOne({ businessId: objectId, email: email });\n // this.context.log(\"User:\", JSON.stringify(user));\n // return user;\n // } catch (error) {\n // this.context.error(\"Error in getUserByBusinessId\", error);\n // throw error;\n // }\n // }\n\n // @WithDb\n // async getUserByEmail(email: string) {\n // try {\n // let model = this.getModel();\n // this.context.log(\"Email:\", JSON.stringify(email));\n\n // email = email.toLowerCase();\n // email = email.trim();\n // const user = await model.findOne({ email: email });\n // this.context.log(\"User:\", JSON.stringify(user));\n // return user;\n // } catch (error) {\n // this.context.error(\"Error in getUserByEmail\", error);\n // throw error;\n // }\n // }\n}\n"],"mappings":";;;;AAKA,IAAAA,OAAA,GAAAC,OAAA;AAEO,MAAMC,WAAW,SAASC,oBAAY,CAAC;EAE1C;EACAC,WAAWA,CAACC,OAA0B,EAAEC,KAAY,EAAE;IAClD,KAAK,CAACD,OAAO,EAAEC,KAAK,CAAC;EACzB;;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;;EAEA;EACA;EACA;EACA;EACA;;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;EAEA;EACA;EACA;EACA;EACA;EACA;;EAEA;EACA;;EAEA;EACA;;EAEA;EACA;;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;EAEA;EACA;EACA;EACA;EACA;;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;AACJ;AAACC,OAAA,CAAAL,WAAA,GAAAA,WAAA","ignoreList":[]}
|
|
@@ -385,7 +385,8 @@ async function validateUserByRealm(realm, email, context) {
|
|
|
385
385
|
let user = null;
|
|
386
386
|
context.log("Getting user by realm:", realm);
|
|
387
387
|
try {
|
|
388
|
-
user = await userService.getUserByBusinessId(realm, email);
|
|
388
|
+
// user = await userService.getUserByBusinessId(realm, email);
|
|
389
|
+
user = '';
|
|
389
390
|
} catch (err) {
|
|
390
391
|
context.error(`Failed to get user by realm:`, err);
|
|
391
392
|
return {
|
|
@@ -419,7 +420,8 @@ async function validateUserByEmail(email, context) {
|
|
|
419
420
|
let user = null;
|
|
420
421
|
context.log("Getting user by email:", email);
|
|
421
422
|
try {
|
|
422
|
-
user = await userService.getUserByEmail(email);
|
|
423
|
+
// user = await userService.getUserByEmail(email);
|
|
424
|
+
user = '';
|
|
423
425
|
} catch (err) {
|
|
424
426
|
context.error(`Failed to get user by email:`, err);
|
|
425
427
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"token-validation.js","names":["AzureSecretKeysEnum","UserService","KeycloakAdminService","getAzureVaultSecretByKey","parseCookies","verifyJsonWebToken","tokenValidation","request","domain","context","cookies","accessToken","refreshToken","expiresIn","refreshExpiresIn","status","message","keycloakService","initializeKeycloakService","validateToken","success","expired","data","userId","clientId","realm","email","log","JSON","stringify","refreshTokenResponse","handleTokenRefresh","refreshTokenData","access_token","refresh_token","expires_in","refresh_expires_in","verifyFromDb","userInfo","introspectionValid","validateTokenIntrospection","getUserByToken","validateUserByEmail","validateUserByRealm","user","businessId","toString","updatedCookies","error","keycloakBaseUrl","keycloakAdminClientId","keycloakAdminClientSecret","Promise","all","process","env","AZURE_KEY_VAULT_NAME","KEYCLOAK_BASE_URL","KEYCLOAK_ADMIN_CLIENT_ID","KEYCLOAK_ADMIN_CLIENT_SECRET","baseUrl","adminClientId","adminClientSecret","currentTime","Math","floor","Date","now","decoded","iat","exp","sub","azp","iss","split","length","info","refreshTokenDecoded","refreshIss","refreshIat","refreshExp","refreshUserId","refreshClientId","refreshEmail","newToken","newTokenDecoded","newIat","newExp","newUserId","newClientId","newIss","newEmail","authDbUrl","DB_CONNECTING_STRING_USER","userService","getUserByBusinessId","err","disconnect","getUserByEmail","token","introspection","introspectToken","active","warn","_error$message","_error$message2","_error$message3","includes"],"sources":["../../../src/middlewares/token-validation.ts"],"sourcesContent":["\nimport IUser from \"../models/user.model\";\nimport { AzureSecretKeysEnum } from \"../enums\";\nimport { UserService } from \"../service/user.service\";\nimport { HttpRequest, InvocationContext } from \"@azure/functions\";\nimport { KeycloakAdminService } from \"../service/keycloak.service\";\nimport { getAzureVaultSecretByKey, parseCookies, verifyJsonWebToken } from \"../utils\";\n\ninterface TokenValidationResult {\n status: boolean;\n message: string;\n data?: {\n cookies: {\n access_token: string;\n refresh_token: string;\n expires_in?: number;\n refresh_expires_in?: number;\n };\n user: IUser;\n };\n}\n\ninterface TokenClaims {\n iat?: number;\n exp?: number;\n sub: string;\n azp: string;\n iss: string;\n email: string;\n}\n\nexport async function tokenValidation(request: HttpRequest, domain: string, context: InvocationContext): Promise<TokenValidationResult> {\n try {\n let cookies = parseCookies(request, context);\n let accessToken = cookies[\"culturefy-auth-token\"];\n let refreshToken = cookies[\"culturefy-refresh-token\"];\n\n let expiresIn, refreshExpiresIn;\n\n if (!accessToken) return { status: false, message: \"Access token is required\" };\n\n const keycloakService = await initializeKeycloakService(context);\n\n const tokenValidation = await validateToken(accessToken, context);\n\n if (!tokenValidation.success) {\n if (tokenValidation.expired) {\n const { data } = tokenValidation;\n if (!data) return { status: false, message: \"Invalid access token.\" };\n\n let { userId, clientId, realm, email } = data;\n\n if (!clientId) return { status: false, message: \"Invalid access token provided\" };\n if (!userId) return { status: false, message: \"Invalid access token provided\" };\n if (!realm) return { status: false, message: \"Invalid access token provided\" };\n\n context.log(\"Refreshing token for user:\", JSON.stringify({ userId, clientId, realm, email }));\n\n const refreshTokenResponse = await handleTokenRefresh(keycloakService, refreshToken, userId, clientId, realm, email, domain, context);\n if (!refreshTokenResponse.success) return { status: false, message: refreshTokenResponse.message };\n\n const { data: refreshTokenData } = refreshTokenResponse;\n if (!refreshTokenData) return { status: false, message: \"Invalid refresh token.\" };\n \n context.log(\"Refreshed token for user:\", JSON.stringify({ userId, clientId, realm, email }));\n\n accessToken = refreshTokenData.access_token;\n refreshToken = refreshTokenData.refresh_token;\n expiresIn = refreshTokenData.expires_in;\n refreshExpiresIn = refreshTokenData.refresh_expires_in;\n\n } else {\n return { status: false, message: tokenValidation.message };\n }\n }\n\n const { data } = tokenValidation;\n\n if (!data) return { status: false, message: \"Invalid access token.\" };\n\n let { userId, clientId, realm, email } = data;\n\n if (!clientId) return { status: false, message: \"Invalid access token provided\" };\n if (!userId) return { status: false, message: \"Invalid access token provided\" };\n if (!realm) return { status: false, message: \"Invalid access token provided\" };\n if (!email) return { status: false, message: \"Invalid access token provided\" };\n\n context.log(\"Validating user:\", JSON.stringify({ userId, clientId, realm, email }));\n\n let verifyFromDb;\n let userInfo;\n\n if(domain === \"accounts.culturefy.app\") {\n const introspectionValid = await validateTokenIntrospection(\n keycloakService,\n accessToken,\n realm,\n clientId,\n domain,\n context\n );\n \n if (!introspectionValid) return { status: false, message: \"Token introspection failed\" };\n context.log(\"Token introspection successful\");\n \n realm = \"superadmin\";\n clientId = \"cfy-superadmin-web\";\n \n userInfo = await keycloakService.getUserByToken(realm, accessToken);\n context.log(\"User info-1:\", JSON.stringify(userInfo));\n\n if(!userInfo.email) return { status: false, message: \"User email not found\" };\n if(userInfo.email !== email) return { status: false, message: \"User email does not match\" };\n email = userInfo.email;\n verifyFromDb = await validateUserByEmail(email, context);\n if (!verifyFromDb.success) return { status: false, message: verifyFromDb.message };\n } else {\n clientId = \"cfy-web\";\n verifyFromDb = await validateUserByRealm(realm, email, context);\n }\n\n if (!verifyFromDb.success) return { status: false, message: verifyFromDb.message };\n\n const user = verifyFromDb.user;\n\n if (!user) return { status: false, message: \"User not found.\" };\n context.log(\"User:\", JSON.stringify(user));\n\n const introspectionValid = await validateTokenIntrospection(\n keycloakService,\n accessToken,\n realm,\n clientId,\n domain,\n context\n );\n\n if (!introspectionValid) return { status: false, message: \"Token introspection failed\" };\n context.log(\"Token introspection successful\");\n\n if (domain === \"accounts.culturefy.app\") {\n realm = \"superadmin\";\n clientId = \"cfy-superadmin-web\";\n } else {\n if(!user.businessId) return { status: false, message: \"User not found\" };\n realm = user.businessId.toString();\n clientId = \"cfy-web\";\n }\n\n if(!userInfo) {\n userInfo = await keycloakService.getUserByToken(realm, accessToken);\n context.log(\"User info-2:\", JSON.stringify(userInfo));\n }\n\n if(!userInfo) return { status: false, message: \"User info not found\" };\n\n let updatedCookies: {\n access_token: string;\n refresh_token: string;\n expires_in?: number;\n refresh_expires_in?: number;\n } = {\n access_token: accessToken,\n refresh_token: refreshToken,\n };\n\n if(expiresIn) updatedCookies.expires_in = expiresIn;\n if(refreshExpiresIn) updatedCookies.refresh_expires_in = refreshExpiresIn;\n\n return {\n status: true,\n message: \"Token is valid\",\n data: {\n cookies: updatedCookies,\n user: user\n }\n };\n\n } catch (error) {\n context.error(\"Culturefy token validation error:\", error);\n return { status: false, message: \"Internal server error during culturefy token validation\" };\n }\n}\n\nasync function initializeKeycloakService(context: InvocationContext): Promise<KeycloakAdminService> {\n const [keycloakBaseUrl, keycloakAdminClientId, keycloakAdminClientSecret] = await Promise.all([\n getAzureVaultSecretByKey(\n context,\n process.env.AZURE_KEY_VAULT_NAME || \"\",\n AzureSecretKeysEnum.KEYCLOAK_BASE_URL\n ),\n getAzureVaultSecretByKey(\n context,\n process.env.AZURE_KEY_VAULT_NAME || \"\",\n AzureSecretKeysEnum.KEYCLOAK_ADMIN_CLIENT_ID\n ),\n getAzureVaultSecretByKey(\n context,\n process.env.AZURE_KEY_VAULT_NAME || \"\",\n AzureSecretKeysEnum.KEYCLOAK_ADMIN_CLIENT_SECRET\n )\n ]);\n\n return new KeycloakAdminService(context, {\n baseUrl: keycloakBaseUrl as string,\n adminClientId: keycloakAdminClientId as string,\n adminClientSecret: keycloakAdminClientSecret as string\n });\n}\n\nasync function validateToken(\n accessToken: string,\n context: InvocationContext\n): Promise<{\n success: boolean;\n message: string;\n expired?: boolean;\n data?: {\n userId: string;\n clientId: string;\n realm: string;\n email: string;\n };\n}> {\n const currentTime = Math.floor(Date.now() / 1000);\n\n const decoded = verifyJsonWebToken(accessToken);\n\n if (!decoded) return { success: false, message: \"Invalid access token format\" };\n\n let { iat, exp, sub: userId, azp: clientId, iss, email } = decoded as TokenClaims;\n \n if (!userId || !clientId || !iss) return { success: false, message: \"Access token missing required claims (sub or azp or iss)\" };\n context.log(\"Access token claims:\", JSON.stringify(decoded));\n \n let realm = iss.split(\"/\")[iss.split(\"/\").length - 1];\n if(!realm) return { success: false, message: \"Access token missing required claims (iss)\" };\n\n if (exp && exp < currentTime) return { success: false, message: \"Access token expired and refresh token not provided\", expired: true, data: { userId, clientId, realm, email } };\n \n if (iat && iat > currentTime) return { success: false, message: \"Invalid token issuance time\" };\n\n return {\n success: true,\n message: \"Token is valid\",\n data: { userId, clientId, realm, email }\n };\n}\n\nasync function handleTokenRefresh(\n keycloakService: KeycloakAdminService,\n refreshToken: string,\n userId: string,\n clientId: string,\n realm: string,\n email: string,\n domain: string,\n context: InvocationContext\n): Promise<{\n success: boolean;\n message: string;\n data?: {\n access_token: string;\n expires_in: number;\n refresh_token: string;\n refresh_expires_in: number;\n };\n}> {\n const currentTime = Math.floor(Date.now() / 1000);\n\n if(!clientId) return { success: false, message: \"Client ID is missing\" };\n if(!userId) return { success: false, message: \"User ID is missing\" };\n if(!realm) return { success: false, message: \"Realm is missing\" };\n if(!refreshToken) return { success: false, message: \"Refresh token is missing\" };\n if(!email) return { success: false, message: \"Email is missing\" };\n if(!domain) return { success: false, message: \"Domain is missing\" };\n\n context.info(\"values:\", {clientId, userId, realm, email, domain});\n\n const refreshTokenDecoded = verifyJsonWebToken(refreshToken);\n if (!refreshTokenDecoded) return { success: false, message: \"Invalid refresh token format\" };\n\n let { iss: refreshIss } = refreshTokenDecoded as TokenClaims;\n refreshIss = refreshIss.split(\"/\")[refreshIss.split(\"/\").length - 1];\n\n const { iat: refreshIat, exp: refreshExp, sub: refreshUserId, azp: refreshClientId, email: refreshEmail } = refreshTokenDecoded as TokenClaims;\n\n context.info(\"refreshTokenDecoded:\", JSON.stringify({refreshUserId, refreshClientId, refreshIss, refreshEmail}));\n\n if (!refreshUserId || !refreshClientId || !refreshIss) return { success: false, message: \"Refresh token missing required claims (sub or azp or iss)\" };\n\n if (refreshExp && refreshExp < currentTime) return { success: false, message: \"Refresh token has expired\" };\n\n if (refreshIat && refreshIat > currentTime) return { success: false, message: \"Invalid refresh token issuance time\" };\n\n if (refreshUserId !== userId || refreshClientId !== clientId || refreshIss !== realm || refreshEmail !== email) return { success: false, message: \"Refresh token does not match access token user\" };\n\n if(domain === \"accounts.culturefy.app\") {\n realm = \"superadmin\";\n clientId = \"cfy-superadmin-web\";\n } else {\n realm = realm;\n clientId = \"cfy-web\";\n }\n\n const newToken = await keycloakService.refreshToken(realm, clientId, refreshToken);\n if (!newToken) return { success: false, message: \"Failed to refresh access token\" };\n\n const newTokenDecoded = verifyJsonWebToken(newToken.access_token);\n if (!newTokenDecoded) return { success: false, message: \"Invalid new token format\" };\n\n const { iat: newIat, exp: newExp, sub: newUserId, azp: newClientId, iss: newIss, email: newEmail } = newTokenDecoded as TokenClaims;\n\n if (!newUserId || !newClientId || !newIss || !newEmail) return { success: false, message: \"New token missing required claims (sub or azp or iss or email)\" };\n\n if (newExp && newExp < currentTime) return { success: false, message: \"New token has expired\" };\n\n if (newIat && newIat > currentTime) return { success: false, message: \"Invalid new token issuance time\" };\n\n context.info(\"Token refreshed successfully for user:\", userId);\n\n return {\n success: true,\n message: \"Token refreshed successfully\",\n data: {\n access_token: newToken.access_token, expires_in: newToken.expires_in,\n refresh_token: newToken.refresh_token, refresh_expires_in: newToken.refresh_expires_in\n }\n };\n}\n\nasync function validateUserByRealm(\n realm: string,\n email: string,\n context: InvocationContext\n): Promise<{\n success: boolean;\n message: string;\n user?: any;\n}> {\n try {\n const authDbUrl = await getAzureVaultSecretByKey(\n context,\n process.env.AZURE_KEY_VAULT_NAME || \"\",\n AzureSecretKeysEnum.DB_CONNECTING_STRING_USER\n );\n\n const userService = new UserService(context, authDbUrl);\n\n let user = null;\n context.log(\"Getting user by realm:\", realm);\n try {\n user = await userService.getUserByBusinessId(realm, email);\n } catch (err: any) {\n context.error(`Failed to get user by realm:`, err);\n return { success: false, message: \"User not found..\" };\n }\n context.log(\"User:\", JSON.stringify(user));\n\n if (!user) return { success: false, message: \"User not found...\" };\n\n await userService.disconnect();\n\n return { success: true, message: \"User validation successful\", user };\n\n } catch (error) {\n context.error(\"User validation error:\", error);\n return { success: false, message: \"Error validating user information\" };\n }\n}\n\nasync function validateUserByEmail(\n email: string,\n context: InvocationContext\n): Promise<{\n success: boolean;\n message: string;\n user?: any;\n}> {\n try {\n const authDbUrl = await getAzureVaultSecretByKey(\n context,\n process.env.AZURE_KEY_VAULT_NAME || \"\",\n AzureSecretKeysEnum.DB_CONNECTING_STRING_USER\n );\n\n const userService = new UserService(context, authDbUrl);\n\n let user = null;\n context.log(\"Getting user by email:\", email);\n try {\n user = await userService.getUserByEmail(email);\n } catch (err: any) {\n context.error(`Failed to get user by email:`, err);\n return { success: false, message: \"User not found..\" };\n }\n context.log(\"User:\", JSON.stringify(user));\n\n if (!user) return { success: false, message: \"User not found...\" };\n\n await userService.disconnect();\n\n return { success: true, message: \"User validation successful\", user };\n\n } catch (error) {\n context.error(\"User validation error:\", error);\n return { success: false, message: \"Error validating user information\" };\n }\n}\n\nasync function validateTokenIntrospection(\n keycloakService: KeycloakAdminService,\n token: string,\n realm: string,\n clientId: string,\n domain: string,\n context: InvocationContext\n): Promise<boolean> {\n try {\n if(!realm) return false;\n if(!clientId) return false;\n if(!token) return false;\n \n if (domain === \"accounts.culturefy.app\") {\n realm = \"superadmin\";\n clientId = \"cfy-superadmin-web\";\n } else {\n realm = realm;\n clientId = \"cfy-web\";\n }\n\n context.info(\"Validating token with Keycloak introspection\");\n const introspection = await keycloakService.introspectToken(realm, clientId, token);\n\n if (!introspection.active) {\n context.warn(\"Token introspection returned inactive token\");\n return false;\n }\n\n context.info(\"Token introspection successful - token is active\");\n return true;\n } catch (error: any) {\n context.error(\"Token introspection error:\", error);\n\n if (error.message?.includes('Client not allowed')) {\n context.warn(\"Admin-cli client does not have introspection permissions - this is expected\");\n return true;\n }\n\n if (error.message?.includes('Invalid token')) return false;\n\n if (error.message?.includes('Token is not active')) return false;\n\n return false;\n }\n}"],"mappings":"AAEA,SAASA,mBAAmB,QAAQ,UAAU;AAC9C,SAASC,WAAW,QAAQ,yBAAyB;AAErD,SAASC,oBAAoB,QAAQ,6BAA6B;AAClE,SAASC,wBAAwB,EAAEC,YAAY,EAAEC,kBAAkB,QAAQ,UAAU;AAyBrF,OAAO,eAAeC,eAAeA,CAACC,OAAoB,EAAEC,MAAc,EAAEC,OAA0B,EAAkC;EACpI,IAAI;IACA,IAAIC,OAAO,GAAGN,YAAY,CAACG,OAAO,EAAEE,OAAO,CAAC;IAC5C,IAAIE,WAAW,GAAGD,OAAO,CAAC,sBAAsB,CAAC;IACjD,IAAIE,YAAY,GAAGF,OAAO,CAAC,yBAAyB,CAAC;IAErD,IAAIG,SAAS,EAAEC,gBAAgB;IAE/B,IAAI,C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MAC/ClG,OAAO,CAAC8F,IAAI,CAAC,6EAA6E,CAAC;MAC3F,OAAO,IAAI;IACf;IAEA,KAAAE,eAAA,GAAIzD,KAAK,CAAChC,OAAO,aAAbyF,eAAA,CAAeE,QAAQ,CAAC,eAAe,CAAC,EAAE,OAAO,KAAK;IAE1D,KAAAD,eAAA,GAAI1D,KAAK,CAAChC,OAAO,aAAb0F,eAAA,CAAeC,QAAQ,CAAC,qBAAqB,CAAC,EAAE,OAAO,KAAK;IAEhE,OAAO,KAAK;EAChB;AACJ","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"token-validation.js","names":["AzureSecretKeysEnum","UserService","KeycloakAdminService","getAzureVaultSecretByKey","parseCookies","verifyJsonWebToken","tokenValidation","request","domain","context","cookies","accessToken","refreshToken","expiresIn","refreshExpiresIn","status","message","keycloakService","initializeKeycloakService","validateToken","success","expired","data","userId","clientId","realm","email","log","JSON","stringify","refreshTokenResponse","handleTokenRefresh","refreshTokenData","access_token","refresh_token","expires_in","refresh_expires_in","verifyFromDb","userInfo","introspectionValid","validateTokenIntrospection","getUserByToken","validateUserByEmail","validateUserByRealm","user","businessId","toString","updatedCookies","error","keycloakBaseUrl","keycloakAdminClientId","keycloakAdminClientSecret","Promise","all","process","env","AZURE_KEY_VAULT_NAME","KEYCLOAK_BASE_URL","KEYCLOAK_ADMIN_CLIENT_ID","KEYCLOAK_ADMIN_CLIENT_SECRET","baseUrl","adminClientId","adminClientSecret","currentTime","Math","floor","Date","now","decoded","iat","exp","sub","azp","iss","split","length","info","refreshTokenDecoded","refreshIss","refreshIat","refreshExp","refreshUserId","refreshClientId","refreshEmail","newToken","newTokenDecoded","newIat","newExp","newUserId","newClientId","newIss","newEmail","authDbUrl","DB_CONNECTING_STRING_USER","userService","err","disconnect","token","introspection","introspectToken","active","warn","_error$message","_error$message2","_error$message3","includes"],"sources":["../../../src/middlewares/token-validation.ts"],"sourcesContent":["\nimport IUser from \"../models/user.model\";\nimport { AzureSecretKeysEnum } from \"../enums\";\nimport { UserService } from \"../service/user.service\";\nimport { HttpRequest, InvocationContext } from \"@azure/functions\";\nimport { KeycloakAdminService } from \"../service/keycloak.service\";\nimport { getAzureVaultSecretByKey, parseCookies, verifyJsonWebToken } from \"../utils\";\n\ninterface TokenValidationResult {\n status: boolean;\n message: string;\n data?: {\n cookies: {\n access_token: string;\n refresh_token: string;\n expires_in?: number;\n refresh_expires_in?: number;\n };\n user: IUser;\n };\n}\n\ninterface TokenClaims {\n iat?: number;\n exp?: number;\n sub: string;\n azp: string;\n iss: string;\n email: string;\n}\n\nexport async function tokenValidation(request: HttpRequest, domain: string, context: InvocationContext): Promise<TokenValidationResult> {\n try {\n let cookies = parseCookies(request, context);\n let accessToken = cookies[\"culturefy-auth-token\"];\n let refreshToken = cookies[\"culturefy-refresh-token\"];\n\n let expiresIn, refreshExpiresIn;\n\n if (!accessToken) return { status: false, message: \"Access token is required\" };\n\n const keycloakService = await initializeKeycloakService(context);\n\n const tokenValidation = await validateToken(accessToken, context);\n\n if (!tokenValidation.success) {\n if (tokenValidation.expired) {\n const { data } = tokenValidation;\n if (!data) return { status: false, message: \"Invalid access token.\" };\n\n let { userId, clientId, realm, email } = data;\n\n if (!clientId) return { status: false, message: \"Invalid access token provided\" };\n if (!userId) return { status: false, message: \"Invalid access token provided\" };\n if (!realm) return { status: false, message: \"Invalid access token provided\" };\n\n context.log(\"Refreshing token for user:\", JSON.stringify({ userId, clientId, realm, email }));\n\n const refreshTokenResponse = await handleTokenRefresh(keycloakService, refreshToken, userId, clientId, realm, email, domain, context);\n if (!refreshTokenResponse.success) return { status: false, message: refreshTokenResponse.message };\n\n const { data: refreshTokenData } = refreshTokenResponse;\n if (!refreshTokenData) return { status: false, message: \"Invalid refresh token.\" };\n \n context.log(\"Refreshed token for user:\", JSON.stringify({ userId, clientId, realm, email }));\n\n accessToken = refreshTokenData.access_token;\n refreshToken = refreshTokenData.refresh_token;\n expiresIn = refreshTokenData.expires_in;\n refreshExpiresIn = refreshTokenData.refresh_expires_in;\n\n } else {\n return { status: false, message: tokenValidation.message };\n }\n }\n\n const { data } = tokenValidation;\n\n if (!data) return { status: false, message: \"Invalid access token.\" };\n\n let { userId, clientId, realm, email } = data;\n\n if (!clientId) return { status: false, message: \"Invalid access token provided\" };\n if (!userId) return { status: false, message: \"Invalid access token provided\" };\n if (!realm) return { status: false, message: \"Invalid access token provided\" };\n if (!email) return { status: false, message: \"Invalid access token provided\" };\n\n context.log(\"Validating user:\", JSON.stringify({ userId, clientId, realm, email }));\n\n let verifyFromDb;\n let userInfo;\n\n if(domain === \"accounts.culturefy.app\") {\n const introspectionValid = await validateTokenIntrospection(\n keycloakService,\n accessToken,\n realm,\n clientId,\n domain,\n context\n );\n \n if (!introspectionValid) return { status: false, message: \"Token introspection failed\" };\n context.log(\"Token introspection successful\");\n \n realm = \"superadmin\";\n clientId = \"cfy-superadmin-web\";\n \n userInfo = await keycloakService.getUserByToken(realm, accessToken);\n context.log(\"User info-1:\", JSON.stringify(userInfo));\n\n if(!userInfo.email) return { status: false, message: \"User email not found\" };\n if(userInfo.email !== email) return { status: false, message: \"User email does not match\" };\n email = userInfo.email;\n verifyFromDb = await validateUserByEmail(email, context);\n if (!verifyFromDb.success) return { status: false, message: verifyFromDb.message };\n } else {\n clientId = \"cfy-web\";\n verifyFromDb = await validateUserByRealm(realm, email, context);\n }\n\n if (!verifyFromDb.success) return { status: false, message: verifyFromDb.message };\n\n const user = verifyFromDb.user;\n\n if (!user) return { status: false, message: \"User not found.\" };\n context.log(\"User:\", JSON.stringify(user));\n\n const introspectionValid = await validateTokenIntrospection(\n keycloakService,\n accessToken,\n realm,\n clientId,\n domain,\n context\n );\n\n if (!introspectionValid) return { status: false, message: \"Token introspection failed\" };\n context.log(\"Token introspection successful\");\n\n if (domain === \"accounts.culturefy.app\") {\n realm = \"superadmin\";\n clientId = \"cfy-superadmin-web\";\n } else {\n if(!user.businessId) return { status: false, message: \"User not found\" };\n realm = user.businessId.toString();\n clientId = \"cfy-web\";\n }\n\n if(!userInfo) {\n userInfo = await keycloakService.getUserByToken(realm, accessToken);\n context.log(\"User info-2:\", JSON.stringify(userInfo));\n }\n\n if(!userInfo) return { status: false, message: \"User info not found\" };\n\n let updatedCookies: {\n access_token: string;\n refresh_token: string;\n expires_in?: number;\n refresh_expires_in?: number;\n } = {\n access_token: accessToken,\n refresh_token: refreshToken,\n };\n\n if(expiresIn) updatedCookies.expires_in = expiresIn;\n if(refreshExpiresIn) updatedCookies.refresh_expires_in = refreshExpiresIn;\n\n return {\n status: true,\n message: \"Token is valid\",\n data: {\n cookies: updatedCookies,\n user: user\n }\n };\n\n } catch (error) {\n context.error(\"Culturefy token validation error:\", error);\n return { status: false, message: \"Internal server error during culturefy token validation\" };\n }\n}\n\nasync function initializeKeycloakService(context: InvocationContext): Promise<KeycloakAdminService> {\n const [keycloakBaseUrl, keycloakAdminClientId, keycloakAdminClientSecret] = await Promise.all([\n getAzureVaultSecretByKey(\n context,\n process.env.AZURE_KEY_VAULT_NAME || \"\",\n AzureSecretKeysEnum.KEYCLOAK_BASE_URL\n ),\n getAzureVaultSecretByKey(\n context,\n process.env.AZURE_KEY_VAULT_NAME || \"\",\n AzureSecretKeysEnum.KEYCLOAK_ADMIN_CLIENT_ID\n ),\n getAzureVaultSecretByKey(\n context,\n process.env.AZURE_KEY_VAULT_NAME || \"\",\n AzureSecretKeysEnum.KEYCLOAK_ADMIN_CLIENT_SECRET\n )\n ]);\n\n return new KeycloakAdminService(context, {\n baseUrl: keycloakBaseUrl as string,\n adminClientId: keycloakAdminClientId as string,\n adminClientSecret: keycloakAdminClientSecret as string\n });\n}\n\nasync function validateToken(\n accessToken: string,\n context: InvocationContext\n): Promise<{\n success: boolean;\n message: string;\n expired?: boolean;\n data?: {\n userId: string;\n clientId: string;\n realm: string;\n email: string;\n };\n}> {\n const currentTime = Math.floor(Date.now() / 1000);\n\n const decoded = verifyJsonWebToken(accessToken);\n\n if (!decoded) return { success: false, message: \"Invalid access token format\" };\n\n let { iat, exp, sub: userId, azp: clientId, iss, email } = decoded as TokenClaims;\n \n if (!userId || !clientId || !iss) return { success: false, message: \"Access token missing required claims (sub or azp or iss)\" };\n context.log(\"Access token claims:\", JSON.stringify(decoded));\n \n let realm = iss.split(\"/\")[iss.split(\"/\").length - 1];\n if(!realm) return { success: false, message: \"Access token missing required claims (iss)\" };\n\n if (exp && exp < currentTime) return { success: false, message: \"Access token expired and refresh token not provided\", expired: true, data: { userId, clientId, realm, email } };\n \n if (iat && iat > currentTime) return { success: false, message: \"Invalid token issuance time\" };\n\n return {\n success: true,\n message: \"Token is valid\",\n data: { userId, clientId, realm, email }\n };\n}\n\nasync function handleTokenRefresh(\n keycloakService: KeycloakAdminService,\n refreshToken: string,\n userId: string,\n clientId: string,\n realm: string,\n email: string,\n domain: string,\n context: InvocationContext\n): Promise<{\n success: boolean;\n message: string;\n data?: {\n access_token: string;\n expires_in: number;\n refresh_token: string;\n refresh_expires_in: number;\n };\n}> {\n const currentTime = Math.floor(Date.now() / 1000);\n\n if(!clientId) return { success: false, message: \"Client ID is missing\" };\n if(!userId) return { success: false, message: \"User ID is missing\" };\n if(!realm) return { success: false, message: \"Realm is missing\" };\n if(!refreshToken) return { success: false, message: \"Refresh token is missing\" };\n if(!email) return { success: false, message: \"Email is missing\" };\n if(!domain) return { success: false, message: \"Domain is missing\" };\n\n context.info(\"values:\", {clientId, userId, realm, email, domain});\n\n const refreshTokenDecoded = verifyJsonWebToken(refreshToken);\n if (!refreshTokenDecoded) return { success: false, message: \"Invalid refresh token format\" };\n\n let { iss: refreshIss } = refreshTokenDecoded as TokenClaims;\n refreshIss = refreshIss.split(\"/\")[refreshIss.split(\"/\").length - 1];\n\n const { iat: refreshIat, exp: refreshExp, sub: refreshUserId, azp: refreshClientId, email: refreshEmail } = refreshTokenDecoded as TokenClaims;\n\n context.info(\"refreshTokenDecoded:\", JSON.stringify({refreshUserId, refreshClientId, refreshIss, refreshEmail}));\n\n if (!refreshUserId || !refreshClientId || !refreshIss) return { success: false, message: \"Refresh token missing required claims (sub or azp or iss)\" };\n\n if (refreshExp && refreshExp < currentTime) return { success: false, message: \"Refresh token has expired\" };\n\n if (refreshIat && refreshIat > currentTime) return { success: false, message: \"Invalid refresh token issuance time\" };\n\n if (refreshUserId !== userId || refreshClientId !== clientId || refreshIss !== realm || refreshEmail !== email) return { success: false, message: \"Refresh token does not match access token user\" };\n\n if(domain === \"accounts.culturefy.app\") {\n realm = \"superadmin\";\n clientId = \"cfy-superadmin-web\";\n } else {\n realm = realm;\n clientId = \"cfy-web\";\n }\n\n const newToken = await keycloakService.refreshToken(realm, clientId, refreshToken);\n if (!newToken) return { success: false, message: \"Failed to refresh access token\" };\n\n const newTokenDecoded = verifyJsonWebToken(newToken.access_token);\n if (!newTokenDecoded) return { success: false, message: \"Invalid new token format\" };\n\n const { iat: newIat, exp: newExp, sub: newUserId, azp: newClientId, iss: newIss, email: newEmail } = newTokenDecoded as TokenClaims;\n\n if (!newUserId || !newClientId || !newIss || !newEmail) return { success: false, message: \"New token missing required claims (sub or azp or iss or email)\" };\n\n if (newExp && newExp < currentTime) return { success: false, message: \"New token has expired\" };\n\n if (newIat && newIat > currentTime) return { success: false, message: \"Invalid new token issuance time\" };\n\n context.info(\"Token refreshed successfully for user:\", userId);\n\n return {\n success: true,\n message: \"Token refreshed successfully\",\n data: {\n access_token: newToken.access_token, expires_in: newToken.expires_in,\n refresh_token: newToken.refresh_token, refresh_expires_in: newToken.refresh_expires_in\n }\n };\n}\n\nasync function validateUserByRealm(\n realm: string,\n email: string,\n context: InvocationContext\n): Promise<{\n success: boolean;\n message: string;\n user?: any;\n}> {\n try {\n const authDbUrl = await getAzureVaultSecretByKey(\n context,\n process.env.AZURE_KEY_VAULT_NAME || \"\",\n AzureSecretKeysEnum.DB_CONNECTING_STRING_USER\n );\n\n const userService = new UserService(context, authDbUrl);\n\n let user = null;\n context.log(\"Getting user by realm:\", realm);\n try {\n // user = await userService.getUserByBusinessId(realm, email);\n user = '';\n } catch (err: any) {\n context.error(`Failed to get user by realm:`, err);\n return { success: false, message: \"User not found..\" };\n }\n context.log(\"User:\", JSON.stringify(user));\n\n if (!user) return { success: false, message: \"User not found...\" };\n\n await userService.disconnect();\n\n return { success: true, message: \"User validation successful\", user };\n\n } catch (error) {\n context.error(\"User validation error:\", error);\n return { success: false, message: \"Error validating user information\" };\n }\n}\n\nasync function validateUserByEmail(\n email: string,\n context: InvocationContext\n): Promise<{\n success: boolean;\n message: string;\n user?: any;\n}> {\n try {\n const authDbUrl = await getAzureVaultSecretByKey(\n context,\n process.env.AZURE_KEY_VAULT_NAME || \"\",\n AzureSecretKeysEnum.DB_CONNECTING_STRING_USER\n );\n\n const userService = new UserService(context, authDbUrl);\n\n let user = null;\n context.log(\"Getting user by email:\", email);\n try {\n // user = await userService.getUserByEmail(email);\n user = '';\n } catch (err: any) {\n context.error(`Failed to get user by email:`, err);\n return { success: false, message: \"User not found..\" };\n }\n context.log(\"User:\", JSON.stringify(user));\n\n if (!user) return { success: false, message: \"User not found...\" };\n\n await userService.disconnect();\n\n return { success: true, message: \"User validation successful\", user };\n\n } catch (error) {\n context.error(\"User validation error:\", error);\n return { success: false, message: \"Error validating user information\" };\n }\n}\n\nasync function validateTokenIntrospection(\n keycloakService: KeycloakAdminService,\n token: string,\n realm: string,\n clientId: string,\n domain: string,\n context: InvocationContext\n): Promise<boolean> {\n try {\n if(!realm) return false;\n if(!clientId) return false;\n if(!token) return false;\n \n if (domain === \"accounts.culturefy.app\") {\n realm = \"superadmin\";\n clientId = \"cfy-superadmin-web\";\n } else {\n realm = realm;\n clientId = \"cfy-web\";\n }\n\n context.info(\"Validating token with Keycloak introspection\");\n const introspection = await keycloakService.introspectToken(realm, clientId, token);\n\n if (!introspection.active) {\n context.warn(\"Token introspection returned inactive token\");\n return false;\n }\n\n context.info(\"Token introspection successful - token is active\");\n return true;\n } catch (error: any) {\n context.error(\"Token introspection error:\", error);\n\n if (error.message?.includes('Client not allowed')) {\n context.warn(\"Admin-cli client does not have introspection permissions - this is expected\");\n return true;\n }\n\n if (error.message?.includes('Invalid token')) return false;\n\n if (error.message?.includes('Token is not active')) return false;\n\n return false;\n }\n}"],"mappings":"AAEA,SAASA,mBAAmB,QAAQ,UAAU;AAC9C,SAASC,WAAW,QAAQ,yBAAyB;AAErD,SAASC,oBAAoB,QAAQ,6BAA6B;AAClE,SAASC,wBAAwB,EAAEC,YAAY,EAAEC,kBAAkB,QAAQ,UAAU;AAyBrF,OAAO,eAAeC,eAAeA,CAACC,OAAoB,EAAEC,MAAc,EAAEC,OAA0B,EAAkC;EACpI,IAAI;IACA,IAAIC,OAAO,GAAGN,YAAY,CAACG,OAAO,EAAEE,OAAO,CAAC;IAC5C,IAAIE,WAAW,GAAGD,OAAO,CAAC,sBAAsB,CAAC;IACjD,IAAIE,YAAY,GAAGF,OAAO,CAAC,yBAAyB,CAAC;IAErD,IAAIG,SAAS,EAAEC,gBAAgB;IAE/B,IAAI,CAACH,WAAW,EAAE,OAAO;MAAEI,MAAM,EAAE,KAAK;MAAEC,OAAO,EAAE;IAA2B,CAAC;IAE/E,MAAMC,eAAe,GAAG,MAAMC,yBAAyB,CAACT,OAAO,CAAC;IAEhE,MAAMH,eAAe,GAAG,MAAMa,aAAa,CAACR,WAAW,EAAEF,OAAO,CAAC;IAEjE,IAAI,CAACH,eAAe,CAACc,OAAO,EAAE;MAC1B,IAAId,eAAe,CAACe,OAAO,EAAE;QACzB,MAAM;UAAEC,IAAI,EAAJA;QAAK,CAAC,GAAGhB,eAAe;QAChC,IAAI,CAACgB,KAAI,EAAE,OAAO;UAAEP,MAAM,EAAE,KAAK;UAAEC,OAAO,EAAE;QAAwB,CAAC;QAErE,IAAI;UAAEO,MAAM,EAANA,OAAM;UAAEC,QAAQ,EAARA,SAAQ;UAAEC,KAAK,EAALA,MAAK;UAAEC,KAAK,EAALA;QAAM,CAAC,GAAGJ,KAAI;QAE7C,IAAI,CAACE,SAAQ,EAAE,OAAO;UAAET,MAAM,EAAE,KAAK;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