Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/controllers/serviceController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -227,9 +227,11 @@ export const updateService = asyncHandler(async (req: Request, res: Response) =>
}

// Prepare update data
// Use existing CreatedBy if available, otherwise fall back to current user
// (handles legacy services created before CreatedBy was required)
const updateData = {
...validation.data,
CreatedBy: existingService.CreatedBy,
CreatedBy: existingService.CreatedBy || req.user?._id || req.body?.CreatedBy || 'system',
DocumentModifiedDate: new Date()
};

Expand Down