All files / services/company-profile index.ts

100% Statements 15/15
100% Branches 0/0
100% Functions 12/12
100% Lines 15/15

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144                                                                                                          16x 16x 16x 16x               1x       1x               1x               1x               1x               1x               1x               1x               1x               1x               1x      
// Company Profile Service - Main facade that coordinates all sub-services
import type { Dal } from "../../dal";
import { ProfileService } from "./profile.service";
import { LeadershipService } from "./leadership.service";
import { CertificationsService } from "./certifications.service";
import { TestimonialsService } from "./testimonials.service";
import type {
	UpdateProfileInput,
	AddLeadershipInput,
	UpdateLeadershipInput,
	AddCertificationInput,
	UpdateCertificationInput,
	AddTestimonialInput,
	UpdateTestimonialInput,
} from "./types";
 
// Re-export all types
export type {
	UpdateProfileInput,
	AddLeadershipInput,
	UpdateLeadershipInput,
	AddCertificationInput,
	UpdateCertificationInput,
	AddTestimonialInput,
	UpdateTestimonialInput,
	CompanyProfileResponse,
	ProLeadership,
	ProCertification,
	ProTestimonial,
} from "./types";
 
// Re-export all service classes for direct use if needed
export { ProfileService } from "./profile.service";
export { LeadershipService } from "./leadership.service";
export { CertificationsService } from "./certifications.service";
export { TestimonialsService } from "./testimonials.service";
 
/**
 * CompanyProfileService - Facade that coordinates all company profile operations
 *
 * This service maintains backward compatibility while delegating to specialized services:
 * - ProfileService: Core profile CRUD
 * - LeadershipService: Leadership team management
 * - CertificationsService: Certifications and awards
 * - TestimonialsService: Customer testimonials
 */
export class CompanyProfileService {
	private profileService: ProfileService;
	private leadershipService: LeadershipService;
	private certificationsService: CertificationsService;
	private testimonialsService: TestimonialsService;
 
	constructor(dal: Dal) {
		this.profileService = new ProfileService(dal);
		this.leadershipService = new LeadershipService(dal);
		this.certificationsService = new CertificationsService(dal);
		this.testimonialsService = new TestimonialsService(dal);
	}
 
	// ============================================================================
	// Profile Operations (delegated to ProfileService)
	// ============================================================================
 
	async getCompanyProfile(proId: string) {
		return this.profileService.getCompanyProfile(proId);
	}
 
	async updateProfile(proId: string, data: UpdateProfileInput) {
		return this.profileService.updateProfile(proId, data);
	}
 
	// ============================================================================
	// Leadership Operations (delegated to LeadershipService)
	// ============================================================================
 
	async addLeadershipMember(proId: string, data: AddLeadershipInput) {
		return this.leadershipService.addLeadershipMember(proId, data);
	}
 
	async updateLeadershipMember(
		proId: string,
		memberId: number,
		data: UpdateLeadershipInput,
	) {
		return this.leadershipService.updateLeadershipMember(
			proId,
			memberId,
			data,
		);
	}
 
	async deleteLeadershipMember(proId: string, memberId: number) {
		return this.leadershipService.deleteLeadershipMember(proId, memberId);
	}
 
	// ============================================================================
	// Certifications Operations (delegated to CertificationsService)
	// ============================================================================
 
	async addCertification(proId: string, data: AddCertificationInput) {
		return this.certificationsService.addCertification(proId, data);
	}
 
	async updateCertification(
		proId: string,
		certId: number,
		data: UpdateCertificationInput,
	) {
		return this.certificationsService.updateCertification(
			proId,
			certId,
			data,
		);
	}
 
	async deleteCertification(proId: string, certId: number) {
		return this.certificationsService.deleteCertification(proId, certId);
	}
 
	// ============================================================================
	// Testimonials Operations (delegated to TestimonialsService)
	// ============================================================================
 
	async addTestimonial(proId: string, data: AddTestimonialInput) {
		return this.testimonialsService.addTestimonial(proId, data);
	}
 
	async updateTestimonial(
		proId: string,
		testimonialId: number,
		data: UpdateTestimonialInput,
	) {
		return this.testimonialsService.updateTestimonial(
			proId,
			testimonialId,
			data,
		);
	}
 
	async deleteTestimonial(proId: string, testimonialId: number) {
		return this.testimonialsService.deleteTestimonial(proId, testimonialId);
	}
}