diff --git a/src/app.module.ts b/src/app.module.ts index d20dcea..414e5fb 100644 --- a/src/app.module.ts +++ b/src/app.module.ts @@ -7,6 +7,7 @@ import { databaseConfig } from "./config/database.config"; import { UsersModule } from './users/users.module'; import { ProductsModule } from './products/products.module'; import { CartModule } from './cart/cart.module'; +import { WalletModule } from './wallet/wallet.module'; @Module({ imports: [ @@ -17,6 +18,7 @@ import { CartModule } from './cart/cart.module'; UsersModule, ProductsModule, CartModule, + WalletModule, ], controllers: [AppController], providers: [AppService], diff --git a/src/wallet/entities/wallet.entity.ts b/src/wallet/entities/wallet.entity.ts new file mode 100644 index 0000000..a3ebca3 --- /dev/null +++ b/src/wallet/entities/wallet.entity.ts @@ -0,0 +1,15 @@ +import { Model, Table, Column, ForeignKey, BelongsTo } from 'sequelize-typescript'; +import { User } from '../../users/entities/user.entity'; + +@Table +export class Wallet extends Model { + @ForeignKey(() => User) + @Column + userId: number; + + @BelongsTo(() => User) + user: User; + + @Column + balance: number; +} diff --git a/src/wallet/wallet.controller.ts b/src/wallet/wallet.controller.ts new file mode 100644 index 0000000..47bb6dc --- /dev/null +++ b/src/wallet/wallet.controller.ts @@ -0,0 +1,8 @@ +import { Controller, Get, Post, Body, Patch, Param, Delete } from '@nestjs/common'; +import { WalletService } from './wallet.service'; + +@Controller('wallet') +export class WalletController { + constructor(private readonly walletService: WalletService) {} + +} diff --git a/src/wallet/wallet.module.ts b/src/wallet/wallet.module.ts new file mode 100644 index 0000000..00ed833 --- /dev/null +++ b/src/wallet/wallet.module.ts @@ -0,0 +1,9 @@ +import { Module } from '@nestjs/common'; +import { WalletService } from './wallet.service'; +import { WalletController } from './wallet.controller'; + +@Module({ + controllers: [WalletController], + providers: [WalletService], +}) +export class WalletModule {} diff --git a/src/wallet/wallet.service.ts b/src/wallet/wallet.service.ts new file mode 100644 index 0000000..7ea1a64 --- /dev/null +++ b/src/wallet/wallet.service.ts @@ -0,0 +1,7 @@ +import { Injectable } from '@nestjs/common'; + + +@Injectable() +export class WalletService { + constructor(){} +}