nice checking if exists or not
This commit is contained in:
@@ -74,7 +74,9 @@ const getOneOnOneConversationIfExists = async (req: Request, res: Response, next
|
|||||||
new NirvanaResponse(
|
new NirvanaResponse(
|
||||||
resultConversation?._id ?? undefined,
|
resultConversation?._id ?? undefined,
|
||||||
undefined,
|
undefined,
|
||||||
'here is the conversation if it exists',
|
resultConversation
|
||||||
|
? 'no such conversation exists!'
|
||||||
|
: 'there is a conversation...quick dial them now!',
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -93,6 +95,18 @@ const createConversation = async (req: Request, res: Response, next: NextFunctio
|
|||||||
return next(new Error('must provide who you want to talk to'));
|
return next(new Error('must provide who you want to talk to'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if it's a one on one, and one already exists then don't allow creating another convo!!
|
||||||
|
if (createRequest.otherUsers.length === 1) {
|
||||||
|
const oneOnOneExists = await ConversationService.getConversationBetweenTwoPeople(
|
||||||
|
new ObjectId(userInfo.userId),
|
||||||
|
new ObjectId(createRequest.otherUsers[0]._id),
|
||||||
|
);
|
||||||
|
|
||||||
|
if (oneOnOneExists) {
|
||||||
|
return next(Error('Already have a conversatoin with them! quick dial them!'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// process of creating other conversation user members with their user objects
|
// process of creating other conversation user members with their user objects
|
||||||
// for cached data purposes
|
// for cached data purposes
|
||||||
const conversationUserMembers: ConversationUserMember[] = [];
|
const conversationUserMembers: ConversationUserMember[] = [];
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ export default function Login() {
|
|||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
gap: 5,
|
gap: 5,
|
||||||
background: blueGrey[50],
|
background: blueGrey[50],
|
||||||
|
WebkitAppRegion: 'drag',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<NirvanaLogo />
|
<NirvanaLogo />
|
||||||
|
|||||||
Reference in New Issue
Block a user