| 1 | import { Module, forwardRef } from '@nestjs/common'; |
| 2 | import { MongooseModule } from '@nestjs/mongoose'; |
| 3 | import { HttpModule } from '@nestjs/axios'; |
| 4 | import { ConfigModule, ConfigService } from '@nestjs/config'; |
| 5 | |
| 6 | import { TwitterController } from './twitter.controller'; |
| 7 | import { TwitterService } from './twitter.service'; |
| 8 | import { TwitterAuthService } from './twitter.auth.service'; |
| 9 | |
| 10 | import { Account, AccountSchema } from 'src/db/schema/account.schema'; |
| 11 | import { AccountToken, AccountTokenSchema } from 'src/db/schema/accountToken.schema'; |
| 12 | import { PubRecord, PubRecordSchema } from 'src/db/schema/pubRecord.schema'; |
| 13 | import { User, UserSchema } from 'src/db/schema/user.schema'; |
| 14 | |
| 15 | import { AccountModule } from 'src/modules/account/account.module'; |
| 16 | import { AuthModule } from 'src/auth/auth.module'; |
| 17 | import { RedisModule } from 'src/lib/redis/redis.module'; |
| 18 | import { UserModule } from 'src/user/user.module'; |
| 19 | import googleConfig from 'config/google.config'; |
| 20 | |
| 21 | // You'll need to create a twitter.config.ts similar to your google.config.ts |
| 22 | // import twitterConfig from 'config/twitter.config'; |
| 23 | |
| 24 | @Module({ |
| 25 | imports: [ |
| 26 | HttpModule, // For making HTTP requests |
| 27 | ConfigModule.forRoot({ |
| 28 | load: [googleConfig], |
| 29 | }), |
| 30 | MongooseModule.forFeature([ |
| 31 | { name: User.name, schema: UserSchema }, |
| 32 | { name: Account.name, schema: AccountSchema }, |
| 33 | { name: AccountToken.name, schema: AccountTokenSchema }, |
| 34 | { name: PubRecord.name, schema: PubRecordSchema }, |
| 35 | ]), |
| 36 | forwardRef(() => AuthModule), |
| 37 | forwardRef(() => AccountModule), |
| 38 | forwardRef(() => UserModule), |
| 39 | RedisModule, |
| 40 | ], |
| 41 | controllers: [TwitterController], |
| 42 | providers: [TwitterService, TwitterAuthService, ConfigService], |
| 43 | exports: [TwitterService, TwitterAuthService], |
| 44 | }) |
| 45 | export class TwitterModule {} |