36 lines
1.3 KiB
TypeScript
36 lines
1.3 KiB
TypeScript
import { Model } from '@nozbe/watermelondb';
|
|
import { field, date, children } from '@nozbe/watermelondb/decorators';
|
|
import { Associations } from '@nozbe/watermelondb/Model';
|
|
import { Priority, Repeat, Reminder } from '@/types';
|
|
|
|
export default class Task extends Model {
|
|
static table = 'tasks';
|
|
|
|
static associations: Associations = {
|
|
subtasks: { type: 'has_many', foreignKey: 'task_id' },
|
|
};
|
|
|
|
@field('title') title!: string;
|
|
@field('description') description!: string;
|
|
@field('category_id') categoryId!: string;
|
|
@field('tags') tags!: string;
|
|
@field('priority') priority!: Priority;
|
|
@field('completed') completed!: boolean;
|
|
@field('completed_at') completedAt!: number | null;
|
|
@field('due_date') dueDate!: number;
|
|
@field('due_time') dueTime!: string;
|
|
@field('end_time') endTime!: string;
|
|
@field('all_day') allDay!: boolean;
|
|
@field('repeat') repeat!: Repeat;
|
|
@field('repeat_interval') repeatInterval!: number;
|
|
@field('repeat_days') repeatDays!: string;
|
|
@field('series_id') seriesId!: string;
|
|
@field('reminder') reminder!: Reminder;
|
|
@field('reminders') reminders!: string;
|
|
@field('assignee_id') assigneeId!: string | null;
|
|
@field('order') order!: number;
|
|
@date('created_at') createdAt!: Date;
|
|
@date('updated_at') updatedAt!: Date;
|
|
|
|
@children('subtasks') subtasks!: any;
|
|
} |