mirror of
https://github.com/janoodleFTW/timy-messenger.git
synced 2026-01-23 02:14:39 +00:00
21 lines
No EOL
558 B
JavaScript
21 lines
No EOL
558 B
JavaScript
const { db } = require('./admin');
|
|
|
|
/**
|
|
* Sets `updatedAt` for channel to last activity's timestamp.
|
|
*/
|
|
const updateLatestActivityForChannel = async (groupId, channelId, activityDate) => {
|
|
try {
|
|
await db
|
|
.collection("/groups/")
|
|
.doc(groupId)
|
|
.collection("/channels/")
|
|
.doc(channelId).update({
|
|
updatedAt: activityDate
|
|
})
|
|
|
|
} catch (error) {
|
|
console.error("Error updating channel timestamp: ", error);
|
|
}
|
|
}
|
|
|
|
module.exports = updateLatestActivityForChannel; |