because I got bored of customising my CV for every job
at main 48 lines 1.2 kB view raw
1import { DynamicModule, Module } from "@nestjs/common"; 2import { 3 AI_PROVIDER, 4 AIModule, 5 type AIModuleOptions, 6 type AIProvider, 7} from "@cv/ai-provider"; 8import { CVParserService } from "./ai-parser.service"; 9 10export const CV_PARSER_SERVICE = Symbol("CV_PARSER_SERVICE"); 11 12@Module({}) 13export class CVParserModule { 14 static forRoot(aiOptions: AIModuleOptions): DynamicModule { 15 return { 16 module: CVParserModule, 17 imports: [AIModule.forRoot(aiOptions)], 18 providers: [ 19 { 20 provide: CV_PARSER_SERVICE, 21 inject: [AI_PROVIDER], 22 useFactory: (aiProvider: AIProvider): CVParserService => 23 new CVParserService(aiProvider), 24 }, 25 ], 26 exports: [CV_PARSER_SERVICE], 27 }; 28 } 29 30 /** 31 * Resolve the AI provider type from ConfigService at factory time. 32 */ 33 static forConfig(): DynamicModule { 34 return { 35 module: CVParserModule, 36 imports: [AIModule.forConfig()], 37 providers: [ 38 { 39 provide: CV_PARSER_SERVICE, 40 inject: [AI_PROVIDER], 41 useFactory: (aiProvider: AIProvider): CVParserService => 42 new CVParserService(aiProvider), 43 }, 44 ], 45 exports: [CV_PARSER_SERVICE], 46 }; 47 } 48}