CentralBackend/services/profile/personal/PersonalProfileService.js
2025-09-08 16:05:37 +02:00

25 lines
1.2 KiB
JavaScript

const PersonalUserRepository = require('../../../repositories/user/personal/PersonalUserRepository');
const { logger } = require('../../../middleware/logger');
class PersonalProfileService {
static async completeProfile(userId, profileData, unitOfWork) {
logger.info('PersonalProfileService.completeProfile:start', { userId });
try {
const repo = new PersonalUserRepository(unitOfWork);
await repo.updateAdditionalProfileAndMarkCompleted(userId, profileData);
logger.info('PersonalProfileService.completeProfile:profile_completed', { userId });
// Check if all steps are complete and set status to 'pending' if so
const UserStatusService = require('../../status/UserStatusService');
await UserStatusService.checkAndSetPendingIfComplete(userId, unitOfWork);
logger.info('PersonalProfileService.completeProfile:pending_check_complete', { userId });
logger.info('PersonalProfileService.completeProfile:success', { userId });
return true;
} catch (error) {
logger.error('PersonalProfileService.completeProfile:error', { userId, error: error.message });
throw error;
}
}
}
module.exports = PersonalProfileService;