25 lines
1.1 KiB
JavaScript
25 lines
1.1 KiB
JavaScript
const PersonalUserRepository = require('../repositories/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('./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; |