feat: restructure into XFlow monorepo with Nuxt 4, Modular Onion Monolith, Android client, and Desktop CLI
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
import { NoteList } from './NoteList';
|
||||
import { ListItem } from './ListItem';
|
||||
|
||||
export interface IListRepository {
|
||||
findListById(id: string): Promise<NoteList | null>;
|
||||
findListByTitleAndOwner(title: string, ownerId: string): Promise<NoteList | null>;
|
||||
findListsByOwner(ownerId: string, category?: string): Promise<NoteList[]>;
|
||||
saveList(list: NoteList): Promise<void>;
|
||||
deleteList(id: string, ownerId: string): Promise<boolean>;
|
||||
|
||||
findItemById(id: string): Promise<ListItem | null>;
|
||||
saveItem(item: ListItem): Promise<void>;
|
||||
deleteItem(id: string): Promise<boolean>;
|
||||
}
|
||||
@@ -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 };
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
import { ListItem } from './ListItem';
|
||||
|
||||
export interface NoteListProps {
|
||||
id: string;
|
||||
title: string;
|
||||
category: string; // 'movies', 'shopping', 'tasks', 'general'
|
||||
description?: string;
|
||||
color?: string | null;
|
||||
icon?: string | null;
|
||||
ownerId: string;
|
||||
createdAt: Date;
|
||||
updatedAt: Date;
|
||||
items?: ListItem[];
|
||||
}
|
||||
|
||||
export class NoteList {
|
||||
constructor(private readonly props: NoteListProps) {}
|
||||
|
||||
public get id(): string { return this.props.id; }
|
||||
public get title(): string { return this.props.title; }
|
||||
public get category(): string { return this.props.category; }
|
||||
public get description(): string { return this.props.description || ''; }
|
||||
public get color(): string | null | undefined { return this.props.color; }
|
||||
public get icon(): string | null | undefined { return this.props.icon; }
|
||||
public get ownerId(): string { return this.props.ownerId; }
|
||||
public get createdAt(): Date { return this.props.createdAt; }
|
||||
public get updatedAt(): Date { return this.props.updatedAt; }
|
||||
public get items(): ListItem[] { return this.props.items || []; }
|
||||
|
||||
public addItem(item: ListItem): void {
|
||||
if (!this.props.items) {
|
||||
this.props.items = [];
|
||||
}
|
||||
this.props.items.push(item);
|
||||
this.props.updatedAt = new Date();
|
||||
}
|
||||
|
||||
public toJSON(): NoteListProps {
|
||||
return {
|
||||
...this.props,
|
||||
items: this.props.items?.map(i => i.toJSON())
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user