Files
homepage/src/models/TaskCompletion.ts
Alexander Bocken 9027dd9881
Some checks failed
CI / update (push) Has been cancelled
tasks: shared task board with sticker rewards, difficulty levels, and calendar
Complete household task management system behind task_users auth group:
- Task CRUD with recurring schedules, assignees, tags, and optional difficulty
- Blobcat SVG sticker rewards on completion, rarity weighted by difficulty
- Sticker collection page with calendar view and progress tracking
- Redesigned cards with left accent urgency strip, assignee PFP, round check button
- Weekday-based due date labels for tasks within 7 days
- Tasks link added to homepage LinksGrid
2026-04-02 07:32:55 +02:00

52 lines
1.0 KiB
TypeScript

import mongoose from 'mongoose';
export interface ITaskCompletion {
_id?: string;
taskId: mongoose.Types.ObjectId;
taskTitle: string;
completedBy: string;
completedAt: Date;
stickerId?: string;
tags: string[];
}
const TaskCompletionSchema = new mongoose.Schema(
{
taskId: {
type: mongoose.Schema.Types.ObjectId,
ref: 'Task',
required: true
},
taskTitle: {
type: String,
required: true,
trim: true
},
completedBy: {
type: String,
required: true,
trim: true
},
completedAt: {
type: Date,
required: true,
default: Date.now
},
stickerId: {
type: String,
trim: true
},
tags: [{
type: String,
trim: true,
lowercase: true
}]
}
);
TaskCompletionSchema.index({ completedBy: 1 });
TaskCompletionSchema.index({ taskId: 1 });
TaskCompletionSchema.index({ completedAt: -1 });
export const TaskCompletion = mongoose.model<ITaskCompletion>('TaskCompletion', TaskCompletionSchema);