Fixed the remaining TypeScript compilation errors from Phase 3 (Ads-Channel split) by removing all references to channelId and channel relationship from the Ads model throughout the codebase.
File: apps/box-mgnt-api/src/mgnt-backend/feature/ads/ads.service.ts
Removed channelId field from create/update data and removed channel from include statements in:
create() method - removed channelId: dto.channelId from data, removed channel: true from includeupdate() method - removed channelId: dto.channelId from data, removed channel: true from includefindOne() method - removed channel: true from includelist() method - removed where.channelId = dto.channelId filter, removed channel: true from includeuploadCoverImage() method - removed channel: true from includeNote: The assertChannelExists() validation call was retained because it validates that the channel exists (used for business rules), but the Ad itself no longer stores the channelId.
File: libs/core/src/ad/ad-pool.service.ts
Updated AdPayload interface and removed channel references:
channelId: string field from AdPayload interfacechannelName?: string field from AdPayload interfacerebuildPoolForType() method - removed channel: { select: { name: true } } from include, removed channelId and channelName from payload mappinggetRandomFromDb() method - removed channel: { select: { name: true } } from include, removed channelId and channelName from payloadFile: libs/core/src/ad/ad-cache-warmup.service.ts
Updated CachedAd interface and removed channel references:
channelId: string field from CachedAd interfaceonModuleInit() warmup method - removed channelId: ad.channelId from cached ad objectwarmupSingleAd() method - removed channelId: ad.channelId from cached ad objectFile: apps/box-app-api/src/feature/recommendation/recommendation.service.ts
Removed channel-based filtering:
channelId filter from eligibleAds query where clause in the recommendation algorithmapps/box-mgnt-api/src/mgnt-backend/feature/ads/ads.service.tslibs/core/src/ad/ad-pool.service.tslibs/core/src/ad/ad-cache-warmup.service.tsapps/box-app-api/src/feature/recommendation/recommendation.service.ts✅ All TypeScript errors resolved
// ❌ This was failing
const ad = await prisma.ads.create({
data: {
channelId: dto.channelId, // ❌ Error: field doesn't exist
adsModuleId: dto.adsModuleId,
},
include: { channel: true }, // ❌ Error: relation doesn't exist
});
// ✅ This now works
const ad = await prisma.ads.create({
data: {
adsModuleId: dto.adsModuleId,
// channelId removed - Ads is now independent
},
include: { adsModule: true },
});
Ads Relationships After Cleanup:
Before (Phase 2):
Channel (1) ──── (Many) Ads ──── (Many) AdsModule
After Phase 3 (Current):
Ads ──── (Many) AdsModule
Channel ──── (Many) Category
──── (Many) Tag
Ads are now completely decoupled from channels. The channelId parameter in DTOs and service calls is still accepted and used for business validation (to ensure the channel exists), but the Ad record itself does not store or reference the channel.
Phase 3 Cleanup Status: ✅ COMPLETE Date Completed: 2025-12-09 Files Fixed: 4 Compilation Errors Before: 18 Compilation Errors After: 0