Updates for async and await - still

This commit is contained in:
Brian McGonagill 2025-07-22 13:50:49 -05:00
parent febb36d75f
commit 706c5dc3ef
18 changed files with 220 additions and 233 deletions

View file

@ -12,24 +12,24 @@ UpdateInfo.allow({
});
Meteor.methods({
'add.updateInfo' (updateObject) {
async 'add.updateInfo' (updateObject) {
check(updateObject, Object);
return UpdateInfo.insertAsync({
return await UpdateInfo.insertAsync({
title: updateObject.title,
description: updateObject.description,
dateRelease: updateObject.date,
releaseLink: updateObject.link
});
},
'markUpdate.read' (updateId) {
async 'markUpdate.read' (updateId) {
check(updateId, String);
if (!this.userId) {
throw new Meteor.Error('You are not allowed to mark updates as read. Make sure you are logged in with valid user credentials.');
}
return UpdateInfo.updateAsync({ _id: updateId }, {
return await UpdateInfo.updateAsync({ _id: updateId }, {
$set: {
viewed: true
}