diff --git a/api/db/UserManager.js b/api/db/UserManager.js index 77a6e0c..c5bb14b 100644 --- a/api/db/UserManager.js +++ b/api/db/UserManager.js @@ -110,7 +110,8 @@ class UserManager { favoriteProjectID: -1, cubes: 0, firstLogin: Date.now(), - lastLogin: Date.now() + lastLogin: Date.now(), + lastUpload: 0 }); return token; } @@ -505,6 +506,7 @@ class UserManager { remix: remix, featured: false, date: Date.now(), + lastUpdate: Date.now(), views: [], loves: [], votes: [], @@ -520,7 +522,14 @@ class UserManager { } async updateProject(id, projectBuffer, title, image, instructions, notes, rating) { - await this.projects.updateOne({id: id}, {$set: {title: title, instructions: instructions, notes: notes, rating: rating}}); + await this.projects.updateOne({id: id}, + {$set: { + title: title, + instructions: instructions, + notes: notes, + rating: rating, + lastUpdate: Date.now() + }}); fs.writeFileSync(path.join(__dirname, `./projects/files/project_${id}.pmp`), projectBuffer, (err) => { if (err) console.log("Error saving project:", err); }); diff --git a/db schema.md b/db schema.md index 8582778..8aa3344 100644 --- a/db schema.md +++ b/db schema.md @@ -20,6 +20,7 @@ | firstLogin | number | The unix epoch of when the user first logged in. | | lastLogin | number | The unix epoch of when the user last logged in. | | followers | array\ | The IDs of the users that follow the user. | +| last upload | number | The unix time of when the user last uploaded a project. | ## User Messages @@ -59,6 +60,7 @@ | remix | number/undefined | Project ID it's a remix of, if it's not a remix then undefined. | | featured | boolean | True if the project is featured, false if not. | | date | number | Unix timestamp that the project was published | +| lastUpdate | number | Unix timestamp that the project was last updated | | views | Array\ | An array of IPs that have seen the project. The IPs are encrypted. | | loves | Array\ | An array of people that loved the project. The usernames are encrypted. | | votes | Array\ | An array of people that voted for the project. The usernames are encrypted |