fix: Resolve CI typecheck failures and improve type safety
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed

Fixes CI pipeline failures caused by missing Prisma Client generation and TypeScript type safety issues. Added Prisma generation step to CI pipeline, installed missing type dependencies, and resolved 40+ exactOptionalPropertyTypes violations across service layer.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-30 20:39:03 -06:00
parent 82b36e1d66
commit c221b63d14
19 changed files with 256 additions and 115 deletions

View File

@@ -19,10 +19,18 @@ export class IdeasService {
* Create a new idea
*/
async create(workspaceId: string, userId: string, createIdeaDto: CreateIdeaDto) {
const domainConnection = createIdeaDto.domainId
? { connect: { id: createIdeaDto.domainId } }
: undefined;
const projectConnection = createIdeaDto.projectId
? { connect: { id: createIdeaDto.projectId } }
: undefined;
const data: Prisma.IdeaCreateInput = {
title: createIdeaDto.title,
title: createIdeaDto.title ?? null,
content: createIdeaDto.content,
category: createIdeaDto.category,
category: createIdeaDto.category ?? null,
workspace: { connect: { id: workspaceId } },
creator: { connect: { id: userId } },
status: createIdeaDto.status ?? IdeaStatus.CAPTURED,
@@ -31,8 +39,8 @@ export class IdeasService {
metadata: createIdeaDto.metadata
? (createIdeaDto.metadata as unknown as Prisma.InputJsonValue)
: {},
domain: createIdeaDto.domainId ? { connect: { id: createIdeaDto.domainId } } : undefined,
project: createIdeaDto.projectId ? { connect: { id: createIdeaDto.projectId } } : undefined,
...(domainConnection && { domain: domainConnection }),
...(projectConnection && { project: projectConnection }),
};
const idea = await this.prisma.idea.create({
@@ -67,7 +75,7 @@ export class IdeasService {
workspace: { connect: { id: workspaceId } },
creator: { connect: { id: userId } },
content: captureIdeaDto.content,
title: captureIdeaDto.title,
title: captureIdeaDto.title ?? null,
status: IdeaStatus.CAPTURED,
priority: "MEDIUM",
tags: [],
@@ -101,9 +109,11 @@ export class IdeasService {
const skip = (page - 1) * limit;
// Build where clause
const where: Prisma.IdeaWhereInput = {
workspaceId: query.workspaceId,
};
const where: Prisma.IdeaWhereInput = query.workspaceId
? {
workspaceId: query.workspaceId,
}
: {};
if (query.status) {
where.status = query.status;
@@ -206,12 +216,31 @@ export class IdeasService {
throw new NotFoundException(`Idea with ID ${id} not found`);
}
// Build update data, only including defined fields (excluding domainId and projectId)
const updateData: Prisma.IdeaUpdateInput = {};
if (updateIdeaDto.title !== undefined) updateData.title = updateIdeaDto.title;
if (updateIdeaDto.content !== undefined) updateData.content = updateIdeaDto.content;
if (updateIdeaDto.status !== undefined) updateData.status = updateIdeaDto.status;
if (updateIdeaDto.priority !== undefined) updateData.priority = updateIdeaDto.priority;
if (updateIdeaDto.category !== undefined) updateData.category = updateIdeaDto.category;
if (updateIdeaDto.tags !== undefined) updateData.tags = updateIdeaDto.tags;
if (updateIdeaDto.metadata !== undefined) {
updateData.metadata = updateIdeaDto.metadata as unknown as Prisma.InputJsonValue;
}
// Handle domain and project relations separately
if (updateIdeaDto.domainId !== undefined) {
updateData.domain = { connect: { id: updateIdeaDto.domainId } };
}
if (updateIdeaDto.projectId !== undefined) {
updateData.project = { connect: { id: updateIdeaDto.projectId } };
}
const idea = await this.prisma.idea.update({
where: {
id,
workspaceId,
},
data: updateIdeaDto,
data: updateData,
include: {
creator: {
select: { id: true, name: true, email: true },