WIP(assignment): change to object style

to do--let assignment API accept an array
This commit is contained in:
SabreCat
2021-11-30 16:32:01 -06:00
parent fa99458ca4
commit a495db8480
5 changed files with 39 additions and 28 deletions

View File

@@ -128,20 +128,16 @@ export const TaskSchema = new Schema({
group: {
id: { $type: String, ref: 'Group', validate: [v => validator.isUUID(v), 'Invalid uuid for group task.'] },
broken: { $type: String, enum: ['GROUP_DELETED', 'TASK_DELETED', 'UNSUBSCRIBED'] },
assignedUsers: [{ $type: String, ref: 'User', validate: [v => validator.isUUID(v), 'Invalid uuid for group assigned user.'] }],
assignedDate: { $type: Date },
assigningUsername: { $type: String },
taskId: { $type: String, ref: 'Task', validate: [v => validator.isUUID(v), 'Invalid uuid for group task.'] },
approval: {
required: { $type: Boolean, default: false },
approved: { $type: Boolean, default: false },
dateApproved: { $type: Date },
approvingUser: { $type: String, ref: 'User', validate: [v => validator.isUUID(v), 'Invalid uuid for group approving user.'] },
requested: { $type: Boolean, default: false },
requestedDate: { $type: Date },
assignedUsers: {
$type: Schema.Types.Mixed,
// key is assigned UUID, with
// { assignedDate: Date,
// assigningUsername: '@username',
// completed: Boolean }
},
taskId: { $type: String, ref: 'Task', validate: [v => validator.isUUID(v), 'Invalid uuid for group task.'] },
sharedCompletion: {
$type: String, // legacy data
$type: String, default: 'singleCompletion', // legacy data
},
managerNotes: { $type: String },
completedBy: { $type: String, ref: 'User', validate: [v => validator.isUUID(v), 'Invalid uuid for group completing user.'] },