Skip to content

Commit

Permalink
lasty updatedwd
Browse files Browse the repository at this point in the history
  • Loading branch information
Ianyourgod committed Mar 1, 2024
1 parent a7bbd05 commit 614fbc4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
13 changes: 11 additions & 2 deletions api/db/UserManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ class UserManager {
favoriteProjectID: -1,
cubes: 0,
firstLogin: Date.now(),
lastLogin: Date.now()
lastLogin: Date.now(),
lastUpload: 0
});
return token;
}
Expand Down Expand Up @@ -505,6 +506,7 @@ class UserManager {
remix: remix,
featured: false,
date: Date.now(),
lastUpdate: Date.now(),
views: [],
loves: [],
votes: [],
Expand All @@ -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);
});
Expand Down
2 changes: 2 additions & 0 deletions db schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -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\<string> | 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

Expand Down Expand Up @@ -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\<IP(string)> | An array of IPs that have seen the project. The IPs are encrypted. |
| loves | Array\<string> | An array of people that loved the project. The usernames are encrypted. |
| votes | Array\<string> | An array of people that voted for the project. The usernames are encrypted |
Expand Down

0 comments on commit 614fbc4

Please sign in to comment.