重构 API 为 8 领域 + 应用层架构
将后端模块拆分为 domains、applications、shared 三层,结算计算器移入 domain 纯函数目录,API 路径与测试保持不变。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
21
README.md
21
README.md
@@ -61,8 +61,27 @@ API 文档:http://localhost:3000/api/docs
|
|||||||
## 项目结构
|
## 项目结构
|
||||||
|
|
||||||
```
|
```
|
||||||
|
apps/api/src/
|
||||||
|
├── domains/ # 8 个业务领域
|
||||||
|
│ ├── identity/ # 身份与权限(auth + users)
|
||||||
|
│ ├── agent/ # 代理网络
|
||||||
|
│ ├── ledger/ # 账务账本(wallet)
|
||||||
|
│ ├── catalog/ # 赛事目录(matches)
|
||||||
|
│ ├── odds/ # 盘口赔率(markets)
|
||||||
|
│ ├── betting/ # 注单引擎
|
||||||
|
│ ├── settlement/ # 结算引擎(含 domain/ 纯函数)
|
||||||
|
│ └── operations/ # 运营支撑(audit/cashback/content/i18n)
|
||||||
|
├── applications/ # 三端应用层(编排,不含领域规则)
|
||||||
|
│ ├── player/
|
||||||
|
│ ├── admin/
|
||||||
|
│ └── agent/
|
||||||
|
├── shared/ # 基础设施
|
||||||
|
│ ├── prisma/
|
||||||
|
│ └── common/
|
||||||
|
├── app.module.ts
|
||||||
|
└── main.ts
|
||||||
|
|
||||||
apps/
|
apps/
|
||||||
api/ NestJS 单体后端
|
|
||||||
player/ 玩家 H5 前台
|
player/ 玩家 H5 前台
|
||||||
admin/ 平台后台
|
admin/ 平台后台
|
||||||
agent/ 代理后台
|
agent/ 代理后台
|
||||||
|
|||||||
@@ -1,29 +0,0 @@
|
|||||||
import { Module } from '@nestjs/common';
|
|
||||||
import { AdminController } from './admin.controller';
|
|
||||||
import { UsersModule } from '../users/users.module';
|
|
||||||
import { AgentsModule } from '../agents/agents.module';
|
|
||||||
import { WalletModule } from '../wallet/wallet.module';
|
|
||||||
import { MatchesModule } from '../matches/matches.module';
|
|
||||||
import { MarketsModule } from '../markets/markets.module';
|
|
||||||
import { SettlementModule } from '../settlement/settlement.module';
|
|
||||||
import { CashbackModule } from '../cashback/cashback.module';
|
|
||||||
import { ContentModule } from '../content/content.module';
|
|
||||||
import { I18nModule } from '../i18n/i18n.module';
|
|
||||||
import { BetsModule } from '../bets/bets.module';
|
|
||||||
|
|
||||||
@Module({
|
|
||||||
imports: [
|
|
||||||
UsersModule,
|
|
||||||
AgentsModule,
|
|
||||||
WalletModule,
|
|
||||||
MatchesModule,
|
|
||||||
MarketsModule,
|
|
||||||
SettlementModule,
|
|
||||||
CashbackModule,
|
|
||||||
ContentModule,
|
|
||||||
I18nModule,
|
|
||||||
BetsModule,
|
|
||||||
],
|
|
||||||
controllers: [AdminController],
|
|
||||||
})
|
|
||||||
export class AdminModule {}
|
|
||||||
@@ -2,41 +2,33 @@ import { Module } from '@nestjs/common';
|
|||||||
import { ConfigModule } from '@nestjs/config';
|
import { ConfigModule } from '@nestjs/config';
|
||||||
import { ScheduleModule } from '@nestjs/schedule';
|
import { ScheduleModule } from '@nestjs/schedule';
|
||||||
import { APP_GUARD } from '@nestjs/core';
|
import { APP_GUARD } from '@nestjs/core';
|
||||||
import { JwtAuthGuard } from './auth/guards';
|
import { JwtAuthGuard } from './domains/identity/guards';
|
||||||
import { PrismaModule } from './prisma/prisma.module';
|
import { PrismaModule } from './shared/prisma/prisma.module';
|
||||||
import { AuthModule } from './auth/auth.module';
|
import { IdentityModule } from './domains/identity/identity.module';
|
||||||
import { UsersModule } from './users/users.module';
|
import { AgentsModule } from './domains/agent/agents.module';
|
||||||
import { AgentsModule } from './agents/agents.module';
|
import { WalletModule } from './domains/ledger/wallet.module';
|
||||||
import { WalletModule } from './wallet/wallet.module';
|
import { MatchesModule } from './domains/catalog/matches.module';
|
||||||
import { MatchesModule } from './matches/matches.module';
|
import { MarketsModule } from './domains/odds/markets.module';
|
||||||
import { MarketsModule } from './markets/markets.module';
|
import { BetsModule } from './domains/betting/bets.module';
|
||||||
import { BetsModule } from './bets/bets.module';
|
import { SettlementModule } from './domains/settlement/settlement.module';
|
||||||
import { SettlementModule } from './settlement/settlement.module';
|
import { OperationsModule } from './domains/operations/operations.module';
|
||||||
import { CashbackModule } from './cashback/cashback.module';
|
import { AdminModule } from './applications/admin/admin.module';
|
||||||
import { ContentModule } from './content/content.module';
|
import { PlayerModule } from './applications/player/player.module';
|
||||||
import { I18nModule } from './i18n/i18n.module';
|
import { AgentPortalModule } from './applications/agent/agent-portal.module';
|
||||||
import { AuditModule } from './audit/audit.module';
|
|
||||||
import { AdminModule } from './admin/admin.module';
|
|
||||||
import { PlayerModule } from './player/player.module';
|
|
||||||
import { AgentPortalModule } from './agent-portal/agent-portal.module';
|
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports: [
|
imports: [
|
||||||
ConfigModule.forRoot({ isGlobal: true }),
|
ConfigModule.forRoot({ isGlobal: true }),
|
||||||
ScheduleModule.forRoot(),
|
ScheduleModule.forRoot(),
|
||||||
PrismaModule,
|
PrismaModule,
|
||||||
AuthModule,
|
IdentityModule,
|
||||||
UsersModule,
|
|
||||||
AgentsModule,
|
AgentsModule,
|
||||||
WalletModule,
|
WalletModule,
|
||||||
MatchesModule,
|
MatchesModule,
|
||||||
MarketsModule,
|
MarketsModule,
|
||||||
BetsModule,
|
BetsModule,
|
||||||
SettlementModule,
|
SettlementModule,
|
||||||
CashbackModule,
|
OperationsModule,
|
||||||
ContentModule,
|
|
||||||
I18nModule,
|
|
||||||
AuditModule,
|
|
||||||
AdminModule,
|
AdminModule,
|
||||||
PlayerModule,
|
PlayerModule,
|
||||||
AgentPortalModule,
|
AgentPortalModule,
|
||||||
|
|||||||
@@ -9,21 +9,21 @@ import {
|
|||||||
UseGuards,
|
UseGuards,
|
||||||
} from '@nestjs/common';
|
} from '@nestjs/common';
|
||||||
import { ApiTags, ApiBearerAuth } from '@nestjs/swagger';
|
import { ApiTags, ApiBearerAuth } from '@nestjs/swagger';
|
||||||
import { JwtAuthGuard, AdminGuard } from '../auth/guards';
|
import { JwtAuthGuard, AdminGuard } from '../../domains/identity/guards';
|
||||||
import { ContentService } from '../content/content.service';
|
import { ContentService } from '../../domains/operations/content/content.service';
|
||||||
import { CurrentUser } from '../common/decorators';
|
import { CurrentUser } from '../../shared/common/decorators';
|
||||||
import { jsonResponse } from '../common/filters';
|
import { jsonResponse } from '../../shared/common/filters';
|
||||||
import { UsersService } from '../users/users.service';
|
import { UsersService } from '../../domains/identity/users.service';
|
||||||
import { AgentsService } from '../agents/agents.service';
|
import { AgentsService } from '../../domains/agent/agents.service';
|
||||||
import { WalletService } from '../wallet/wallet.service';
|
import { WalletService } from '../../domains/ledger/wallet.service';
|
||||||
import { MatchesService } from '../matches/matches.service';
|
import { MatchesService } from '../../domains/catalog/matches.service';
|
||||||
import { MarketsService } from '../markets/markets.service';
|
import { MarketsService } from '../../domains/odds/markets.service';
|
||||||
import { SettlementService } from '../settlement/settlement.service';
|
import { SettlementService } from '../../domains/settlement/settlement.service';
|
||||||
import { CashbackService } from '../cashback/cashback.service';
|
import { CashbackService } from '../../domains/operations/cashback/cashback.service';
|
||||||
import { I18nService } from '../i18n/i18n.service';
|
import { I18nService } from '../../domains/operations/i18n/i18n.service';
|
||||||
import { AuditService } from '../audit/audit.service';
|
import { AuditService } from '../../domains/operations/audit/audit.service';
|
||||||
import { BetsService } from '../bets/bets.service';
|
import { BetsService } from '../../domains/betting/bets.service';
|
||||||
import { PrismaService } from '../prisma/prisma.service';
|
import { PrismaService } from '../../shared/prisma/prisma.service';
|
||||||
import { IsString, IsNumber, IsOptional, IsArray, IsBoolean, MinLength } from 'class-validator';
|
import { IsString, IsNumber, IsOptional, IsArray, IsBoolean, MinLength } from 'class-validator';
|
||||||
|
|
||||||
class CreateUserDto {
|
class CreateUserDto {
|
||||||
29
apps/api/src/applications/admin/admin.module.ts
Normal file
29
apps/api/src/applications/admin/admin.module.ts
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
import { Module } from '@nestjs/common';
|
||||||
|
import { AdminController } from './admin.controller';
|
||||||
|
import { UsersModule } from '../../domains/identity/users.module';
|
||||||
|
import { AgentsModule } from '../../domains/agent/agents.module';
|
||||||
|
import { WalletModule } from '../../domains/ledger/wallet.module';
|
||||||
|
import { MatchesModule } from '../../domains/catalog/matches.module';
|
||||||
|
import { MarketsModule } from '../../domains/odds/markets.module';
|
||||||
|
import { SettlementModule } from '../../domains/settlement/settlement.module';
|
||||||
|
import { CashbackModule } from '../../domains/operations/cashback/cashback.module';
|
||||||
|
import { ContentModule } from '../../domains/operations/content/content.module';
|
||||||
|
import { I18nModule } from '../../domains/operations/i18n/i18n.module';
|
||||||
|
import { BetsModule } from '../../domains/betting/bets.module';
|
||||||
|
|
||||||
|
@Module({
|
||||||
|
imports: [
|
||||||
|
UsersModule,
|
||||||
|
AgentsModule,
|
||||||
|
WalletModule,
|
||||||
|
MatchesModule,
|
||||||
|
MarketsModule,
|
||||||
|
SettlementModule,
|
||||||
|
CashbackModule,
|
||||||
|
ContentModule,
|
||||||
|
I18nModule,
|
||||||
|
BetsModule,
|
||||||
|
],
|
||||||
|
controllers: [AdminController],
|
||||||
|
})
|
||||||
|
export class AdminModule {}
|
||||||
@@ -8,13 +8,13 @@ import {
|
|||||||
UseGuards,
|
UseGuards,
|
||||||
} from '@nestjs/common';
|
} from '@nestjs/common';
|
||||||
import { ApiTags, ApiBearerAuth } from '@nestjs/swagger';
|
import { ApiTags, ApiBearerAuth } from '@nestjs/swagger';
|
||||||
import { JwtAuthGuard, AgentGuard } from '../auth/guards';
|
import { JwtAuthGuard, AgentGuard } from '../../domains/identity/guards';
|
||||||
import { CurrentUser } from '../common/decorators';
|
import { CurrentUser } from '../../shared/common/decorators';
|
||||||
import { jsonResponse } from '../common/filters';
|
import { jsonResponse } from '../../shared/common/filters';
|
||||||
import { AgentsService } from '../agents/agents.service';
|
import { AgentsService } from '../../domains/agent/agents.service';
|
||||||
import { WalletService } from '../wallet/wallet.service';
|
import { WalletService } from '../../domains/ledger/wallet.service';
|
||||||
import { BetsService } from '../bets/bets.service';
|
import { BetsService } from '../../domains/betting/bets.service';
|
||||||
import { PrismaService } from '../prisma/prisma.service';
|
import { PrismaService } from '../../shared/prisma/prisma.service';
|
||||||
import { IsString, IsNumber, MinLength, IsOptional } from 'class-validator';
|
import { IsString, IsNumber, MinLength, IsOptional } from 'class-validator';
|
||||||
|
|
||||||
class CreatePlayerDto {
|
class CreatePlayerDto {
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
import { Module } from '@nestjs/common';
|
import { Module } from '@nestjs/common';
|
||||||
import { AgentPortalController } from './agent-portal.controller';
|
import { AgentPortalController } from './agent-portal.controller';
|
||||||
import { AgentsModule } from '../agents/agents.module';
|
import { AgentsModule } from '../../domains/agent/agents.module';
|
||||||
import { WalletModule } from '../wallet/wallet.module';
|
import { WalletModule } from '../../domains/ledger/wallet.module';
|
||||||
import { BetsModule } from '../bets/bets.module';
|
import { BetsModule } from '../../domains/betting/bets.module';
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports: [AgentsModule, WalletModule, BetsModule],
|
imports: [AgentsModule, WalletModule, BetsModule],
|
||||||
@@ -8,15 +8,15 @@ import {
|
|||||||
UseGuards,
|
UseGuards,
|
||||||
} from '@nestjs/common';
|
} from '@nestjs/common';
|
||||||
import { ApiTags, ApiBearerAuth } from '@nestjs/swagger';
|
import { ApiTags, ApiBearerAuth } from '@nestjs/swagger';
|
||||||
import { JwtAuthGuard, PlayerGuard } from '../auth/guards';
|
import { JwtAuthGuard, PlayerGuard } from '../../domains/identity/guards';
|
||||||
import { CurrentUser } from '../common/decorators';
|
import { CurrentUser } from '../../shared/common/decorators';
|
||||||
import { jsonResponse } from '../common/filters';
|
import { jsonResponse } from '../../shared/common/filters';
|
||||||
import { UsersService } from '../users/users.service';
|
import { UsersService } from '../../domains/identity/users.service';
|
||||||
import { WalletService } from '../wallet/wallet.service';
|
import { WalletService } from '../../domains/ledger/wallet.service';
|
||||||
import { MatchesService } from '../matches/matches.service';
|
import { MatchesService } from '../../domains/catalog/matches.service';
|
||||||
import { BetsService } from '../bets/bets.service';
|
import { BetsService } from '../../domains/betting/bets.service';
|
||||||
import { ContentService } from '../content/content.service';
|
import { ContentService } from '../../domains/operations/content/content.service';
|
||||||
import { CashbackService } from '../cashback/cashback.service';
|
import { CashbackService } from '../../domains/operations/cashback/cashback.service';
|
||||||
import { IsString, IsNumber, IsArray, ValidateNested, Min, IsOptional } from 'class-validator';
|
import { IsString, IsNumber, IsArray, ValidateNested, Min, IsOptional } from 'class-validator';
|
||||||
import { Type } from 'class-transformer';
|
import { Type } from 'class-transformer';
|
||||||
|
|
||||||
14
apps/api/src/applications/player/player.module.ts
Normal file
14
apps/api/src/applications/player/player.module.ts
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
import { Module } from '@nestjs/common';
|
||||||
|
import { PlayerController } from './player.controller';
|
||||||
|
import { UsersModule } from '../../domains/identity/users.module';
|
||||||
|
import { WalletModule } from '../../domains/ledger/wallet.module';
|
||||||
|
import { MatchesModule } from '../../domains/catalog/matches.module';
|
||||||
|
import { BetsModule } from '../../domains/betting/bets.module';
|
||||||
|
import { ContentModule } from '../../domains/operations/content/content.module';
|
||||||
|
import { CashbackModule } from '../../domains/operations/cashback/cashback.module';
|
||||||
|
|
||||||
|
@Module({
|
||||||
|
imports: [UsersModule, WalletModule, MatchesModule, BetsModule, ContentModule, CashbackModule],
|
||||||
|
controllers: [PlayerController],
|
||||||
|
})
|
||||||
|
export class PlayerModule {}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import { Module } from '@nestjs/common';
|
import { Module } from '@nestjs/common';
|
||||||
import { AgentsService } from './agents.service';
|
import { AgentsService } from './agents.service';
|
||||||
import { WalletModule } from '../wallet/wallet.module';
|
import { WalletModule } from '../ledger/wallet.module';
|
||||||
import { AuthModule } from '../auth/auth.module';
|
import { AuthModule } from '../identity/auth.module';
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports: [WalletModule, AuthModule],
|
imports: [WalletModule, AuthModule],
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
import { Injectable, BadRequestException, ForbiddenException } from '@nestjs/common';
|
import { Injectable, BadRequestException, ForbiddenException } from '@nestjs/common';
|
||||||
import { PrismaService } from '../prisma/prisma.service';
|
import { PrismaService } from '../../shared/prisma/prisma.service';
|
||||||
import { WalletService } from '../wallet/wallet.service';
|
import { WalletService } from '../ledger/wallet.service';
|
||||||
import { AuthService } from '../auth/auth.service';
|
import { AuthService } from '../identity/auth.service';
|
||||||
import { Decimal } from '@prisma/client/runtime/library';
|
import { Decimal } from '@prisma/client/runtime/library';
|
||||||
import { generateBatchNo } from '../common/decorators';
|
import { generateBatchNo } from '../../shared/common/decorators';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class AgentsService {
|
export class AgentsService {
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import { Module } from '@nestjs/common';
|
import { Module } from '@nestjs/common';
|
||||||
import { BetsService } from './bets.service';
|
import { BetsService } from './bets.service';
|
||||||
import { WalletModule } from '../wallet/wallet.module';
|
import { WalletModule } from '../ledger/wallet.module';
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports: [WalletModule],
|
imports: [WalletModule],
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
import { Injectable, BadRequestException, ConflictException } from '@nestjs/common';
|
import { Injectable, BadRequestException, ConflictException } from '@nestjs/common';
|
||||||
import { PrismaService } from '../prisma/prisma.service';
|
import { PrismaService } from '../../shared/prisma/prisma.service';
|
||||||
import { WalletService } from '../wallet/wallet.service';
|
import { WalletService } from '../ledger/wallet.service';
|
||||||
import { Decimal } from '@prisma/client/runtime/library';
|
import { Decimal } from '@prisma/client/runtime/library';
|
||||||
import { generateBetNo } from '../common/decorators';
|
import { generateBetNo } from '../../shared/common/decorators';
|
||||||
import { isQuarterHandicapOrTotal } from '../settlement/settlement-calculator';
|
import { isQuarterHandicapOrTotal } from '../settlement/domain/settlement-calculator';
|
||||||
import { PARLAY_MIN_LEGS, PARLAY_MAX_LEGS } from '@thebet365/shared';
|
import { PARLAY_MIN_LEGS, PARLAY_MAX_LEGS } from '@thebet365/shared';
|
||||||
|
|
||||||
interface BetSelectionInput {
|
interface BetSelectionInput {
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import { Injectable, NotFoundException, BadRequestException } from '@nestjs/common';
|
import { Injectable, NotFoundException, BadRequestException } from '@nestjs/common';
|
||||||
import { Cron, CronExpression } from '@nestjs/schedule';
|
import { Cron, CronExpression } from '@nestjs/schedule';
|
||||||
import { PrismaService } from '../prisma/prisma.service';
|
import { PrismaService } from '../../shared/prisma/prisma.service';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class MatchesService {
|
export class MatchesService {
|
||||||
@@ -2,9 +2,9 @@ import { Controller, Post, Body, UseGuards } from '@nestjs/common';
|
|||||||
import { ApiTags, ApiBearerAuth } from '@nestjs/swagger';
|
import { ApiTags, ApiBearerAuth } from '@nestjs/swagger';
|
||||||
import { AuthService } from './auth.service';
|
import { AuthService } from './auth.service';
|
||||||
import { LoginDto, ChangePasswordDto } from './auth.dto';
|
import { LoginDto, ChangePasswordDto } from './auth.dto';
|
||||||
import { Public, CurrentUser } from '../common/decorators';
|
import { Public, CurrentUser } from '../../shared/common/decorators';
|
||||||
import { JwtAuthGuard } from './guards';
|
import { JwtAuthGuard } from './guards';
|
||||||
import { jsonResponse } from '../common/filters';
|
import { jsonResponse } from '../../shared/common/filters';
|
||||||
|
|
||||||
@ApiTags('Auth')
|
@ApiTags('Auth')
|
||||||
@Controller()
|
@Controller()
|
||||||
@@ -2,7 +2,7 @@ import { Injectable, UnauthorizedException, ForbiddenException } from '@nestjs/c
|
|||||||
import { JwtService } from '@nestjs/jwt';
|
import { JwtService } from '@nestjs/jwt';
|
||||||
import { ConfigService } from '@nestjs/config';
|
import { ConfigService } from '@nestjs/config';
|
||||||
import * as bcrypt from 'bcryptjs';
|
import * as bcrypt from 'bcryptjs';
|
||||||
import { PrismaService } from '../prisma/prisma.service';
|
import { PrismaService } from '../../shared/prisma/prisma.service';
|
||||||
|
|
||||||
const MAX_LOGIN_FAILS = 5;
|
const MAX_LOGIN_FAILS = 5;
|
||||||
const LOCK_DURATION_MS = 15 * 60 * 1000;
|
const LOCK_DURATION_MS = 15 * 60 * 1000;
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import { Injectable, CanActivate, ExecutionContext, UnauthorizedException, ForbiddenException } from '@nestjs/common';
|
import { Injectable, CanActivate, ExecutionContext, UnauthorizedException, ForbiddenException } from '@nestjs/common';
|
||||||
import { Reflector } from '@nestjs/core';
|
import { Reflector } from '@nestjs/core';
|
||||||
import { AuthGuard } from '@nestjs/passport';
|
import { AuthGuard } from '@nestjs/passport';
|
||||||
import { IS_PUBLIC_KEY, PERMISSIONS_KEY } from '../common/decorators';
|
import { IS_PUBLIC_KEY, PERMISSIONS_KEY } from '../../shared/common/decorators';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class JwtAuthGuard extends AuthGuard('jwt') {
|
export class JwtAuthGuard extends AuthGuard('jwt') {
|
||||||
9
apps/api/src/domains/identity/identity.module.ts
Normal file
9
apps/api/src/domains/identity/identity.module.ts
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
import { Module } from '@nestjs/common';
|
||||||
|
import { AuthModule } from './auth.module';
|
||||||
|
import { UsersModule } from './users.module';
|
||||||
|
|
||||||
|
@Module({
|
||||||
|
imports: [AuthModule, UsersModule],
|
||||||
|
exports: [AuthModule, UsersModule],
|
||||||
|
})
|
||||||
|
export class IdentityModule {}
|
||||||
@@ -2,7 +2,7 @@ import { Injectable, UnauthorizedException } from '@nestjs/common';
|
|||||||
import { PassportStrategy } from '@nestjs/passport';
|
import { PassportStrategy } from '@nestjs/passport';
|
||||||
import { ExtractJwt, Strategy } from 'passport-jwt';
|
import { ExtractJwt, Strategy } from 'passport-jwt';
|
||||||
import { ConfigService } from '@nestjs/config';
|
import { ConfigService } from '@nestjs/config';
|
||||||
import { PrismaService } from '../prisma/prisma.service';
|
import { PrismaService } from '../../shared/prisma/prisma.service';
|
||||||
import { JwtPayload } from './auth.service';
|
import { JwtPayload } from './auth.service';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
import { Injectable } from '@nestjs/common';
|
import { Injectable } from '@nestjs/common';
|
||||||
import { PrismaService } from '../prisma/prisma.service';
|
import { PrismaService } from '../../shared/prisma/prisma.service';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class UsersService {
|
export class UsersService {
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import { Injectable, BadRequestException } from '@nestjs/common';
|
import { Injectable, BadRequestException } from '@nestjs/common';
|
||||||
import { PrismaService } from '../prisma/prisma.service';
|
import { PrismaService } from '../../shared/prisma/prisma.service';
|
||||||
import { Decimal } from '@prisma/client/runtime/library';
|
import { Decimal } from '@prisma/client/runtime/library';
|
||||||
import { generateTransactionId } from '../common/decorators';
|
import { generateTransactionId } from '../../shared/common/decorators';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class WalletService {
|
export class WalletService {
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
import { Injectable, BadRequestException, NotFoundException } from '@nestjs/common';
|
import { Injectable, BadRequestException, NotFoundException } from '@nestjs/common';
|
||||||
import { PrismaService } from '../prisma/prisma.service';
|
import { PrismaService } from '../../shared/prisma/prisma.service';
|
||||||
import { Decimal } from '@prisma/client/runtime/library';
|
import { Decimal } from '@prisma/client/runtime/library';
|
||||||
import {
|
import {
|
||||||
FT_CORRECT_SCORE_TEMPLATE,
|
FT_CORRECT_SCORE_TEMPLATE,
|
||||||
HT_CORRECT_SCORE_TEMPLATE,
|
HT_CORRECT_SCORE_TEMPLATE,
|
||||||
} from '../settlement/settlement-calculator';
|
} from '../settlement/domain/settlement-calculator';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class MarketsService {
|
export class MarketsService {
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
import { Injectable } from '@nestjs/common';
|
import { Injectable } from '@nestjs/common';
|
||||||
import { PrismaService } from '../prisma/prisma.service';
|
import { PrismaService } from '../../../shared/prisma/prisma.service';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class AuditService {
|
export class AuditService {
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import { Module } from '@nestjs/common';
|
import { Module } from '@nestjs/common';
|
||||||
import { CashbackService } from './cashback.service';
|
import { CashbackService } from './cashback.service';
|
||||||
import { WalletModule } from '../wallet/wallet.module';
|
import { WalletModule } from '../../ledger/wallet.module';
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports: [WalletModule],
|
imports: [WalletModule],
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
import { Injectable, BadRequestException } from '@nestjs/common';
|
import { Injectable, BadRequestException } from '@nestjs/common';
|
||||||
import { PrismaService } from '../prisma/prisma.service';
|
import { PrismaService } from '../../../shared/prisma/prisma.service';
|
||||||
import { WalletService } from '../wallet/wallet.service';
|
import { WalletService } from '../../ledger/wallet.service';
|
||||||
import { Decimal } from '@prisma/client/runtime/library';
|
import { Decimal } from '@prisma/client/runtime/library';
|
||||||
import { generateBatchNo } from '../common/decorators';
|
import { generateBatchNo } from '../../../shared/common/decorators';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class CashbackService {
|
export class CashbackService {
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
import { Injectable } from '@nestjs/common';
|
import { Injectable } from '@nestjs/common';
|
||||||
import { PrismaService } from '../prisma/prisma.service';
|
import { PrismaService } from '../../../shared/prisma/prisma.service';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class ContentService {
|
export class ContentService {
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
import { Injectable } from '@nestjs/common';
|
import { Injectable } from '@nestjs/common';
|
||||||
import { PrismaService } from '../prisma/prisma.service';
|
import { PrismaService } from '../../../shared/prisma/prisma.service';
|
||||||
import { DEFAULT_LOCALE } from '@thebet365/shared';
|
import { DEFAULT_LOCALE } from '@thebet365/shared';
|
||||||
|
|
||||||
const FALLBACK_ORDER = ['en-US', 'zh-CN', 'ms-MY'];
|
const FALLBACK_ORDER = ['en-US', 'zh-CN', 'ms-MY'];
|
||||||
11
apps/api/src/domains/operations/operations.module.ts
Normal file
11
apps/api/src/domains/operations/operations.module.ts
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
import { Module } from '@nestjs/common';
|
||||||
|
import { AuditModule } from './audit/audit.module';
|
||||||
|
import { CashbackModule } from './cashback/cashback.module';
|
||||||
|
import { ContentModule } from './content/content.module';
|
||||||
|
import { I18nModule } from './i18n/i18n.module';
|
||||||
|
|
||||||
|
@Module({
|
||||||
|
imports: [AuditModule, CashbackModule, ContentModule, I18nModule],
|
||||||
|
exports: [AuditModule, CashbackModule, ContentModule, I18nModule],
|
||||||
|
})
|
||||||
|
export class OperationsModule {}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import { Module } from '@nestjs/common';
|
import { Module } from '@nestjs/common';
|
||||||
import { SettlementService } from './settlement.service';
|
import { SettlementService } from './settlement.service';
|
||||||
import { WalletModule } from '../wallet/wallet.module';
|
import { WalletModule } from '../ledger/wallet.module';
|
||||||
import { AgentsModule } from '../agents/agents.module';
|
import { AgentsModule } from '../agent/agents.module';
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports: [WalletModule, AgentsModule],
|
imports: [WalletModule, AgentsModule],
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
import { Injectable, BadRequestException, NotFoundException } from '@nestjs/common';
|
import { Injectable, BadRequestException, NotFoundException } from '@nestjs/common';
|
||||||
import { PrismaService } from '../prisma/prisma.service';
|
import { PrismaService } from '../../shared/prisma/prisma.service';
|
||||||
import { WalletService } from '../wallet/wallet.service';
|
import { WalletService } from '../ledger/wallet.service';
|
||||||
import { AgentsService } from '../agents/agents.service';
|
import { AgentsService } from '../agent/agents.service';
|
||||||
import { Decimal } from '@prisma/client/runtime/library';
|
import { Decimal } from '@prisma/client/runtime/library';
|
||||||
import { generateBatchNo } from '../common/decorators';
|
import { generateBatchNo } from '../../shared/common/decorators';
|
||||||
import {
|
import {
|
||||||
settleSelection,
|
settleSelection,
|
||||||
calculatePayout,
|
calculatePayout,
|
||||||
@@ -11,7 +11,7 @@ import {
|
|||||||
ScoreInput,
|
ScoreInput,
|
||||||
FT_CORRECT_SCORE_TEMPLATE,
|
FT_CORRECT_SCORE_TEMPLATE,
|
||||||
HT_CORRECT_SCORE_TEMPLATE,
|
HT_CORRECT_SCORE_TEMPLATE,
|
||||||
} from './settlement-calculator';
|
} from './domain/settlement-calculator';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class SettlementService {
|
export class SettlementService {
|
||||||
@@ -2,7 +2,7 @@ import {
|
|||||||
settleSelection,
|
settleSelection,
|
||||||
calculatePayout,
|
calculatePayout,
|
||||||
isQuarterHandicapOrTotal,
|
isQuarterHandicapOrTotal,
|
||||||
} from './settlement/settlement-calculator';
|
} from './domains/settlement/domain/settlement-calculator';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Agent credit & wallet integration scenarios (A001-A007)
|
* Agent credit & wallet integration scenarios (A001-A007)
|
||||||
|
|||||||
@@ -1,14 +0,0 @@
|
|||||||
import { Module } from '@nestjs/common';
|
|
||||||
import { PlayerController } from './player.controller';
|
|
||||||
import { UsersModule } from '../users/users.module';
|
|
||||||
import { WalletModule } from '../wallet/wallet.module';
|
|
||||||
import { MatchesModule } from '../matches/matches.module';
|
|
||||||
import { BetsModule } from '../bets/bets.module';
|
|
||||||
import { ContentModule } from '../content/content.module';
|
|
||||||
import { CashbackModule } from '../cashback/cashback.module';
|
|
||||||
|
|
||||||
@Module({
|
|
||||||
imports: [UsersModule, WalletModule, MatchesModule, BetsModule, ContentModule, CashbackModule],
|
|
||||||
controllers: [PlayerController],
|
|
||||||
})
|
|
||||||
export class PlayerModule {}
|
|
||||||
Reference in New Issue
Block a user