Files
Content-Hunter_BE/test-api.ts
Harun CAN dee6e29cfd
Some checks failed
Backend Deploy 🚀 / build-and-deploy (push) Has been cancelled
main
2026-03-14 14:01:01 +03:00

20 lines
785 B
TypeScript

// test-api.ts
import { NestFactory } from '@nestjs/core';
import { AppModule } from './src/app.module';
import { MasterContentService } from './src/modules/content/services/master-content.service';
async function bootstrap() {
const app = await NestFactory.createApplicationContext(AppModule);
const masterContentService = app.get(MasterContentService);
// Fetch a known master ID from the DB
const id = '80c71d39-4614-426c-9d9a-e5b2301cdebd';
const data = await masterContentService.getById(id);
console.log("Returned data type:", typeof data);
console.log("Has contents?", Array.isArray(data?.contents));
console.log("Contents array:", data?.contents?.map(c => ({ id: c.id, type: c.type, title: c.title })));
await app.close();
}
bootstrap();