Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ concurrency:

env:
NODE_VERSION: "20"
PNPM_VERSION: "9"

jobs:
ci:
Expand All @@ -33,9 +32,9 @@ jobs:
steps:
- uses: actions/checkout@v7

- uses: pnpm/action-setup@v3
with:
version: ${{ env.PNPM_VERSION }}
# pnpm version comes from "packageManager" in package.json (SSOT);
# pnpm/action-setup@v6 errors if both are specified.
- uses: pnpm/action-setup@v6

- uses: actions/setup-node@v7
with:
Expand Down
6 changes: 1 addition & 5 deletions apps/web/app/(dashboard)/documents/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,7 @@ export default async function DocumentsPage({ searchParams }: PageProps) {
const dateTo = params.dateTo;
const page = parseInt(params.page || "1", 10);
const sort = (params.sort || "issueDate") as
| "number"
| "issueDate"
| "dueDate"
| "total"
| "createdAt";
"number" | "issueDate" | "dueDate" | "total" | "createdAt";
const order = (params.order || "desc") as "asc" | "desc";

const result = await listDocuments(db, session.user.companyId, {
Expand Down
92 changes: 42 additions & 50 deletions apps/web/app/actions/bulk-import.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,20 +175,18 @@ export async function bulkImportAction(
const customersToImport = customersParsed.data
.slice(0, batchSize)
.filter((row: Record<string, string>) => row["Nummer"] && row["Firma / Kundenname"])
.map(
(row: Record<string, string>): Record<string, string | null> => ({
contactNumber: row["Nummer"],
name: row["Firma / Kundenname"],
email: row["E-Mail"] || null,
phone: row["Telefon"] || null,
type: "customer",
street: row["Straße"] || null,
city: row["Stadt"] || null,
postalCode: row["PLZ"] || null,
country: row["Land"] || DEFAULT_COUNTRY,
vatNumber: row["USt-IdNr."] || null,
}),
);
.map((row: Record<string, string>): Record<string, string | null> => ({
contactNumber: row["Nummer"],
name: row["Firma / Kundenname"],
email: row["E-Mail"] || null,
phone: row["Telefon"] || null,
type: "customer",
street: row["Straße"] || null,
city: row["Stadt"] || null,
postalCode: row["PLZ"] || null,
country: row["Land"] || DEFAULT_COUNTRY,
vatNumber: row["USt-IdNr."] || null,
}));

const customerResults = await bulkInsertContacts(db, companyId, customersToImport);
result.customersInserted = customerResults.inserted;
Expand All @@ -206,20 +204,18 @@ export async function bulkImportAction(
const vendorsToImport = vendorsParsed.data
.slice(0, batchSize)
.filter((row: Record<string, string>) => row["Nummer"] && row["Firma / Lieferantenname"])
.map(
(row: Record<string, string>): Record<string, string | null> => ({
contactNumber: row["Nummer"],
name: row["Firma / Lieferantenname"],
email: row["E-Mail"] || null,
phone: row["Telefon"] || null,
type: "vendor",
street: row["Straße"] || null,
city: row["Stadt"] || null,
postalCode: row["PLZ"] || null,
country: row["Land"] || DEFAULT_COUNTRY,
vatNumber: row["USt-IdNr."] || null,
}),
);
.map((row: Record<string, string>): Record<string, string | null> => ({
contactNumber: row["Nummer"],
name: row["Firma / Lieferantenname"],
email: row["E-Mail"] || null,
phone: row["Telefon"] || null,
type: "vendor",
street: row["Straße"] || null,
city: row["Stadt"] || null,
postalCode: row["PLZ"] || null,
country: row["Land"] || DEFAULT_COUNTRY,
vatNumber: row["USt-IdNr."] || null,
}));

const vendorResults = await bulkInsertContacts(db, companyId, vendorsToImport);
result.vendorsInserted = vendorResults.inserted;
Expand Down Expand Up @@ -310,19 +306,17 @@ export async function bulkImportAction(

const glRows = glParsed.data
.filter((row) => row["Buchungsdatum"] && (row["Soll"] || row["Haben"]))
.map(
(row): Record<string, string | null> => ({
date: row["Buchungsdatum"] || null,
reference: row["Buchungsnummer"] || null,
description: row["Beschreibung"] || null,
notes: row["Bemerkungen"] || null,
debitAmount: parseAmount(row["Soll"]),
debitAccount: row["Sollkonto"] || null,
creditAmount: parseAmount(row["Haben"]),
creditAccount: row["Habenkonto"] || null,
voucher: row["Beleg"] || null,
}),
);
.map((row): Record<string, string | null> => ({
date: row["Buchungsdatum"] || null,
reference: row["Buchungsnummer"] || null,
description: row["Beschreibung"] || null,
notes: row["Bemerkungen"] || null,
debitAmount: parseAmount(row["Soll"]),
debitAccount: row["Sollkonto"] || null,
creditAmount: parseAmount(row["Haben"]),
creditAccount: row["Habenkonto"] || null,
voucher: row["Beleg"] || null,
}));

const accountCodeMap = await buildAccountCodeMap(db, companyId);
const glResults = await bulkInsertJournalEntries(db, companyId, glRows, accountCodeMap);
Expand All @@ -346,15 +340,13 @@ export async function bulkImportAction(

const stockRows = stockParsed.data
.filter((row) => row["Artikelnummer"] && row["Menge"])
.map(
(row): Record<string, string | null> => ({
articleNumber: row["Artikelnummer"] || null,
quantity: parseAmount(row["Menge"]),
warehouse: row["Lager"] || null,
location: row["Lagerplatz"] || null,
productName: row["Artikelbeschreibung"] || null,
}),
);
.map((row): Record<string, string | null> => ({
articleNumber: row["Artikelnummer"] || null,
quantity: parseAmount(row["Menge"]),
warehouse: row["Lager"] || null,
location: row["Lagerplatz"] || null,
productName: row["Artikelbeschreibung"] || null,
}));

const { warehouses } = await import("@kivvi/database");
const [defaultWarehouse] = await db
Expand Down
3 changes: 1 addition & 2 deletions apps/web/app/api/chat/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,7 @@ export async function POST(request: NextRequest) {

// Determine provider and model — user selection > company settings > env fallback
const selectedProvider = (providerId || settings.aiProvider || process.env.AI_PROVIDER) as
| ProviderType
| undefined;
ProviderType | undefined;
const selectedModel = (modelId || settings.aiModel) as string | undefined;

// Build execution context
Expand Down
3 changes: 1 addition & 2 deletions apps/web/components/inventory/movement-form/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ interface Warehouse {
export type MovementFormProps = {
products: Product[];
} & (
| { warehouseId: string; warehouses?: never }
| { warehouseId?: never; warehouses: Warehouse[] }
{ warehouseId: string; warehouses?: never } | { warehouseId?: never; warehouses: Warehouse[] }
);

export function MovementForm(props: MovementFormProps) {
Expand Down
4 changes: 1 addition & 3 deletions apps/web/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,7 @@ export default auth((req) => {
if (mod) {
// Justified: next-auth middleware types don't include custom fields
const enabledModules = (req.auth as any)?.user?.enabledModules as
| string[]
| null
| undefined;
string[] | null | undefined;
if (!isModuleEnabled(enabledModules ?? undefined, mod)) {
return NextResponse.redirect(new URL("/dashboard", req.url));
}
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@
"format:check": "prettier --check ."
},
"devDependencies": {
"@types/node": "^20.11.0",
"@types/node": "^26.4.0",
"husky": "^9.1.7",
"lint-staged": "^16.3.3",
"prettier": "3.8.0",
"prettier": "3.9.6",
"tsx": "^4.21.0",
"turbo": "^2.0.0",
"typescript": "^5.3.3"
Expand Down
8 changes: 1 addition & 7 deletions packages/ai/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,7 @@ export interface ExecutionContext {
}

export type VerticalType =
| "general"
| "financial-advisory"
| "legal"
| "medical"
| "nonprofit"
| "retail"
| "manufacturing";
"general" | "financial-advisory" | "legal" | "medical" | "nonprofit" | "retail" | "manufacturing";

export type Permission =
| "invoice:read"
Expand Down
3 changes: 1 addition & 2 deletions packages/core/src/domain/dashboard-alerts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ export interface AlertLowStockProduct {
}

export type DashboardAlertMetadata =
| { breakdown: AlertDraftBreakdown[] }
| { products: AlertLowStockProduct[] };
{ breakdown: AlertDraftBreakdown[] } | { products: AlertLowStockProduct[] };

export interface DashboardAlert {
id: string;
Expand Down
6 changes: 1 addition & 5 deletions packages/core/src/domain/ricardo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,7 @@ export interface RicardoListingPayload {
}

export type RicardoCondition =
| "new"
| "used_like_new"
| "used_good"
| "used_acceptable"
| "for_parts";
"new" | "used_like_new" | "used_good" | "used_acceptable" | "for_parts";

export interface RicardoListingResult {
listingId: string;
Expand Down
28 changes: 20 additions & 8 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.