Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Add estimatedHours field to tasks and implement task management API e…
…ndpoints

Co-authored-by: faburem <11456790+faburem@users.noreply.github.com>
  • Loading branch information
Copilot and faburem committed Aug 19, 2025
commit 00bde456196a619fcdabd4e1cb7efeadcbc9cd8d
10 changes: 8 additions & 2 deletions imports/api/tasks/server/methods.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Inserts a new project task into the Tasks collection.
@param {string} args.name - The name of the task.
@param {Date} args.start - The start date of the task.
@param {Date} args.end - The end date of the task.
@param {number} [args.estimatedHours] - The estimated/planned hours for the task.
@param {string[]} [args.dependencies] - An array of task IDs that this task depends on.
*/
const insertProjectTask = new ValidatedMethod({
Expand All @@ -20,19 +21,21 @@ const insertProjectTask = new ValidatedMethod({
name: String,
start: Date,
end: Date,
estimatedHours: Match.Optional(Number),
dependencies: Match.Optional([String]),
customfields: Match.Optional(Object),
})
},
mixins: [authenticationMixin, transactionLogMixin],
async run({
projectId, name, start, end, dependencies, customfields,
projectId, name, start, end, estimatedHours, dependencies, customfields,
}) {
await Tasks.insertAsync({
projectId,
name,
start,
end,
estimatedHours,
dependencies,
...customfields,
})
Expand All @@ -46,6 +49,7 @@ const insertProjectTask = new ValidatedMethod({
* @param {string} [args.name] - The name of the task.
* @param {Date} [args.start] - The start date of the task.
* @param {Date} [args.end] - The end date of the task.
* @param {number} [args.estimatedHours] - The estimated/planned hours for the task.
* @param {string[]} [args.dependencies] - An array of task IDs that this task depends on.
* @throws {Meteor.Error} If user is not authenticated.
* @returns {String} 'notifications.success' if successful
Expand All @@ -59,19 +63,21 @@ const updateTask = new ValidatedMethod({
name: Match.Optional(String),
start: Match.Optional(Date),
end: Match.Optional(Date),
estimatedHours: Match.Optional(Number),
dependencies: Match.Optional([String]),
customfields: Match.Optional(Object),
})
},
mixins: [authenticationMixin, transactionLogMixin],
async run({
taskId, name, start, end, dependencies, customfields,
taskId, name, start, end, estimatedHours, dependencies, customfields,
}) {
await Tasks.updateAsync(taskId, {
$set: {
name,
start,
end,
estimatedHours,
dependencies,
...customfields,
},
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading