The Collection name will be Status. All the documents in the collection will have the following data model.
{
"userId": "String",
"ooo": {
"status": "Boolean",
"createdAt": "TimeStamp",
"from": "TimeStamp",
"till": "TimeStamp",
"reason": "String"
},
"monthlyHoursCommitment": {
"noOfHours": "Integer",
"createdAt": "TimeStamp"
}
}
̶T̶h̶e̶ ̶̶o̶o̶o̶̶ ̶a̶n̶d̶ ̶̶m̶o̶n̶t̶h̶l̶y̶H̶o̶u̶r̶s̶C̶o̶m̶m̶i̶t̶m̶e̶n̶t̶̶ ̶w̶i̶l̶l̶ ̶b̶e̶ ̶a̶n̶ ̶a̶r̶r̶a̶y̶ ̶a̶n̶d̶ ̶w̶h̶e̶n̶e̶v̶e̶r̶ ̶a̶ ̶U̶s̶e̶r̶ ̶u̶p̶d̶a̶t̶e̶s̶ ̶t̶h̶e̶i̶r̶ ̶s̶t̶a̶t̶u̶s̶ ̶w̶e̶ ̶w̶i̶l̶l̶ ̶p̶u̶s̶h̶ ̶t̶h̶e̶ ̶n̶e̶w̶ ̶o̶b̶j̶e̶c̶t̶ ̶i̶n̶ ̶t̶h̶e̶ ̶a̶r̶r̶a̶y̶.̶ ̶S̶t̶o̶r̶i̶n̶g̶ ̶l̶i̶k̶e̶ ̶t̶h̶i̶s̶ ̶w̶i̶l̶l̶ ̶h̶e̶l̶p̶ ̶u̶s̶ ̶i̶n̶ ̶t̶r̶a̶c̶k̶i̶n̶g̶ ̶h̶i̶s̶t̶o̶r̶y̶.̶ ̶
Note: If the User changes their status from OOO true to OOO false then the object will just have status and createdAt. The other fields Since,Till,Reason will be empty.
The final data model which we agreed for is as below
{
"userId": "String",
"currentStatus": {
"state": "OOO | IDLE | ACTIVE",
"updatedAt": "TimeStamp",
"from": "TimeStamp ",
"until": "TimeStamp",
"message": "String"
},
"monthlyHours": {
"committed": "Integer",
"updatedAt": "TimeStamp"
}
}
The Collection name will be
Status. All the documents in the collection will have the following data model.̶T̶h̶e̶ ̶
̶o̶o̶o̶̶ ̶a̶n̶d̶ ̶̶m̶o̶n̶t̶h̶l̶y̶H̶o̶u̶r̶s̶C̶o̶m̶m̶i̶t̶m̶e̶n̶t̶̶ ̶w̶i̶l̶l̶ ̶b̶e̶ ̶a̶n̶ ̶a̶r̶r̶a̶y̶ ̶a̶n̶d̶ ̶w̶h̶e̶n̶e̶v̶e̶r̶ ̶a̶ ̶U̶s̶e̶r̶ ̶u̶p̶d̶a̶t̶e̶s̶ ̶t̶h̶e̶i̶r̶ ̶s̶t̶a̶t̶u̶s̶ ̶w̶e̶ ̶w̶i̶l̶l̶ ̶p̶u̶s̶h̶ ̶t̶h̶e̶ ̶n̶e̶w̶ ̶o̶b̶j̶e̶c̶t̶ ̶i̶n̶ ̶t̶h̶e̶ ̶a̶r̶r̶a̶y̶.̶ ̶S̶t̶o̶r̶i̶n̶g̶ ̶l̶i̶k̶e̶ ̶t̶h̶i̶s̶ ̶w̶i̶l̶l̶ ̶h̶e̶l̶p̶ ̶u̶s̶ ̶i̶n̶ ̶t̶r̶a̶c̶k̶i̶n̶g̶ ̶h̶i̶s̶t̶o̶r̶y̶.̶ ̶Note: If the User changes their status from OOO true to OOO false then the object will just have
statusandcreatedAt. The other fieldsSince,Till,Reasonwill be empty.The final data model which we agreed for is as below