Rename files

GitOrigin-RevId: 80b975b03ebca16328b84fabf11e71bbea87c8bc
This commit is contained in:
Andrew Rumble
2025-10-22 13:37:55 +01:00
committed by Copybot
parent 1a511b14a4
commit 0f4d5a7be6
134 changed files with 0 additions and 0 deletions
@@ -0,0 +1,47 @@
const { Project } = require('../../models/Project')
const { callbackify } = require('util')
const ProjectUpdateHandler = {
async markAsUpdated(projectId, lastUpdatedAt, lastUpdatedBy) {
if (!lastUpdatedAt) {
lastUpdatedAt = new Date()
}
const conditions = {
_id: projectId,
lastUpdated: { $lt: lastUpdatedAt },
}
const update = {
lastUpdated: lastUpdatedAt || new Date().getTime(),
lastUpdatedBy,
}
await Project.updateOne(conditions, update, {}).exec()
},
async markAsOpened(projectId) {
const conditions = { _id: projectId }
const update = { lastOpened: Date.now() }
await Project.updateOne(conditions, update, {}).exec()
},
async markAsInactive(projectId) {
const conditions = { _id: projectId }
const update = { active: false }
await Project.updateOne(conditions, update, {}).exec()
},
async markAsActive(projectId) {
const conditions = { _id: projectId }
const update = { active: true }
await Project.updateOne(conditions, update, {}).exec()
},
}
module.exports = {
markAsUpdated: callbackify(ProjectUpdateHandler.markAsUpdated),
markAsOpened: callbackify(ProjectUpdateHandler.markAsOpened),
markAsInactive: callbackify(ProjectUpdateHandler.markAsInactive),
markAsActive: callbackify(ProjectUpdateHandler.markAsActive),
promises: ProjectUpdateHandler,
}