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