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:
@@ -18,19 +18,23 @@ export class EventsService {
|
||||
* Create a new event
|
||||
*/
|
||||
async create(workspaceId: string, userId: string, createEventDto: CreateEventDto) {
|
||||
const projectConnection = createEventDto.projectId
|
||||
? { connect: { id: createEventDto.projectId } }
|
||||
: undefined;
|
||||
|
||||
const data: Prisma.EventCreateInput = {
|
||||
title: createEventDto.title,
|
||||
description: createEventDto.description,
|
||||
description: createEventDto.description ?? null,
|
||||
startTime: createEventDto.startTime,
|
||||
endTime: createEventDto.endTime,
|
||||
location: createEventDto.location,
|
||||
endTime: createEventDto.endTime ?? null,
|
||||
location: createEventDto.location ?? null,
|
||||
workspace: { connect: { id: workspaceId } },
|
||||
creator: { connect: { id: userId } },
|
||||
allDay: createEventDto.allDay ?? false,
|
||||
metadata: createEventDto.metadata
|
||||
? (createEventDto.metadata as unknown as Prisma.InputJsonValue)
|
||||
: {},
|
||||
project: createEventDto.projectId ? { connect: { id: createEventDto.projectId } } : undefined,
|
||||
...(projectConnection && { project: projectConnection }),
|
||||
};
|
||||
|
||||
const event = await this.prisma.event.create({
|
||||
@@ -62,9 +66,11 @@ export class EventsService {
|
||||
const skip = (page - 1) * limit;
|
||||
|
||||
// Build where clause
|
||||
const where: Prisma.EventWhereInput = {
|
||||
workspaceId: query.workspaceId,
|
||||
};
|
||||
const where: Prisma.EventWhereInput = query.workspaceId
|
||||
? {
|
||||
workspaceId: query.workspaceId,
|
||||
}
|
||||
: {};
|
||||
|
||||
if (query.projectId) {
|
||||
where.projectId = query.projectId;
|
||||
@@ -155,12 +161,32 @@ export class EventsService {
|
||||
throw new NotFoundException(`Event with ID ${id} not found`);
|
||||
}
|
||||
|
||||
// Build update data, only including defined fields (excluding projectId)
|
||||
const updateData: Prisma.EventUpdateInput = {};
|
||||
if (updateEventDto.title !== undefined) updateData.title = updateEventDto.title;
|
||||
if (updateEventDto.description !== undefined)
|
||||
updateData.description = updateEventDto.description;
|
||||
if (updateEventDto.startTime !== undefined) updateData.startTime = updateEventDto.startTime;
|
||||
if (updateEventDto.endTime !== undefined) updateData.endTime = updateEventDto.endTime;
|
||||
if (updateEventDto.allDay !== undefined) updateData.allDay = updateEventDto.allDay;
|
||||
if (updateEventDto.location !== undefined) updateData.location = updateEventDto.location;
|
||||
if (updateEventDto.recurrence !== undefined) {
|
||||
updateData.recurrence = updateEventDto.recurrence as unknown as Prisma.InputJsonValue;
|
||||
}
|
||||
if (updateEventDto.metadata !== undefined) {
|
||||
updateData.metadata = updateEventDto.metadata as unknown as Prisma.InputJsonValue;
|
||||
}
|
||||
// Handle project relation separately
|
||||
if (updateEventDto.projectId !== undefined) {
|
||||
updateData.project = { connect: { id: updateEventDto.projectId } };
|
||||
}
|
||||
|
||||
const event = await this.prisma.event.update({
|
||||
where: {
|
||||
id,
|
||||
workspaceId,
|
||||
},
|
||||
data: updateEventDto,
|
||||
data: updateData,
|
||||
include: {
|
||||
creator: {
|
||||
select: { id: true, name: true, email: true },
|
||||
|
||||
Reference in New Issue
Block a user