Two month of work

This commit is contained in:
2026-02-17 10:35:03 +01:00
parent 0ffbeeedff
commit d9fd3d1ccb
158 changed files with 5637 additions and 1512 deletions
+144 -36
View File
@@ -39,8 +39,8 @@ export interface User {
email: string;
avatar?: string;
email_verified_at: string | null;
created_at: string;
updated_at: string;
createdAt: string;
updatedAt: string;
}
@@ -104,30 +104,28 @@ export function newContact(): Contact {
}
}
export interface Notable {
id: number;
notes?: Note[];
}
export interface Note<T extends Notable = Notable> {
export interface Note {
id: number;
user: User;
text: string;
notable_id: number;
notable_type: string;
notable?: T;
createdAt: Date;
notableId: number;
notableType: NoteableType;
createdAt: string;
updatedAt: string;
}
export function newNote<T extends Notable>(user: User, notable: T): Note<T> {
export type NoteableType = 'PipelineItem' | 'Customer'
export function newNote(user: User, text: string, notableId: number, noteableType: NoteableType): Note {
return {
id: 0,
user: user,
text: '',
notable_id: notable.id,
notable_type: notable.constructor.name,
notable: notable
};
text: text,
notableId: notableId,
notableType: noteableType,
createdAt: new Date().toISOString(),
updatedAt: new Date().toISOString()
}
}
export interface Customer {
@@ -185,12 +183,12 @@ export interface Todo {
typeId: number | null;
type?: TodoType | null;
url: string | null;
dueDate: Date | null;
dueDate: string | null;
recurring: boolean;
priority: number;
status: string;
createdAt: Date;
lastModified: Date;
createdAt: string;
lastModified: string;
parent: string | null;
parentTodo?: Todo | null;
children?: Todo[];
@@ -210,8 +208,8 @@ export function newTodo(): Todo {
recurring: false,
priority: 1,
status: 'pending',
createdAt: new Date(),
lastModified: new Date(),
createdAt: new Date().toISOString(),
lastModified: new Date().toISOString(),
parent: null,
parentTodo: null,
children: [],
@@ -251,7 +249,7 @@ export interface Invoice {
export type InvoiceType = Invoice
export function newInvoice(): Invoice {
const date = new Date();
const date = new Date().toISOString();
return {
id: 0,
@@ -340,16 +338,16 @@ export function newPaymentTerms(): PaymentTerms {
export interface ProductCategory {
id: number;
name: string;
createdAt: Date;
updatedAt: Date;
createdAt: string;
updatedAt: string;
}
export function newProductCategory(): ProductCategory {
return {
id: 0,
name: '',
createdAt: new Date(),
updatedAt: new Date()
createdAt: new Date().toISOString(),
updatedAt: new Date().toISOString()
}
}
@@ -357,8 +355,8 @@ export interface Unit {
id: number;
name: string;
symbol: string | null;
createdAt: Date;
updatedAt: Date;
createdAt: string;
updatedAt: string;
}
export function newUnit(): Unit {
@@ -366,8 +364,8 @@ export function newUnit(): Unit {
id: 2,
name: 'Stunden',
symbol: 'h',
createdAt: new Date(),
updatedAt: new Date()
createdAt: new Date().toISOString(),
updatedAt: new Date().toISOString()
}
}
@@ -384,8 +382,8 @@ export interface Product {
unitId: number | null;
unit: Unit | null;
image: string | null;
createdAt: Date;
updatedAt: Date;
createdAt: string;
updatedAt: string;
}
export function newProduct(): Product {
@@ -402,7 +400,117 @@ export function newProduct(): Product {
unitId: null,
unit: null,
image: null,
createdAt: new Date(),
updatedAt: new Date()
createdAt: new Date().toISOString(),
updatedAt: new Date().toISOString()
}
}
// Pipeline item used by CRM pipeline
export interface PipelineItem {
id: number;
pipelineLaneId: number;
title: string;
position: number;
expectedRevenue: number | null;
dueDate: string | null;
description: string | null;
notes?: Note<PipelineItem>[];
createdAt?: string;
updatedAt?: string;
}
export function newPipelineItem(): PipelineItem {
return {
id: 0,
title: 'Neue Spalte',
position: 0,
expectedRevenue: null,
dueDate: null,
description: null,
notes: [],
createdAt: new Date().toISOString(),
updatedAt: new Date().toISOString(),
}
}
// Pipeline lane used by CRM pipeline
export interface PipelineLane {
id: number;
title: string;
position: number;
createdAt?: string;
updatedAt?: string;
items?: PipelineItem[];
}
export function newPipelineLane(): PipelineLane {
return {
id: 0,
title: '',
position: 0,
createdAt: new Date().toISOString(),
updatedAt: new Date().toISOString(),
items: [],
};
}
// Timesheet Types
export interface Timesheet {
id: number;
title: string;
createdAt: string;
updatedAt: string;
entries?: TimesheetEntry[];
totalHours?: number;
hoursBilled?: number;
earliestDate?: string | null;
latestDate?: string | null;
}
export type TimesheetType = Timesheet;
export function newTimesheet(): Timesheet {
return {
id: 0,
title: 'Neuer Stundenzettel',
createdAt: new Date().toISOString(),
updatedAt: new Date().toISOString(),
entries: [],
totalHours: 0,
hoursBilled: 0,
earliestDate: null,
latestDate: null
};
}
// TimesheetEntry Types
export interface TimesheetEntry {
id: number;
timesheetId: number;
date: string; // ISO format
userId: number;
description: string | null;
hours: number;
billed: boolean;
createdAt: string;
updatedAt: string;
timesheet?: Timesheet;
user?: User;
}
export type TimesheetEntryType = TimesheetEntry;
export function newTimesheetEntry(): TimesheetEntry {
return {
id: 0,
timesheetId: 0,
date: new Date().toISOString(),
userId: 0,
description: null,
hours: 0,
billed: false,
createdAt: new Date().toISOString(),
updatedAt: new Date().toISOString()
};
}