feat: restructure into XFlow monorepo with Nuxt 4, Modular Onion Monolith, Android client, and Desktop CLI
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
export interface ListItemProps {
|
||||
id: string;
|
||||
listId: string;
|
||||
title: string;
|
||||
description?: string;
|
||||
isCompleted: boolean;
|
||||
status: string; // 'todo' | 'in_progress' | 'completed' | 'watching' | 'watched'
|
||||
priority: string; // 'low' | 'normal' | 'high'
|
||||
metadata?: Record<string, any>;
|
||||
dueDate?: Date | null;
|
||||
createdAt: Date;
|
||||
updatedAt: Date;
|
||||
}
|
||||
|
||||
export class ListItem {
|
||||
constructor(private readonly props: ListItemProps) {}
|
||||
|
||||
public get id(): string { return this.props.id; }
|
||||
public get listId(): string { return this.props.listId; }
|
||||
public get title(): string { return this.props.title; }
|
||||
public get description(): string { return this.props.description || ''; }
|
||||
public get isCompleted(): boolean { return this.props.isCompleted; }
|
||||
public get status(): string { return this.props.status; }
|
||||
public get priority(): string { return this.props.priority; }
|
||||
public get metadata(): Record<string, any> | undefined { return this.props.metadata; }
|
||||
public get dueDate(): Date | null | undefined { return this.props.dueDate; }
|
||||
public get createdAt(): Date { return this.props.createdAt; }
|
||||
public get updatedAt(): Date { return this.props.updatedAt; }
|
||||
|
||||
public toggleCompleted(): void {
|
||||
this.props.isCompleted = !this.props.isCompleted;
|
||||
this.props.status = this.props.isCompleted ? 'completed' : 'todo';
|
||||
this.props.updatedAt = new Date();
|
||||
}
|
||||
|
||||
public updateStatus(status: string): void {
|
||||
this.props.status = status;
|
||||
this.props.isCompleted = (status === 'completed' || status === 'watched');
|
||||
this.props.updatedAt = new Date();
|
||||
}
|
||||
|
||||
public toJSON(): ListItemProps {
|
||||
return { ...this.props };
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user