mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-05-23 22:27:06 +00:00
Added fields for more approver details
This commit is contained in:
parent
f2e5bc52e5
commit
2173f53883
3 changed files with 5 additions and 1 deletions
|
|
@ -59,5 +59,7 @@ describe('POST /tasks/:id/approve/:userId', () => {
|
|||
let syncedTask = find(memberTasks, findAssignedTask);
|
||||
|
||||
expect(syncedTask.approved).to.be.true;
|
||||
expect(syncedTask.approvingUser).to.equal(user._id);
|
||||
expect(syncedTask.approvedDate).to.be.a('string'); // date gets converted to a string as json doesn't have a Date type
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -219,6 +219,8 @@ api.approveTask = {
|
|||
|
||||
if (group.leader !== user._id) throw new NotAuthorized(res.t('onlyGroupLeaderCanEditTasks'));
|
||||
|
||||
task.approvedDate = new Date();
|
||||
task.approvingUser = user._id;
|
||||
task.approved = true;
|
||||
await task.save();
|
||||
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ export let TaskSchema = new Schema({
|
|||
requiresApproval: {type: Boolean, default: false},
|
||||
approved: {type: Boolean, default: false},
|
||||
approvedDate: {type: Date},
|
||||
approvingUser: [{type: String, ref: 'User', validate: [validator.isUUID, 'Invalid uuid.']}],
|
||||
approvingUser: {type: String, ref: 'User', validate: [validator.isUUID, 'Invalid uuid.']},
|
||||
approvalRequested: {type: Boolean, default: false},
|
||||
approvalRequestedDate: {type: Date},
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue