Skip to content

Commit

Permalink
profileeditor: add created_at, srvModified too on save to simulate AP…
Browse files Browse the repository at this point in the history
…I v3
  • Loading branch information
MilosKozak committed Jan 20, 2023
1 parent 6b841fa commit a1607f0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9,771 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,6 @@ npm-debug.log
# directories created by docker-compose.yml
mongo-data/
letsencrypt/

# runtime data
package-lock.json
4 changes: 3 additions & 1 deletion lib/profile/profileeditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ var init = function init () {
profileSubmit();
}
GUIToObject();
mongorecords.push(_.omit(mongorecords[currentrecord], ['_id', 'srvModified', 'srvCreated', 'identifier']));
mongorecords.push(_.omit(mongorecords[currentrecord], ['_id', 'srvModified', 'srvCreated', 'identifier', 'mills']));
currentrecord = mongorecords.length - 1;
mongorecords[currentrecord].startDate = new Date().toISOString();
currentprofile = mongorecords[currentrecord].defaultProfile;
Expand Down Expand Up @@ -651,6 +651,8 @@ var init = function init () {
profileChange(event);
var record = mongorecords[currentrecord];
record.startDate = new Date(client.utils.mergeInputTime(timeInput.val(), dateInput.val())).toISOString( );
record.created_at = new Date().toISOString( );
record.srvModified = new Date().getTime(); // remove when switching to v3 API

var adjustedRecord = _.cloneDeep(record);

Expand Down

0 comments on commit a1607f0

Please sign in to comment.