Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Latest Simpletasks in 2.x.x version (Codemod) #15

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 20 additions & 20 deletions .meteor/packages
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,30 @@
# 'meteor add' and 'meteor remove' will edit this file for you,
# but you can also edit it by hand.

meteor-base@1.5.2 # Packages every Meteor app needs to have
mobile-experience@1.1.2 # Packages for a great mobile UX
mongo@2.0.2 # The database Meteor supports right now
reactive-var@1.0.13 # Reactive variable for tracker
meteor-base@1.5.1 # Packages every Meteor app needs to have
mobile-experience@1.1.1 # Packages for a great mobile UX
mongo@1.16.10 # The database Meteor supports right now
reactive-var@1.0.11 # Reactive variable for tracker

standard-minifier-css@1.9.3 # CSS minifier run for production mode
es5-shim@4.8.1 # ECMAScript 5 compatibility for older browsers
ecmascript@0.16.9 # Enable ECMAScript2015+ syntax in app code
typescript@5.4.3 # Enable TypeScript syntax in .ts and .tsx modules
shell-server@0.6.0 # Server-side component of the `meteor shell` command
hot-module-replacement@0.5.4 # Update client in development without reloading the page
standard-minifier-css@1.9.2 # CSS minifier run for production mode
es5-shim@4.8.0 # ECMAScript 5 compatibility for older browsers
ecmascript@0.16.8 # Enable ECMAScript2015+ syntax in app code
typescript@4.9.5 # Enable TypeScript syntax in .ts and .tsx modules
shell-server@0.5.0 # Server-side component of the `meteor shell` command
hot-module-replacement@0.5.3 # Update client in development without reloading the page

static-html@1.3.3 # Define static page content in .html files
dev-error-overlay@0.1.3
static-html@1.3.2 # Define static page content in .html files
dev-error-overlay@0.1.2

