import { Module } from '@nestjs/common'
import { JwtModule } from '@nestjs/jwt'
import { MongooseModule } from '@nestjs/mongoose'
import { ShareController } from './share.controller'
import { ShareService } from './share.service'
import { ShareRecord, ShareRecordSchema, ShareVisit, ShareVisitSchema } from './share.schema'
import { UserModule } from '../user/user.module'
import { User, UserSchema } from '../user/user.schema'

@Module({
  imports: [
    MongooseModule.forFeature([
      { name: ShareRecord.name, schema: ShareRecordSchema },
      { name: ShareVisit.name, schema: ShareVisitSchema },
      { name: User.name, schema: UserSchema },
    ]),
    UserModule,
    JwtModule.register({
      secret: process.env.JWT_SECRET,
      signOptions: { expiresIn: '7d' },
    }),
  ],
  controllers: [ShareController],
  providers: [ShareService],
})
export class ShareModule {}
