-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #58 from iam-abin/dev
Dev
- Loading branch information
Showing
25 changed files
with
803 additions
and
750 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
import { DatabaseConnectionError } from "@abijobportal/common"; | ||
import mongoose from "mongoose"; | ||
|
||
const connectDB = async (): Promise<void> => { | ||
try { | ||
await mongoose.connect(process.env.MONGO_URL_AUTH as string); | ||
console.log("auth service connected to mongodb..."); | ||
} catch (error) { | ||
console.error("auth service mongodb connection failed!!!!",error); | ||
throw new DatabaseConnectionError() | ||
} | ||
const connectDB = async (): Promise<void> => { | ||
try { | ||
await mongoose.connect(process.env.MONGO_URL_AUTH as string); | ||
console.log("auth service connected to mongodb..."); | ||
} catch (error) { | ||
console.error("auth service mongodb connection failed!!!!", error); | ||
throw new DatabaseConnectionError(); | ||
} | ||
}; | ||
|
||
export { connectDB } | ||
export { connectDB }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,7 +30,7 @@ export const sendVerificationEmail = async ( | |
secure: false, | ||
auth: { | ||
user: "[email protected]", | ||
pass: "frjn aczl fyet pxaj", | ||
pass: "dogu rtwq gxiv dton", | ||
}, | ||
connectionTimeout: 10000, | ||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
chat/src/frameworks/utils/kafka-events/consumers/candidate-profile-updated-consumer.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { Kafka, KafkaMessage } from "kafkajs"; | ||
import { KafkaConsumer, TOPICS, CANDIDATE_PROFILE_UPDATED_EVENT } from "@abijobportal/common"; | ||
import { handleMessage } from "../handleMessage"; | ||
|
||
export class CandidateProfileUpdatedEventConsumer extends KafkaConsumer<CANDIDATE_PROFILE_UPDATED_EVENT>{ | ||
topic: TOPICS.CANDIDATE_PROFILE_UPDATED_TOPIC = TOPICS.CANDIDATE_PROFILE_UPDATED_TOPIC; | ||
|
||
groupId: string = "chat-3"; | ||
|
||
constructor(client: Kafka){ | ||
super(client); | ||
} | ||
|
||
async onMessage(data: CANDIDATE_PROFILE_UPDATED_EVENT['data'], topic: string, message: KafkaMessage): Promise<void> { | ||
|
||
// dont need to check userType as every users are stored in one collection | ||
handleMessage(data, topic, message ) | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,30 @@ | ||
import userRepository from "../../repositories/mongo/user.repository"; | ||
|
||
|
||
export const handleMessage = (data: any, topic: string, message: any) => { | ||
switch (topic) { | ||
case "USER-CREATED-TOPIC": | ||
userRepository.createUser(data); | ||
break; | ||
switch (topic) { | ||
case "USER-CREATED-TOPIC": | ||
userRepository.createUser(data); | ||
break; | ||
|
||
case "USER-UPDATED-TOPIC": | ||
userRepository.updateUser(data.userId, data); | ||
console.log(data); | ||
|
||
break; | ||
|
||
case "CANDIDATE-PROFILE-UPDATED-TOPIC": | ||
console.log(data); | ||
const userData = { | ||
name: data.name, | ||
profile_image: data.profile_image, | ||
isActive: data.isActive, | ||
}; | ||
console.log(userData); | ||
userRepository.updateUser(data.userId, userData); | ||
|
||
case "USER-UPDATED-TOPIC": | ||
userRepository.updateUser(data.userId, data); | ||
break; | ||
break; | ||
|
||
default: | ||
break; | ||
} | ||
default: | ||
break; | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.