mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
5b7b9fc97b
Store lastUpdatedBy Value on Projects GitOrigin-RevId: bdb12c55732bc726151135b28a03e722bf3fdb39
37 lines
993 B
CoffeeScript
37 lines
993 B
CoffeeScript
Project = require('../../models/Project').Project
|
|
logger = require('logger-sharelatex')
|
|
|
|
module.exports =
|
|
markAsUpdated : (projectId, lastUpdatedAt, lastUpdatedBy, callback = () ->)->
|
|
lastUpdatedAt ?= new Date()
|
|
|
|
conditions =
|
|
_id: projectId
|
|
lastUpdated: { $lt: lastUpdatedAt }
|
|
|
|
update = {
|
|
lastUpdated: lastUpdatedAt or (new Date()).getTime()
|
|
lastUpdatedBy: lastUpdatedBy
|
|
}
|
|
Project.update conditions, update, {}, callback
|
|
|
|
markAsOpened : (project_id, callback)->
|
|
conditions = {_id:project_id}
|
|
update = {lastOpened:Date.now()}
|
|
Project.update conditions, update, {}, (err)->
|
|
if callback?
|
|
callback()
|
|
|
|
markAsInactive: (project_id, callback)->
|
|
conditions = {_id:project_id}
|
|
update = {active:false}
|
|
Project.update conditions, update, {}, (err)->
|
|
if callback?
|
|
callback()
|
|
|
|
markAsActive: (project_id, callback)->
|
|
conditions = {_id:project_id}
|
|
update = {active:true}
|
|
Project.update conditions, update, {}, (err)->
|
|
if callback?
|
|
callback()
|