Skip to content
This repository was archived by the owner on Mar 13, 2024. It is now read-only.

Commit ec5bb71

Browse files
committed
Refactor code structure and update libraries
1 parent a8a5878 commit ec5bb71

File tree

70 files changed

+374
-233
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+374
-233
lines changed

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,10 @@
8686
"json",
8787
"ts"
8888
],
89-
"rootDir": "src",
89+
"rootDir": ".",
90+
"moduleNameMapper": {
91+
"@/(.*)$": "<rootDir>/src/$1"
92+
},
9093
"testRegex": ".*\\.spec\\.ts$",
9194
"transform": {
9295
"^.+\\.(t|j)s$": "ts-jest"

src/app.controller.spec.ts

Lines changed: 0 additions & 22 deletions
This file was deleted.

src/app.controller.ts

Lines changed: 0 additions & 31 deletions
This file was deleted.

src/app.module.ts

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,22 @@ import { Module } from '@nestjs/common';
22
import { JwtModule } from '@nestjs/jwt';
33
import { APP_GUARD } from '@nestjs/core';
44
import { ConfigModule, ConfigService } from '@nestjs/config';
5-
import { AppController } from './app.controller';
6-
import { AppService } from './app.service';
7-
import { ProductModule } from '@/product/product.module';
8-
import { CheckoutModule } from '@/checkout/checkout.module';
9-
import { MenuModule } from '@/menu/menu.module';
10-
import { MenuCategoryModule } from '@/menu-category/menu-category.module';
11-
import { ShopModule } from '@/shop/shop.module';
12-
import { ChannelModule } from '@/channel/channel.module';
13-
import { ProductVariantModule } from '@/product-variant/product-variant.module';
14-
import { MediaModule } from '@/media/media.module';
15-
import { DomainModule } from '@/domain/domain.module';
16-
import { AvatarModule } from '@/avatar/avatar.module';
17-
import { ClientModule } from '@/client/client.module';
18-
import { EmployeeModule } from '@/employee/employee.module';
19-
import { AuthModule } from '@/auth/auth.module';
20-
import { AuthGuard } from '@/auth/auth.guard';
5+
import { ProductModule } from '@/core/product/product.module';
6+
import { CheckoutModule } from '@/core/checkout/checkout.module';
7+
import { MenuModule } from '@/core/menu/menu.module';
8+
import { MenuCategoryModule } from '@/core/menu-category/menu-category.module';
9+
import { ShopModule } from '@/core/shop/shop.module';
10+
import { ChannelModule } from '@/core/channel/channel.module';
11+
import { ProductVariantModule } from '@/core/product-variant/product-variant.module';
12+
import { MediaModule } from '@/core/media/media.module';
13+
import { DomainModule } from '@/core/domain/domain.module';
14+
import { AvatarModule } from '@/core/avatar/avatar.module';
15+
import { ClientModule } from '@/core/client/client.module';
16+
import { EmployeeModule } from '@/core/employee/employee.module';
17+
import { AuthModule } from '@/core/auth/auth.module';
18+
import { AuthGuard } from '@/core/auth/auth.guard';
19+
import { HealthModule } from '@/core/health/health.module';
20+
import { VersionModule } from '@/core/version/version.module';
2121

2222
@Module({
2323
imports: [
@@ -38,6 +38,8 @@ import { AuthGuard } from '@/auth/auth.guard';
3838
},
3939
inject: [ConfigService],
4040
}),
41+
HealthModule,
42+
VersionModule,
4143
ShopModule,
4244
ChannelModule,
4345
MediaModule,
@@ -52,13 +54,11 @@ import { AuthGuard } from '@/auth/auth.guard';
5254
MenuCategoryModule,
5355
AvatarModule,
5456
],
55-
controllers: [AppController],
5657
providers: [
5758
{
5859
provide: APP_GUARD,
5960
useClass: AuthGuard,
6061
},
61-
AppService,
6262
],
6363
})
6464
export class AppModule {}

src/app.service.ts

Lines changed: 0 additions & 8 deletions
This file was deleted.

src/channel/channel.module.ts

Lines changed: 0 additions & 11 deletions
This file was deleted.

src/auth/auth.controller.ts renamed to src/core/auth/auth.controller.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ import {
99
Post,
1010
UnauthorizedException,
1111
} from '@nestjs/common';
12-
import { AuthService } from '@/auth/auth.service';
13-
import { SignInByEmailDto } from '@/auth/dto/signin-by-email.dto';
14-
import { SignInByEmailResponse } from '@/../sdk/endpoints';
15-
import { Public } from '@/auth/auth.decorator';
12+
import { AuthService } from '@/core/auth/auth.service';
13+
import { SignInByEmailDto } from '@/core/auth/dto/signin-by-email.dto';
14+
import { SignInByEmailResponse } from '../../../sdk/endpoints';
15+
import { Public } from '@/core/auth/auth.decorator';
1616
import { ConfigService } from '@nestjs/config';
1717

1818
@Controller('auth')
File renamed without changes.

src/auth/auth.guard.ts renamed to src/core/auth/auth.guard.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { JwtService } from '@nestjs/jwt';
1111
import type { Request } from 'express';
1212
import type { JWTEmployeeAccessTokenPayload } from '@api-sdk';
1313
import { EmployeePermission } from '@api-sdk';
14-
import { IS_PUBLIC_KEY, Permissions } from '@/auth/auth.decorator';
14+
import { IS_PUBLIC_KEY, Permissions } from '@/core/auth/auth.decorator';
1515

1616
@Injectable()
1717
export class AuthGuard implements CanActivate {

src/auth/auth.module.ts renamed to src/core/auth/auth.module.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { Module } from '@nestjs/common';
22
import { PrismaService } from '@/db/prisma.service';
3-
import { AuthController } from '@/auth/auth.controller';
4-
import { AuthService } from '@/auth/auth.service';
5-
import { EmployeeService } from '@/employee/employee.service';
3+
import { AuthController } from '@/core/auth/auth.controller';
4+
import { AuthService } from '@/core/auth/auth.service';
5+
import { EmployeeService } from '@/core/employee/employee.service';
66
import { JwtService } from '@nestjs/jwt';
77

88
@Module({

0 commit comments

Comments
 (0)