fix: Resolve CI typecheck failures and improve type safety
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
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:
@@ -21,10 +21,10 @@ export class ProjectsService {
|
||||
async create(workspaceId: string, userId: string, createProjectDto: CreateProjectDto) {
|
||||
const data: Prisma.ProjectCreateInput = {
|
||||
name: createProjectDto.name,
|
||||
description: createProjectDto.description,
|
||||
color: createProjectDto.color,
|
||||
startDate: createProjectDto.startDate,
|
||||
endDate: createProjectDto.endDate,
|
||||
description: createProjectDto.description ?? null,
|
||||
color: createProjectDto.color ?? null,
|
||||
startDate: createProjectDto.startDate ?? null,
|
||||
endDate: createProjectDto.endDate ?? null,
|
||||
workspace: { connect: { id: workspaceId } },
|
||||
creator: { connect: { id: userId } },
|
||||
status: createProjectDto.status ?? ProjectStatus.PLANNING,
|
||||
@@ -62,9 +62,11 @@ export class ProjectsService {
|
||||
const skip = (page - 1) * limit;
|
||||
|
||||
// Build where clause
|
||||
const where: Prisma.ProjectWhereInput = {
|
||||
workspaceId: query.workspaceId,
|
||||
};
|
||||
const where: Prisma.ProjectWhereInput = query.workspaceId
|
||||
? {
|
||||
workspaceId: query.workspaceId,
|
||||
}
|
||||
: {};
|
||||
|
||||
if (query.status) {
|
||||
where.status = query.status;
|
||||
@@ -175,12 +177,25 @@ export class ProjectsService {
|
||||
throw new NotFoundException(`Project with ID ${id} not found`);
|
||||
}
|
||||
|
||||
// Build update data, only including defined fields
|
||||
const updateData: Prisma.ProjectUpdateInput = {};
|
||||
if (updateProjectDto.name !== undefined) updateData.name = updateProjectDto.name;
|
||||
if (updateProjectDto.description !== undefined)
|
||||
updateData.description = updateProjectDto.description;
|
||||
if (updateProjectDto.status !== undefined) updateData.status = updateProjectDto.status;
|
||||
if (updateProjectDto.startDate !== undefined) updateData.startDate = updateProjectDto.startDate;
|
||||
if (updateProjectDto.endDate !== undefined) updateData.endDate = updateProjectDto.endDate;
|
||||
if (updateProjectDto.color !== undefined) updateData.color = updateProjectDto.color;
|
||||
if (updateProjectDto.metadata !== undefined) {
|
||||
updateData.metadata = updateProjectDto.metadata as unknown as Prisma.InputJsonValue;
|
||||
}
|
||||
|
||||
const project = await this.prisma.project.update({
|
||||
where: {
|
||||
id,
|
||||
workspaceId,
|
||||
},
|
||||
data: updateProjectDto,
|
||||
data: updateData,
|
||||
include: {
|
||||
creator: {
|
||||
select: { id: true, name: true, email: true },
|
||||
|
||||
Reference in New Issue
Block a user