accounts-password@3.0.2
force-ssl@1.1.1
meteortesting:mocha@3.2.0
accounts-password@2.4.0
force-ssl@1.1.0
meteortesting:mocha
jam:easy-schema@1.4.0
quave:migrations
react-meteor-accounts@1.0.3
react-meteor-data@3.0.0
react-meteor-accounts@1.0.0
react-meteor-data@2.7.2
montiapm:agent
zodern:standard-minifier-js
accounts-github@1.5.1
service-configuration@1.3.5
ddp-rate-limiter@1.2.2
accounts-github@1.5.0
service-configuration@1.3.4
ddp-rate-limiter@1.2.1
2 changes: 1 addition & 1 deletion .meteor/release
Original file line number Diff line number Diff line change
@@ -1 +1 @@
METEOR@3.0.3
METEOR@2.16
183 changes: 91 additions & 92 deletions .meteor/versions
Original file line number Diff line number Diff line change
@@ -1,100 +1,99 @@
accounts-base@3.0.2
accounts-github@1.5.1
accounts-oauth@1.4.5
accounts-password@3.0.2
allow-deny@2.0.0
autoupdate@2.0.0
babel-compiler@7.11.0
babel-runtime@1.5.2
base64@1.0.13
binary-heap@1.0.12
blaze-tools@2.0.0
boilerplate-generator@2.0.0
caching-compiler@2.0.0
caching-html-compiler@2.0.0
callback-hook@1.6.0
check@1.4.2
core-runtime@1.0.0
ddp@1.4.2
ddp-client@3.0.1
ddp-common@1.4.4
ddp-rate-limiter@1.2.2
ddp-server@3.0.1
dev-error-overlay@0.1.3
diff-sequence@1.1.3
dynamic-import@0.7.4
ecmascript@0.16.9
ecmascript-runtime@0.8.2
ecmascript-runtime-client@0.12.2
ecmascript-runtime-server@0.11.1
ejson@1.1.4
email@3.1.0
es5-shim@4.8.1
facts-base@1.0.2
fetch@0.1.5
force-ssl@1.1.1
force-ssl-common@1.1.1
geojson-utils@1.0.12
github-oauth@1.4.2
hot-code-push@1.0.5
hot-module-replacement@0.5.4
html-tools@2.0.0
htmljs@2.0.1
id-map@1.2.0
inter-process-messaging@0.1.2
accounts-base@2.2.11
accounts-github@1.5.0
accounts-oauth@1.4.4
accounts-password@2.4.0
allow-deny@1.1.1
autoupdate@1.8.0
babel-compiler@7.10.5
babel-runtime@1.5.1
base64@1.0.12
binary-heap@1.0.11
blaze-tools@1.1.3
boilerplate-generator@1.7.2
caching-compiler@1.2.2
caching-html-compiler@1.2.1
callback-hook@1.5.1
check@1.4.1
ddp@1.4.1
ddp-client@2.6.2
ddp-common@1.4.1
ddp-rate-limiter@1.2.1
ddp-server@2.7.1
dev-error-overlay@0.1.2
diff-sequence@1.1.2
dynamic-import@0.7.3
ecmascript@0.16.8
ecmascript-runtime@0.8.1
ecmascript-runtime-client@0.12.1
ecmascript-runtime-server@0.11.0
ejson@1.1.3
email@2.2.6
es5-shim@4.8.0
fetch@0.1.4
force-ssl@1.1.0
force-ssl-common@1.1.0
geojson-utils@1.0.11
github-oauth@1.4.1
hot-code-push@1.0.4
hot-module-replacement@0.5.3
html-tools@1.1.3
htmljs@1.1.1
http@1.0.10
id-map@1.1.1
inter-process-messaging@0.1.1
jam:easy-schema@1.4.0
launch-screen@2.0.1
localstorage@1.2.1
logging@1.3.5
launch-screen@2.0.0
localstorage@1.2.0
logging@1.3.4
mdg:validation-error@0.5.1
meteor@2.0.1
meteor-base@1.5.2
meteortesting:browser-tests@1.7.0
meteortesting:mocha@3.2.0
meteor@1.11.5
meteor-base@1.5.1
meteortesting:browser-tests@1.6.0
meteortesting:mocha@3.1.0-beta300.0
meteortesting:mocha-core@8.3.1-rc300.1
minifier-css@2.0.0
minimongo@2.0.1
mobile-experience@1.1.2
mobile-status-bar@1.1.1
modern-browsers@0.1.11
modules@0.20.1
modules-runtime@0.13.2
modules-runtime-hot@0.14.3
mongo@2.0.2
mongo-decimal@0.1.4-beta300.7
mongo-dev-server@1.1.1
mongo-id@1.0.9
montiapm:agent@3.0.0-beta.5
montiapm:meteorx@2.3.1
npm-mongo@4.17.4
oauth@3.0.0
oauth2@1.3.3
ordered-dict@1.2.0
promise@1.0.0
minifier-css@1.6.4
minimongo@1.9.4
mobile-experience@1.1.1
mobile-status-bar@1.1.0
modern-browsers@0.1.10
modules@0.20.0
modules-runtime@0.13.1
modules-runtime-hot@0.14.2
mongo@1.16.10
mongo-decimal@0.1.3
mongo-dev-server@1.1.0
mongo-id@1.0.8
montiapm:agent@2.49.4
montiapm:meteorx@2.2.0
npm-mongo@4.17.2
oauth@2.2.1
oauth2@1.3.2
ordered-dict@1.1.0
promise@0.12.2
quave:migrations@2.0.2
random@1.2.2
rate-limit@1.1.2
react-fast-refresh@0.2.9
random@1.2.1
rate-limit@1.1.1
react-fast-refresh@0.2.8
react-meteor-accounts@1.0.3
react-meteor-data@3.0.2
reactive-var@1.0.13
reload@1.3.2
retry@1.1.1
routepolicy@1.1.2
service-configuration@1.3.5
sha@1.0.10
shell-server@0.6.0
socket-stream-client@0.5.3
spacebars-compiler@2.0.0
standard-minifier-css@1.9.3
static-html@1.3.3
templating-tools@2.0.0
tracker@1.3.4
typescript@5.4.3
underscore@1.6.4
url@1.3.3
webapp@2.0.1
webapp-hashing@1.1.2
react-meteor-data@2.7.2
reactive-var@1.0.12
reload@1.3.1
retry@1.1.0
routepolicy@1.1.1
service-configuration@1.3.4
sha@1.0.9
shell-server@0.5.0
socket-stream-client@0.5.2
spacebars-compiler@1.3.1
standard-minifier-css@1.9.2
static-html@1.3.2
templating-tools@1.2.2
tracker@1.3.3
typescript@4.9.5
underscore@1.6.2
url@1.3.2
webapp@1.13.8
webapp-hashing@1.1.1
zodern:caching-minifier@0.5.0
zodern:meteor-package-versions@0.2.2
zodern:standard-minifier-js@5.3.1
Expand Down
18 changes: 9 additions & 9 deletions api/db/migrations.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { Tasks } from '../tasks/tasks';
Migrations.add({
version: 1,
name: 'Add a seed username and password.',
async up() {
await Accounts.createUserAsync({
up() {
Accounts.createUser({
username: 'fredmaia',
password: 'abc123',
});
Expand All @@ -16,21 +16,21 @@ Migrations.add({
Migrations.add({
version: 2,
name: 'Add a few sample tasks.',
async up() {
const user = await Accounts.findUserByUsername('fredmaia');
await Tasks.insertAsync({
description: 'Install Node@20',
up() {
const user = Accounts.findUserByUsername('fredmaia');
Tasks.insert({
description: 'Install Node@14',
done: false,
userId: user._id,
createdAt: new Date(2024, 1, 1),
});
await Tasks.insertAsync({
description: 'Install Meteor.js 3.0',
Tasks.insert({
description: 'Install Meteor.js 2.0',
done: false,
userId: user._id,
createdAt: new Date(2024, 1, 2),
});
await Tasks.insertAsync({
Tasks.insert({
description: 'Clone this repository',
done: false,
userId: user._id,
Expand Down
4 changes: 2 additions & 2 deletions api/lib/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ export function checkLoggedIn() {
* @param {{ taskId: String }}
* @throws Will throw an error if user is not logged in or is not the task owner.
*/
export async function checkTaskOwner({ taskId }) {
export function checkTaskOwner({ taskId }) {
check(taskId, String);
checkLoggedIn();
const task = await Tasks.findOneAsync({
const task = Tasks.findOne({
_id: taskId,
userId: Meteor.userId(),
});
Expand Down
24 changes: 12 additions & 12 deletions api/tasks/tasks.methods.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import { Tasks } from './tasks';
@function insertTask
@param {Object} taskData - The task data.
@param {string} taskData.description - The description of the task.
@returns {Promise<string>} - The ID of the inserted task.
@returns {string} - The ID of the inserted task.
*/
async function insertTask({ description }) {
function insertTask({ description }) {
check(description, String);
checkLoggedIn();
const task = {
Expand All @@ -21,7 +21,7 @@ async function insertTask({ description }) {
userId: Meteor.userId(),
createdAt: new Date(),
};
return Tasks.insertAsync(task);
return Tasks.insert(task);
}

/**
Expand All @@ -30,12 +30,12 @@ async function insertTask({ description }) {
@function removeTask
@param {Object} taskData - The task data.
@param {string} taskData.taskId - The ID of the task to remove.
@returns {Promise<number>}
@returns {number}
*/
async function removeTask({ taskId }) {
function removeTask({ taskId }) {
check(taskId, String);
await checkTaskOwner({ taskId });
return Tasks.removeAsync(taskId);
checkTaskOwner({ taskId });
return Tasks.remove(taskId);
}

/**
Expand All @@ -44,13 +44,13 @@ async function removeTask({ taskId }) {
@function toggleTaskDone
@param {Object} taskData - The task data.
@param {string} taskData.taskId - The ID of the task to toggle.
@returns {Promise<number>}
@returns {number}
*/
async function toggleTaskDone({ taskId }) {
function toggleTaskDone({ taskId }) {
check(taskId, String);
await checkTaskOwner({ taskId });
const task = await Tasks.findOneAsync(taskId);
return Tasks.updateAsync({ _id: taskId }, { $set: { done: !task.done } });
checkTaskOwner({ taskId });
const task = Tasks.findOne(taskId);
return Tasks.update({ _id: taskId }, { $set: { done: !task.done } });
}

Meteor.methods({ insertTask, removeTask, toggleTaskDone });
Loading