PreRelease v2

This commit is contained in:
2026-03-28 23:46:45 +01:00
parent 6bf998a52a
commit 9993bd232f
39 changed files with 3964 additions and 1469 deletions

View File

@@ -10,6 +10,7 @@ import type {
ContractType,
} from "@/types/contract.types";
import { revalidatePath } from "next/cache";
import { NotificationService } from "@/lib/services/notification.service";
const utapi = new UTApi();
@@ -124,7 +125,7 @@ export class ContractService {
return null;
};
return await prisma.contract.update({
const contract = await prisma.contract.update({
where: { id },
data: {
title: aiResults.title,
@@ -140,6 +141,23 @@ export class ContractService {
status: "COMPLETED",
},
});
// Check for upcoming deadlines after contract is completed
try {
const user = await prisma.user.findUnique({
where: { id: contract.userId },
select: { id: true },
});
if (user) {
await NotificationService.checkUpcomingDeadlines(user.id);
}
} catch (error) {
console.warn("Failed to check upcoming deadlines:", error);
// Don't fail the contract update if deadline check fails
}
return contract;
}
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━