Skip to content

Commit

Permalink
Fix: dynamo db rollback (#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
minchodang authored Sep 7, 2024
1 parent 0d8fd31 commit 352b850
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 26 deletions.
5 changes: 3 additions & 2 deletions src/app.module.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { Module } from '@nestjs/common';
import { HealthCheckController } from './modules/health-check/health-check.controller';
import { DynamoDBModule } from './database/dynamodb/dynamodb.module';
import { UserModule } from './modules/user/user.module';
import { AuthModule } from './modules/auth/auth.module';
import { TestModule } from './modules/test/test.module';
import { SupabaseModule } from './database/supabase/supabase.module';

@Module({
imports: [SupabaseModule, UserModule, AuthModule, TestModule],
imports: [DynamoDBModule, UserModule, AuthModule, TestModule],
controllers: [HealthCheckController],
providers: [],
})
Expand Down
24 changes: 24 additions & 0 deletions src/database/dynamodb/dynamodb.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { Module, Global } from '@nestjs/common';
import { DynamoDB } from '@aws-sdk/client-dynamodb';
import { DynamoDBDocument } from '@aws-sdk/lib-dynamodb';

@Global()
@Module({
providers: [
{
provide: 'DYNAMODB',
useFactory: () => {
const client = new DynamoDB({
credentials: {
accessKeyId: process.env.AWS_ACCESS_KEY_ID,
secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY,
},
region: process.env.REGION,
});
return DynamoDBDocument.from(client);
},
},
],
exports: ['DYNAMODB'],
})
export class DynamoDBModule {}
18 changes: 0 additions & 18 deletions src/database/supabase/supabase.module.ts

This file was deleted.

4 changes: 2 additions & 2 deletions src/modules/auth/auth.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { JwtModule } from '@nestjs/jwt';
import { AuthService } from './auth.service';
import { AuthRepository } from './auth.repository';
import { AuthController } from './auth.controller';
import { DynamoDBModule } from '../../database/dynamodb/dynamodb.module';
import { JwtStrategy } from '../../auth/strategy/jwt.strategy';
import { PassportModule } from '@nestjs/passport';
import { UserModule } from '../user/user.module';
Expand All @@ -11,11 +12,10 @@ import { UserService } from '../user/user.service';
import { UserRepository } from '../user/user.repository';
import { GoogleStrategy } from 'src/auth/strategy/google.strategy';
import { jwtConstants } from 'src/core/config/jwt';
import { SupabaseModule } from 'src/database/supabase/supabase.module';

@Module({
imports: [
SupabaseModule,
DynamoDBModule,
PassportModule,
JwtModule.register({
secret: process.env.JWT_SECRET,
Expand Down
2 changes: 1 addition & 1 deletion src/modules/test/test.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Module } from '@nestjs/common';
import { TestService } from './test.service';
import { TestRepository } from './test.repository';
import { TestController } from './test.controller';
import { DynamoDBModule } from '../../database/supabase/supabase.module';
import { DynamoDBModule } from '../../database/dynamodb/dynamodb.module';

@Module({
imports: [DynamoDBModule],
Expand Down
5 changes: 2 additions & 3 deletions src/modules/user/user.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ import { UserService } from './user.service';
import { UserRepository } from './user.repository';
import { UserController } from './user.controller';
import { AuthModule } from '../auth/auth.module';
import { SupabaseModule } from 'src/database/supabase/supabase.module';

import { DynamoDBModule } from '../../database/dynamodb/dynamodb.module';
@Module({
imports: [SupabaseModule, AuthModule],
imports: [DynamoDBModule, AuthModule],
controllers: [UserController],
providers: [UserService, UserRepository],
exports: [UserService, UserRepository],
Expand Down

0 comments on commit 352b850

Please sign in to comment.