accepting request working
This commit is contained in:
@@ -93,7 +93,7 @@ async function updateRelationshipState(req: Request, res: Response) {
|
||||
requestObj.newState
|
||||
);
|
||||
|
||||
updateResult?.acknowledged
|
||||
updateResult?.modifiedCount
|
||||
? res.status(200).send("Updated state of relationship")
|
||||
: res.status(500).send("Failed to update relationship");
|
||||
|
||||
|
||||
@@ -20,8 +20,8 @@ export class ContactService {
|
||||
// i could also be the receiver and them the sender
|
||||
const clauseTwo = {
|
||||
$and: [
|
||||
{ senderUserId: myGoogleUserId },
|
||||
{ receiverUserId: otherGoogleUserId },
|
||||
{ senderUserId: otherGoogleUserId },
|
||||
{ receiverUserId: myGoogleUserId },
|
||||
],
|
||||
};
|
||||
|
||||
@@ -58,8 +58,12 @@ export class ContactService {
|
||||
relationshipId: ObjectId,
|
||||
newState: RelationshipState
|
||||
) {
|
||||
const query = { _id: relationshipId };
|
||||
const updateDoc = { $set: { state: newState } };
|
||||
const query = { _id: new ObjectId(relationshipId) };
|
||||
console.log(newState);
|
||||
console.log(relationshipId);
|
||||
const updateDoc = {
|
||||
$set: { state: newState, lastUpdatedDate: new Date() },
|
||||
};
|
||||
const result = await collections.relationships?.updateOne(query, updateDoc);
|
||||
|
||||
return result;
|
||||
|
||||
Reference in New Issue
Block a user