rename(phase 1): CapaKraken → Nexus across code, UI, docs, CI (#61)
CI / Architecture Guardrails (push) Successful in 2m38s
CI / Assistant Split Regression (push) Successful in 3m33s
CI / Typecheck (push) Successful in 3m51s
CI / Lint (push) Successful in 5m2s
CI / E2E Tests (push) Has been cancelled
CI / Fresh-Linux Docker Deploy (push) Has been cancelled
CI / Release Images (push) Has been cancelled
CI / Build (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Architecture Guardrails (push) Successful in 2m38s
CI / Assistant Split Regression (push) Successful in 3m33s
CI / Typecheck (push) Successful in 3m51s
CI / Lint (push) Successful in 5m2s
CI / E2E Tests (push) Has been cancelled
CI / Fresh-Linux Docker Deploy (push) Has been cancelled
CI / Release Images (push) Has been cancelled
CI / Build (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
rename(phase 1): CapaKraken → Nexus across code, UI, docs, CI (#61) Co-authored-by: Hartmut Nörenberg <hn@hartmut-noerenberg.com> Co-committed-by: Hartmut Nörenberg <hn@hartmut-noerenberg.com>
This commit was merged in pull request #61.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { Prisma, VacationType, type PrismaClient } from "@capakraken/db";
|
||||
import { DEFAULT_CALCULATION_RULES } from "@capakraken/engine";
|
||||
import type { AbsenceDay, CalculationRule } from "@capakraken/shared";
|
||||
import { Prisma, VacationType, type PrismaClient } from "@nexus/db";
|
||||
import { DEFAULT_CALCULATION_RULES } from "@nexus/engine";
|
||||
import type { AbsenceDay, CalculationRule } from "@nexus/shared";
|
||||
import { logger } from "../lib/logger.js";
|
||||
|
||||
function isMissingOptionalTableError(error: unknown, tableHints: string[]): boolean {
|
||||
@@ -31,12 +31,12 @@ function isMissingOptionalTableError(error: unknown, tableHints: string[]): bool
|
||||
return tableHints.some((hint) => table.includes(hint) || message.includes(hint));
|
||||
}
|
||||
|
||||
export async function loadTimelineCalculationRules(
|
||||
db: PrismaClient,
|
||||
): Promise<CalculationRule[]> {
|
||||
const calculationRuleModel = (db as PrismaClient & {
|
||||
calculationRule?: { findMany?: (args: unknown) => Promise<unknown[]> };
|
||||
}).calculationRule;
|
||||
export async function loadTimelineCalculationRules(db: PrismaClient): Promise<CalculationRule[]> {
|
||||
const calculationRuleModel = (
|
||||
db as PrismaClient & {
|
||||
calculationRule?: { findMany?: (args: unknown) => Promise<unknown[]> };
|
||||
}
|
||||
).calculationRule;
|
||||
|
||||
if (!calculationRuleModel || typeof calculationRuleModel.findMany !== "function") {
|
||||
return DEFAULT_CALCULATION_RULES;
|
||||
@@ -51,7 +51,13 @@ export async function loadTimelineCalculationRules(
|
||||
return rules as unknown as CalculationRule[];
|
||||
}
|
||||
} catch (error) {
|
||||
if (!isMissingOptionalTableError(error, ["calculationrule", "calculation_rule", "calculation_rules"])) {
|
||||
if (
|
||||
!isMissingOptionalTableError(error, [
|
||||
"calculationrule",
|
||||
"calculation_rule",
|
||||
"calculation_rules",
|
||||
])
|
||||
) {
|
||||
logger.error({ err: error }, "Failed to load active calculation rules for timeline");
|
||||
throw error;
|
||||
}
|
||||
@@ -85,11 +91,12 @@ export async function buildTimelineAbsenceDays(
|
||||
const vacationEnd = new Date(vacation.endDate);
|
||||
vacationEnd.setUTCHours(0, 0, 0, 0);
|
||||
|
||||
const triggerType = vacation.type === VacationType.SICK
|
||||
? "SICK" as const
|
||||
: vacation.type === VacationType.PUBLIC_HOLIDAY
|
||||
? "PUBLIC_HOLIDAY" as const
|
||||
: "VACATION" as const;
|
||||
const triggerType =
|
||||
vacation.type === VacationType.SICK
|
||||
? ("SICK" as const)
|
||||
: vacation.type === VacationType.PUBLIC_HOLIDAY
|
||||
? ("PUBLIC_HOLIDAY" as const)
|
||||
: ("VACATION" as const);
|
||||
|
||||
while (cur <= vacationEnd) {
|
||||
absenceDays.push({
|
||||
|
||||
Reference in New Issue
Block a user