refactor(inventories): restructure inventory and pos account modules, remove deprecated DTOs and controllers
- Removed create and update DTOs for inventory. - Deleted inventories controller and service. - Introduced new inventory bank accounts module with controller and service. - Added new pos accounts module with controller and service. - Updated Prisma models to reflect changes in bank account relationships. - Adjusted PosAccount and SalesInvoice models for stricter type definitions. - Implemented new response mapping for inventory and pos account services.
This commit is contained in:
+1
-1
@@ -3,13 +3,13 @@ import { AppController } from './app.controller'
|
||||
import { AppService } from './app.service'
|
||||
import { AuthModule } from './auth/auth.module'
|
||||
import { CustomersModule } from './customers/customers.module'
|
||||
import { InventoriesModule } from './inventories/inventories.module'
|
||||
import { InventoryTransferItemsModule } from './inventory-transfer-items/inventory-transfer-items.module'
|
||||
import { InventoryTransfersModule } from './inventory-transfers/inventory-transfers.module'
|
||||
import { BankAccountsModule } from './modules/bank-accounts/bank-accounts.module'
|
||||
import { BankBranchesModule } from './modules/bank-branches/bank-branches.module'
|
||||
import { BanksModule } from './modules/banks/banks.module'
|
||||
import { CardexModule } from './modules/cardex/cardex.module'
|
||||
import { InventoriesModule } from './modules/inventories/inventories.module'
|
||||
import { PosModule } from './modules/pos/pos.module'
|
||||
import { PrismaModule } from './prisma/prisma.module'
|
||||
import { ProductBrandsModule } from './product-brands/product-brands.module'
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* the global `ResponseMappingInterceptor` understands and normalizes.
|
||||
*/
|
||||
export type MapperWrapper<T> =
|
||||
| { __mapped: 'create' | 'update' | 'single'; data: T }
|
||||
| { __mapped: 'create' | 'update' | 'single' | 'delete'; data: T }
|
||||
| { __mapped: 'list'; items: T[] }
|
||||
| { __mapped: 'paginate'; items: T[]; total: number; page?: number; perPage?: number }
|
||||
| { __mapped: 'sequelize'; rows: T[]; count: number; page?: number; perPage?: number }
|
||||
@@ -23,6 +23,10 @@ export const ResponseMapper = {
|
||||
return { __mapped: 'single', data: item }
|
||||
},
|
||||
|
||||
delete<T>(item: T): MapperWrapper<T> {
|
||||
return { __mapped: 'delete', data: item }
|
||||
},
|
||||
|
||||
list<T>(items: T[]): MapperWrapper<T> {
|
||||
return { __mapped: 'list', items }
|
||||
},
|
||||
|
||||
@@ -226,33 +226,6 @@ export type BoolWithAggregatesFilter<$PrismaModel = never> = {
|
||||
_max?: Prisma.NestedBoolFilter<$PrismaModel>
|
||||
}
|
||||
|
||||
export type IntNullableFilter<$PrismaModel = never> = {
|
||||
equals?: number | Prisma.IntFieldRefInput<$PrismaModel> | null
|
||||
in?: number[] | null
|
||||
notIn?: number[] | null
|
||||
lt?: number | Prisma.IntFieldRefInput<$PrismaModel>
|
||||
lte?: number | Prisma.IntFieldRefInput<$PrismaModel>
|
||||
gt?: number | Prisma.IntFieldRefInput<$PrismaModel>
|
||||
gte?: number | Prisma.IntFieldRefInput<$PrismaModel>
|
||||
not?: Prisma.NestedIntNullableFilter<$PrismaModel> | number | null
|
||||
}
|
||||
|
||||
export type IntNullableWithAggregatesFilter<$PrismaModel = never> = {
|
||||
equals?: number | Prisma.IntFieldRefInput<$PrismaModel> | null
|
||||
in?: number[] | null
|
||||
notIn?: number[] | null
|
||||
lt?: number | Prisma.IntFieldRefInput<$PrismaModel>
|
||||
lte?: number | Prisma.IntFieldRefInput<$PrismaModel>
|
||||
gt?: number | Prisma.IntFieldRefInput<$PrismaModel>
|
||||
gte?: number | Prisma.IntFieldRefInput<$PrismaModel>
|
||||
not?: Prisma.NestedIntNullableWithAggregatesFilter<$PrismaModel> | number | null
|
||||
_count?: Prisma.NestedIntNullableFilter<$PrismaModel>
|
||||
_avg?: Prisma.NestedFloatNullableFilter<$PrismaModel>
|
||||
_sum?: Prisma.NestedIntNullableFilter<$PrismaModel>
|
||||
_min?: Prisma.NestedIntNullableFilter<$PrismaModel>
|
||||
_max?: Prisma.NestedIntNullableFilter<$PrismaModel>
|
||||
}
|
||||
|
||||
export type DecimalFilter<$PrismaModel = never> = {
|
||||
equals?: runtime.Decimal | runtime.DecimalJsLike | number | string | Prisma.DecimalFieldRefInput<$PrismaModel>
|
||||
in?: runtime.Decimal[] | runtime.DecimalJsLike[] | number[] | string[]
|
||||
@@ -331,6 +304,33 @@ export type Enumpayment_method_typeWithAggregatesFilter<$PrismaModel = never> =
|
||||
_max?: Prisma.NestedEnumpayment_method_typeFilter<$PrismaModel>
|
||||
}
|
||||
|
||||
export type IntNullableFilter<$PrismaModel = never> = {
|
||||
equals?: number | Prisma.IntFieldRefInput<$PrismaModel> | null
|
||||
in?: number[] | null
|
||||
notIn?: number[] | null
|
||||
lt?: number | Prisma.IntFieldRefInput<$PrismaModel>
|
||||
lte?: number | Prisma.IntFieldRefInput<$PrismaModel>
|
||||
gt?: number | Prisma.IntFieldRefInput<$PrismaModel>
|
||||
gte?: number | Prisma.IntFieldRefInput<$PrismaModel>
|
||||
not?: Prisma.NestedIntNullableFilter<$PrismaModel> | number | null
|
||||
}
|
||||
|
||||
export type IntNullableWithAggregatesFilter<$PrismaModel = never> = {
|
||||
equals?: number | Prisma.IntFieldRefInput<$PrismaModel> | null
|
||||
in?: number[] | null
|
||||
notIn?: number[] | null
|
||||
lt?: number | Prisma.IntFieldRefInput<$PrismaModel>
|
||||
lte?: number | Prisma.IntFieldRefInput<$PrismaModel>
|
||||
gt?: number | Prisma.IntFieldRefInput<$PrismaModel>
|
||||
gte?: number | Prisma.IntFieldRefInput<$PrismaModel>
|
||||
not?: Prisma.NestedIntNullableWithAggregatesFilter<$PrismaModel> | number | null
|
||||
_count?: Prisma.NestedIntNullableFilter<$PrismaModel>
|
||||
_avg?: Prisma.NestedFloatNullableFilter<$PrismaModel>
|
||||
_sum?: Prisma.NestedIntNullableFilter<$PrismaModel>
|
||||
_min?: Prisma.NestedIntNullableFilter<$PrismaModel>
|
||||
_max?: Prisma.NestedIntNullableFilter<$PrismaModel>
|
||||
}
|
||||
|
||||
export type DecimalNullableFilter<$PrismaModel = never> = {
|
||||
equals?: runtime.Decimal | runtime.DecimalJsLike | number | string | Prisma.DecimalFieldRefInput<$PrismaModel> | null
|
||||
in?: runtime.Decimal[] | runtime.DecimalJsLike[] | number[] | string[] | null
|
||||
@@ -594,33 +594,6 @@ export type NestedBoolWithAggregatesFilter<$PrismaModel = never> = {
|
||||
_max?: Prisma.NestedBoolFilter<$PrismaModel>
|
||||
}
|
||||
|
||||
export type NestedIntNullableWithAggregatesFilter<$PrismaModel = never> = {
|
||||
equals?: number | Prisma.IntFieldRefInput<$PrismaModel> | null
|
||||
in?: number[] | null
|
||||
notIn?: number[] | null
|
||||
lt?: number | Prisma.IntFieldRefInput<$PrismaModel>
|
||||
lte?: number | Prisma.IntFieldRefInput<$PrismaModel>
|
||||
gt?: number | Prisma.IntFieldRefInput<$PrismaModel>
|
||||
gte?: number | Prisma.IntFieldRefInput<$PrismaModel>
|
||||
not?: Prisma.NestedIntNullableWithAggregatesFilter<$PrismaModel> | number | null
|
||||
_count?: Prisma.NestedIntNullableFilter<$PrismaModel>
|
||||
_avg?: Prisma.NestedFloatNullableFilter<$PrismaModel>
|
||||
_sum?: Prisma.NestedIntNullableFilter<$PrismaModel>
|
||||
_min?: Prisma.NestedIntNullableFilter<$PrismaModel>
|
||||
_max?: Prisma.NestedIntNullableFilter<$PrismaModel>
|
||||
}
|
||||
|
||||
export type NestedFloatNullableFilter<$PrismaModel = never> = {
|
||||
equals?: number | Prisma.FloatFieldRefInput<$PrismaModel> | null
|
||||
in?: number[] | null
|
||||
notIn?: number[] | null
|
||||
lt?: number | Prisma.FloatFieldRefInput<$PrismaModel>
|
||||
lte?: number | Prisma.FloatFieldRefInput<$PrismaModel>
|
||||
gt?: number | Prisma.FloatFieldRefInput<$PrismaModel>
|
||||
gte?: number | Prisma.FloatFieldRefInput<$PrismaModel>
|
||||
not?: Prisma.NestedFloatNullableFilter<$PrismaModel> | number | null
|
||||
}
|
||||
|
||||
export type NestedDecimalFilter<$PrismaModel = never> = {
|
||||
equals?: runtime.Decimal | runtime.DecimalJsLike | number | string | Prisma.DecimalFieldRefInput<$PrismaModel>
|
||||
in?: runtime.Decimal[] | runtime.DecimalJsLike[] | number[] | string[]
|
||||
@@ -699,6 +672,33 @@ export type NestedEnumpayment_method_typeWithAggregatesFilter<$PrismaModel = nev
|
||||
_max?: Prisma.NestedEnumpayment_method_typeFilter<$PrismaModel>
|
||||
}
|
||||
|
||||
export type NestedIntNullableWithAggregatesFilter<$PrismaModel = never> = {
|
||||
equals?: number | Prisma.IntFieldRefInput<$PrismaModel> | null
|
||||
in?: number[] | null
|
||||
notIn?: number[] | null
|
||||
lt?: number | Prisma.IntFieldRefInput<$PrismaModel>
|
||||
lte?: number | Prisma.IntFieldRefInput<$PrismaModel>
|
||||
gt?: number | Prisma.IntFieldRefInput<$PrismaModel>
|
||||
gte?: number | Prisma.IntFieldRefInput<$PrismaModel>
|
||||
not?: Prisma.NestedIntNullableWithAggregatesFilter<$PrismaModel> | number | null
|
||||
_count?: Prisma.NestedIntNullableFilter<$PrismaModel>
|
||||
_avg?: Prisma.NestedFloatNullableFilter<$PrismaModel>
|
||||
_sum?: Prisma.NestedIntNullableFilter<$PrismaModel>
|
||||
_min?: Prisma.NestedIntNullableFilter<$PrismaModel>
|
||||
_max?: Prisma.NestedIntNullableFilter<$PrismaModel>
|
||||
}
|
||||
|
||||
export type NestedFloatNullableFilter<$PrismaModel = never> = {
|
||||
equals?: number | Prisma.FloatFieldRefInput<$PrismaModel> | null
|
||||
in?: number[] | null
|
||||
notIn?: number[] | null
|
||||
lt?: number | Prisma.FloatFieldRefInput<$PrismaModel>
|
||||
lte?: number | Prisma.FloatFieldRefInput<$PrismaModel>
|
||||
gt?: number | Prisma.FloatFieldRefInput<$PrismaModel>
|
||||
gte?: number | Prisma.FloatFieldRefInput<$PrismaModel>
|
||||
not?: Prisma.NestedFloatNullableFilter<$PrismaModel> | number | null
|
||||
}
|
||||
|
||||
export type NestedDecimalNullableFilter<$PrismaModel = never> = {
|
||||
equals?: runtime.Decimal | runtime.DecimalJsLike | number | string | Prisma.DecimalFieldRefInput<$PrismaModel> | null
|
||||
in?: runtime.Decimal[] | runtime.DecimalJsLike[] | number[] | string[] | null
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -2474,8 +2474,7 @@ export const InventoryScalarFieldEnum = {
|
||||
createdAt: 'createdAt',
|
||||
updatedAt: 'updatedAt',
|
||||
deletedAt: 'deletedAt',
|
||||
isPointOfSale: 'isPointOfSale',
|
||||
bankAccountId: 'bankAccountId'
|
||||
isPointOfSale: 'isPointOfSale'
|
||||
} as const
|
||||
|
||||
export type InventoryScalarFieldEnum = (typeof InventoryScalarFieldEnum)[keyof typeof InventoryScalarFieldEnum]
|
||||
|
||||
@@ -187,8 +187,7 @@ export const InventoryScalarFieldEnum = {
|
||||
createdAt: 'createdAt',
|
||||
updatedAt: 'updatedAt',
|
||||
deletedAt: 'deletedAt',
|
||||
isPointOfSale: 'isPointOfSale',
|
||||
bankAccountId: 'bankAccountId'
|
||||
isPointOfSale: 'isPointOfSale'
|
||||
} as const
|
||||
|
||||
export type InventoryScalarFieldEnum = (typeof InventoryScalarFieldEnum)[keyof typeof InventoryScalarFieldEnum]
|
||||
|
||||
@@ -253,7 +253,6 @@ export type BankAccountWhereInput = {
|
||||
updatedAt?: Prisma.DateTimeFilter<"BankAccount"> | Date | string
|
||||
deletedAt?: Prisma.DateTimeNullableFilter<"BankAccount"> | Date | string | null
|
||||
branch?: Prisma.XOR<Prisma.BankBranchScalarRelationFilter, Prisma.BankBranchWhereInput>
|
||||
inventories?: Prisma.InventoryListRelationFilter
|
||||
purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsListRelationFilter
|
||||
posAccounts?: Prisma.PosAccountListRelationFilter
|
||||
inventoryBankAccounts?: Prisma.InventoryBankAccountListRelationFilter
|
||||
@@ -270,7 +269,6 @@ export type BankAccountOrderByWithRelationInput = {
|
||||
updatedAt?: Prisma.SortOrder
|
||||
deletedAt?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
branch?: Prisma.BankBranchOrderByWithRelationInput
|
||||
inventories?: Prisma.InventoryOrderByRelationAggregateInput
|
||||
purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsOrderByRelationAggregateInput
|
||||
posAccounts?: Prisma.PosAccountOrderByRelationAggregateInput
|
||||
inventoryBankAccounts?: Prisma.InventoryBankAccountOrderByRelationAggregateInput
|
||||
@@ -281,21 +279,20 @@ export type BankAccountWhereUniqueInput = Prisma.AtLeast<{
|
||||
id?: number
|
||||
accountNumber?: string
|
||||
cardNumber?: string
|
||||
iban?: string
|
||||
AND?: Prisma.BankAccountWhereInput | Prisma.BankAccountWhereInput[]
|
||||
OR?: Prisma.BankAccountWhereInput[]
|
||||
NOT?: Prisma.BankAccountWhereInput | Prisma.BankAccountWhereInput[]
|
||||
name?: Prisma.StringFilter<"BankAccount"> | string
|
||||
iban?: Prisma.StringNullableFilter<"BankAccount"> | string | null
|
||||
branchId?: Prisma.IntFilter<"BankAccount"> | number
|
||||
createdAt?: Prisma.DateTimeFilter<"BankAccount"> | Date | string
|
||||
updatedAt?: Prisma.DateTimeFilter<"BankAccount"> | Date | string
|
||||
deletedAt?: Prisma.DateTimeNullableFilter<"BankAccount"> | Date | string | null
|
||||
branch?: Prisma.XOR<Prisma.BankBranchScalarRelationFilter, Prisma.BankBranchWhereInput>
|
||||
inventories?: Prisma.InventoryListRelationFilter
|
||||
purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsListRelationFilter
|
||||
posAccounts?: Prisma.PosAccountListRelationFilter
|
||||
inventoryBankAccounts?: Prisma.InventoryBankAccountListRelationFilter
|
||||
}, "id" | "accountNumber" | "cardNumber">
|
||||
}, "id" | "accountNumber" | "cardNumber" | "iban">
|
||||
|
||||
export type BankAccountOrderByWithAggregationInput = {
|
||||
id?: Prisma.SortOrder
|
||||
@@ -338,7 +335,6 @@ export type BankAccountCreateInput = {
|
||||
updatedAt?: Date | string
|
||||
deletedAt?: Date | string | null
|
||||
branch: Prisma.BankBranchCreateNestedOneWithoutBankAccountsInput
|
||||
inventories?: Prisma.InventoryCreateNestedManyWithoutBankAccountsInput
|
||||
purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsCreateNestedManyWithoutBankAccountInput
|
||||
posAccounts?: Prisma.PosAccountCreateNestedManyWithoutBankAccountInput
|
||||
inventoryBankAccounts?: Prisma.InventoryBankAccountCreateNestedManyWithoutBankAccountInput
|
||||
@@ -354,7 +350,6 @@ export type BankAccountUncheckedCreateInput = {
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
deletedAt?: Date | string | null
|
||||
inventories?: Prisma.InventoryUncheckedCreateNestedManyWithoutBankAccountsInput
|
||||
purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsUncheckedCreateNestedManyWithoutBankAccountInput
|
||||
posAccounts?: Prisma.PosAccountUncheckedCreateNestedManyWithoutBankAccountInput
|
||||
inventoryBankAccounts?: Prisma.InventoryBankAccountUncheckedCreateNestedManyWithoutBankAccountInput
|
||||
@@ -369,7 +364,6 @@ export type BankAccountUpdateInput = {
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
branch?: Prisma.BankBranchUpdateOneRequiredWithoutBankAccountsNestedInput
|
||||
inventories?: Prisma.InventoryUpdateManyWithoutBankAccountsNestedInput
|
||||
purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsUpdateManyWithoutBankAccountNestedInput
|
||||
posAccounts?: Prisma.PosAccountUpdateManyWithoutBankAccountNestedInput
|
||||
inventoryBankAccounts?: Prisma.InventoryBankAccountUpdateManyWithoutBankAccountNestedInput
|
||||
@@ -385,7 +379,6 @@ export type BankAccountUncheckedUpdateInput = {
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
inventories?: Prisma.InventoryUncheckedUpdateManyWithoutBankAccountsNestedInput
|
||||
purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsUncheckedUpdateManyWithoutBankAccountNestedInput
|
||||
posAccounts?: Prisma.PosAccountUncheckedUpdateManyWithoutBankAccountNestedInput
|
||||
inventoryBankAccounts?: Prisma.InventoryBankAccountUncheckedUpdateManyWithoutBankAccountNestedInput
|
||||
@@ -539,44 +532,6 @@ export type BankAccountUncheckedUpdateManyWithoutBranchNestedInput = {
|
||||
deleteMany?: Prisma.BankAccountScalarWhereInput | Prisma.BankAccountScalarWhereInput[]
|
||||
}
|
||||
|
||||
export type BankAccountCreateNestedManyWithoutInventoriesInput = {
|
||||
create?: Prisma.XOR<Prisma.BankAccountCreateWithoutInventoriesInput, Prisma.BankAccountUncheckedCreateWithoutInventoriesInput> | Prisma.BankAccountCreateWithoutInventoriesInput[] | Prisma.BankAccountUncheckedCreateWithoutInventoriesInput[]
|
||||
connectOrCreate?: Prisma.BankAccountCreateOrConnectWithoutInventoriesInput | Prisma.BankAccountCreateOrConnectWithoutInventoriesInput[]
|
||||
connect?: Prisma.BankAccountWhereUniqueInput | Prisma.BankAccountWhereUniqueInput[]
|
||||
}
|
||||
|
||||
export type BankAccountUncheckedCreateNestedManyWithoutInventoriesInput = {
|
||||
create?: Prisma.XOR<Prisma.BankAccountCreateWithoutInventoriesInput, Prisma.BankAccountUncheckedCreateWithoutInventoriesInput> | Prisma.BankAccountCreateWithoutInventoriesInput[] | Prisma.BankAccountUncheckedCreateWithoutInventoriesInput[]
|
||||
connectOrCreate?: Prisma.BankAccountCreateOrConnectWithoutInventoriesInput | Prisma.BankAccountCreateOrConnectWithoutInventoriesInput[]
|
||||
connect?: Prisma.BankAccountWhereUniqueInput | Prisma.BankAccountWhereUniqueInput[]
|
||||
}
|
||||
|
||||
export type BankAccountUpdateManyWithoutInventoriesNestedInput = {
|
||||
create?: Prisma.XOR<Prisma.BankAccountCreateWithoutInventoriesInput, Prisma.BankAccountUncheckedCreateWithoutInventoriesInput> | Prisma.BankAccountCreateWithoutInventoriesInput[] | Prisma.BankAccountUncheckedCreateWithoutInventoriesInput[]
|
||||
connectOrCreate?: Prisma.BankAccountCreateOrConnectWithoutInventoriesInput | Prisma.BankAccountCreateOrConnectWithoutInventoriesInput[]
|
||||
upsert?: Prisma.BankAccountUpsertWithWhereUniqueWithoutInventoriesInput | Prisma.BankAccountUpsertWithWhereUniqueWithoutInventoriesInput[]
|
||||
set?: Prisma.BankAccountWhereUniqueInput | Prisma.BankAccountWhereUniqueInput[]
|
||||
disconnect?: Prisma.BankAccountWhereUniqueInput | Prisma.BankAccountWhereUniqueInput[]
|
||||
delete?: Prisma.BankAccountWhereUniqueInput | Prisma.BankAccountWhereUniqueInput[]
|
||||
connect?: Prisma.BankAccountWhereUniqueInput | Prisma.BankAccountWhereUniqueInput[]
|
||||
update?: Prisma.BankAccountUpdateWithWhereUniqueWithoutInventoriesInput | Prisma.BankAccountUpdateWithWhereUniqueWithoutInventoriesInput[]
|
||||
updateMany?: Prisma.BankAccountUpdateManyWithWhereWithoutInventoriesInput | Prisma.BankAccountUpdateManyWithWhereWithoutInventoriesInput[]
|
||||
deleteMany?: Prisma.BankAccountScalarWhereInput | Prisma.BankAccountScalarWhereInput[]
|
||||
}
|
||||
|
||||
export type BankAccountUncheckedUpdateManyWithoutInventoriesNestedInput = {
|
||||
create?: Prisma.XOR<Prisma.BankAccountCreateWithoutInventoriesInput, Prisma.BankAccountUncheckedCreateWithoutInventoriesInput> | Prisma.BankAccountCreateWithoutInventoriesInput[] | Prisma.BankAccountUncheckedCreateWithoutInventoriesInput[]
|
||||
connectOrCreate?: Prisma.BankAccountCreateOrConnectWithoutInventoriesInput | Prisma.BankAccountCreateOrConnectWithoutInventoriesInput[]
|
||||
upsert?: Prisma.BankAccountUpsertWithWhereUniqueWithoutInventoriesInput | Prisma.BankAccountUpsertWithWhereUniqueWithoutInventoriesInput[]
|
||||
set?: Prisma.BankAccountWhereUniqueInput | Prisma.BankAccountWhereUniqueInput[]
|
||||
disconnect?: Prisma.BankAccountWhereUniqueInput | Prisma.BankAccountWhereUniqueInput[]
|
||||
delete?: Prisma.BankAccountWhereUniqueInput | Prisma.BankAccountWhereUniqueInput[]
|
||||
connect?: Prisma.BankAccountWhereUniqueInput | Prisma.BankAccountWhereUniqueInput[]
|
||||
update?: Prisma.BankAccountUpdateWithWhereUniqueWithoutInventoriesInput | Prisma.BankAccountUpdateWithWhereUniqueWithoutInventoriesInput[]
|
||||
updateMany?: Prisma.BankAccountUpdateManyWithWhereWithoutInventoriesInput | Prisma.BankAccountUpdateManyWithWhereWithoutInventoriesInput[]
|
||||
deleteMany?: Prisma.BankAccountScalarWhereInput | Prisma.BankAccountScalarWhereInput[]
|
||||
}
|
||||
|
||||
export type BankAccountCreateNestedOneWithoutInventoryBankAccountsInput = {
|
||||
create?: Prisma.XOR<Prisma.BankAccountCreateWithoutInventoryBankAccountsInput, Prisma.BankAccountUncheckedCreateWithoutInventoryBankAccountsInput>
|
||||
connectOrCreate?: Prisma.BankAccountCreateOrConnectWithoutInventoryBankAccountsInput
|
||||
@@ -631,7 +586,6 @@ export type BankAccountCreateWithoutBranchInput = {
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
deletedAt?: Date | string | null
|
||||
inventories?: Prisma.InventoryCreateNestedManyWithoutBankAccountsInput
|
||||
purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsCreateNestedManyWithoutBankAccountInput
|
||||
posAccounts?: Prisma.PosAccountCreateNestedManyWithoutBankAccountInput
|
||||
inventoryBankAccounts?: Prisma.InventoryBankAccountCreateNestedManyWithoutBankAccountInput
|
||||
@@ -646,7 +600,6 @@ export type BankAccountUncheckedCreateWithoutBranchInput = {
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
deletedAt?: Date | string | null
|
||||
inventories?: Prisma.InventoryUncheckedCreateNestedManyWithoutBankAccountsInput
|
||||
purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsUncheckedCreateNestedManyWithoutBankAccountInput
|
||||
posAccounts?: Prisma.PosAccountUncheckedCreateNestedManyWithoutBankAccountInput
|
||||
inventoryBankAccounts?: Prisma.InventoryBankAccountUncheckedCreateNestedManyWithoutBankAccountInput
|
||||
@@ -693,56 +646,6 @@ export type BankAccountScalarWhereInput = {
|
||||
deletedAt?: Prisma.DateTimeNullableFilter<"BankAccount"> | Date | string | null
|
||||
}
|
||||
|
||||
export type BankAccountCreateWithoutInventoriesInput = {
|
||||
accountNumber?: string | null
|
||||
cardNumber?: string | null
|
||||
name: string
|
||||
iban?: string | null
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
deletedAt?: Date | string | null
|
||||
branch: Prisma.BankBranchCreateNestedOneWithoutBankAccountsInput
|
||||
purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsCreateNestedManyWithoutBankAccountInput
|
||||
posAccounts?: Prisma.PosAccountCreateNestedManyWithoutBankAccountInput
|
||||
inventoryBankAccounts?: Prisma.InventoryBankAccountCreateNestedManyWithoutBankAccountInput
|
||||
}
|
||||
|
||||
export type BankAccountUncheckedCreateWithoutInventoriesInput = {
|
||||
id?: number
|
||||
accountNumber?: string | null
|
||||
cardNumber?: string | null
|
||||
name: string
|
||||
iban?: string | null
|
||||
branchId: number
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
deletedAt?: Date | string | null
|
||||
purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsUncheckedCreateNestedManyWithoutBankAccountInput
|
||||
posAccounts?: Prisma.PosAccountUncheckedCreateNestedManyWithoutBankAccountInput
|
||||
inventoryBankAccounts?: Prisma.InventoryBankAccountUncheckedCreateNestedManyWithoutBankAccountInput
|
||||
}
|
||||
|
||||
export type BankAccountCreateOrConnectWithoutInventoriesInput = {
|
||||
where: Prisma.BankAccountWhereUniqueInput
|
||||
create: Prisma.XOR<Prisma.BankAccountCreateWithoutInventoriesInput, Prisma.BankAccountUncheckedCreateWithoutInventoriesInput>
|
||||
}
|
||||
|
||||
export type BankAccountUpsertWithWhereUniqueWithoutInventoriesInput = {
|
||||
where: Prisma.BankAccountWhereUniqueInput
|
||||
update: Prisma.XOR<Prisma.BankAccountUpdateWithoutInventoriesInput, Prisma.BankAccountUncheckedUpdateWithoutInventoriesInput>
|
||||
create: Prisma.XOR<Prisma.BankAccountCreateWithoutInventoriesInput, Prisma.BankAccountUncheckedCreateWithoutInventoriesInput>
|
||||
}
|
||||
|
||||
export type BankAccountUpdateWithWhereUniqueWithoutInventoriesInput = {
|
||||
where: Prisma.BankAccountWhereUniqueInput
|
||||
data: Prisma.XOR<Prisma.BankAccountUpdateWithoutInventoriesInput, Prisma.BankAccountUncheckedUpdateWithoutInventoriesInput>
|
||||
}
|
||||
|
||||
export type BankAccountUpdateManyWithWhereWithoutInventoriesInput = {
|
||||
where: Prisma.BankAccountScalarWhereInput
|
||||
data: Prisma.XOR<Prisma.BankAccountUpdateManyMutationInput, Prisma.BankAccountUncheckedUpdateManyWithoutInventoriesInput>
|
||||
}
|
||||
|
||||
export type BankAccountCreateWithoutInventoryBankAccountsInput = {
|
||||
accountNumber?: string | null
|
||||
cardNumber?: string | null
|
||||
@@ -752,7 +655,6 @@ export type BankAccountCreateWithoutInventoryBankAccountsInput = {
|
||||
updatedAt?: Date | string
|
||||
deletedAt?: Date | string | null
|
||||
branch: Prisma.BankBranchCreateNestedOneWithoutBankAccountsInput
|
||||
inventories?: Prisma.InventoryCreateNestedManyWithoutBankAccountsInput
|
||||
purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsCreateNestedManyWithoutBankAccountInput
|
||||
posAccounts?: Prisma.PosAccountCreateNestedManyWithoutBankAccountInput
|
||||
}
|
||||
@@ -767,7 +669,6 @@ export type BankAccountUncheckedCreateWithoutInventoryBankAccountsInput = {
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
deletedAt?: Date | string | null
|
||||
inventories?: Prisma.InventoryUncheckedCreateNestedManyWithoutBankAccountsInput
|
||||
purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsUncheckedCreateNestedManyWithoutBankAccountInput
|
||||
posAccounts?: Prisma.PosAccountUncheckedCreateNestedManyWithoutBankAccountInput
|
||||
}
|
||||
@@ -797,7 +698,6 @@ export type BankAccountUpdateWithoutInventoryBankAccountsInput = {
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
branch?: Prisma.BankBranchUpdateOneRequiredWithoutBankAccountsNestedInput
|
||||
inventories?: Prisma.InventoryUpdateManyWithoutBankAccountsNestedInput
|
||||
purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsUpdateManyWithoutBankAccountNestedInput
|
||||
posAccounts?: Prisma.PosAccountUpdateManyWithoutBankAccountNestedInput
|
||||
}
|
||||
@@ -812,7 +712,6 @@ export type BankAccountUncheckedUpdateWithoutInventoryBankAccountsInput = {
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
inventories?: Prisma.InventoryUncheckedUpdateManyWithoutBankAccountsNestedInput
|
||||
purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsUncheckedUpdateManyWithoutBankAccountNestedInput
|
||||
posAccounts?: Prisma.PosAccountUncheckedUpdateManyWithoutBankAccountNestedInput
|
||||
}
|
||||
@@ -826,7 +725,6 @@ export type BankAccountCreateWithoutPosAccountsInput = {
|
||||
updatedAt?: Date | string
|
||||
deletedAt?: Date | string | null
|
||||
branch: Prisma.BankBranchCreateNestedOneWithoutBankAccountsInput
|
||||
inventories?: Prisma.InventoryCreateNestedManyWithoutBankAccountsInput
|
||||
purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsCreateNestedManyWithoutBankAccountInput
|
||||
inventoryBankAccounts?: Prisma.InventoryBankAccountCreateNestedManyWithoutBankAccountInput
|
||||
}
|
||||
@@ -841,7 +739,6 @@ export type BankAccountUncheckedCreateWithoutPosAccountsInput = {
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
deletedAt?: Date | string | null
|
||||
inventories?: Prisma.InventoryUncheckedCreateNestedManyWithoutBankAccountsInput
|
||||
purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsUncheckedCreateNestedManyWithoutBankAccountInput
|
||||
inventoryBankAccounts?: Prisma.InventoryBankAccountUncheckedCreateNestedManyWithoutBankAccountInput
|
||||
}
|
||||
@@ -871,7 +768,6 @@ export type BankAccountUpdateWithoutPosAccountsInput = {
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
branch?: Prisma.BankBranchUpdateOneRequiredWithoutBankAccountsNestedInput
|
||||
inventories?: Prisma.InventoryUpdateManyWithoutBankAccountsNestedInput
|
||||
purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsUpdateManyWithoutBankAccountNestedInput
|
||||
inventoryBankAccounts?: Prisma.InventoryBankAccountUpdateManyWithoutBankAccountNestedInput
|
||||
}
|
||||
@@ -886,7 +782,6 @@ export type BankAccountUncheckedUpdateWithoutPosAccountsInput = {
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
inventories?: Prisma.InventoryUncheckedUpdateManyWithoutBankAccountsNestedInput
|
||||
purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsUncheckedUpdateManyWithoutBankAccountNestedInput
|
||||
inventoryBankAccounts?: Prisma.InventoryBankAccountUncheckedUpdateManyWithoutBankAccountNestedInput
|
||||
}
|
||||
@@ -900,7 +795,6 @@ export type BankAccountCreateWithoutPurchaseReceiptPaymentsInput = {
|
||||
updatedAt?: Date | string
|
||||
deletedAt?: Date | string | null
|
||||
branch: Prisma.BankBranchCreateNestedOneWithoutBankAccountsInput
|
||||
inventories?: Prisma.InventoryCreateNestedManyWithoutBankAccountsInput
|
||||
posAccounts?: Prisma.PosAccountCreateNestedManyWithoutBankAccountInput
|
||||
inventoryBankAccounts?: Prisma.InventoryBankAccountCreateNestedManyWithoutBankAccountInput
|
||||
}
|
||||
@@ -915,7 +809,6 @@ export type BankAccountUncheckedCreateWithoutPurchaseReceiptPaymentsInput = {
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
deletedAt?: Date | string | null
|
||||
inventories?: Prisma.InventoryUncheckedCreateNestedManyWithoutBankAccountsInput
|
||||
posAccounts?: Prisma.PosAccountUncheckedCreateNestedManyWithoutBankAccountInput
|
||||
inventoryBankAccounts?: Prisma.InventoryBankAccountUncheckedCreateNestedManyWithoutBankAccountInput
|
||||
}
|
||||
@@ -945,7 +838,6 @@ export type BankAccountUpdateWithoutPurchaseReceiptPaymentsInput = {
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
branch?: Prisma.BankBranchUpdateOneRequiredWithoutBankAccountsNestedInput
|
||||
inventories?: Prisma.InventoryUpdateManyWithoutBankAccountsNestedInput
|
||||
posAccounts?: Prisma.PosAccountUpdateManyWithoutBankAccountNestedInput
|
||||
inventoryBankAccounts?: Prisma.InventoryBankAccountUpdateManyWithoutBankAccountNestedInput
|
||||
}
|
||||
@@ -960,7 +852,6 @@ export type BankAccountUncheckedUpdateWithoutPurchaseReceiptPaymentsInput = {
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
inventories?: Prisma.InventoryUncheckedUpdateManyWithoutBankAccountsNestedInput
|
||||
posAccounts?: Prisma.PosAccountUncheckedUpdateManyWithoutBankAccountNestedInput
|
||||
inventoryBankAccounts?: Prisma.InventoryBankAccountUncheckedUpdateManyWithoutBankAccountNestedInput
|
||||
}
|
||||
@@ -984,7 +875,6 @@ export type BankAccountUpdateWithoutBranchInput = {
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
inventories?: Prisma.InventoryUpdateManyWithoutBankAccountsNestedInput
|
||||
purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsUpdateManyWithoutBankAccountNestedInput
|
||||
posAccounts?: Prisma.PosAccountUpdateManyWithoutBankAccountNestedInput
|
||||
inventoryBankAccounts?: Prisma.InventoryBankAccountUpdateManyWithoutBankAccountNestedInput
|
||||
@@ -999,7 +889,6 @@ export type BankAccountUncheckedUpdateWithoutBranchInput = {
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
inventories?: Prisma.InventoryUncheckedUpdateManyWithoutBankAccountsNestedInput
|
||||
purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsUncheckedUpdateManyWithoutBankAccountNestedInput
|
||||
posAccounts?: Prisma.PosAccountUncheckedUpdateManyWithoutBankAccountNestedInput
|
||||
inventoryBankAccounts?: Prisma.InventoryBankAccountUncheckedUpdateManyWithoutBankAccountNestedInput
|
||||
@@ -1016,61 +905,18 @@ export type BankAccountUncheckedUpdateManyWithoutBranchInput = {
|
||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
}
|
||||
|
||||
export type BankAccountUpdateWithoutInventoriesInput = {
|
||||
accountNumber?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
cardNumber?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
name?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
iban?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
branch?: Prisma.BankBranchUpdateOneRequiredWithoutBankAccountsNestedInput
|
||||
purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsUpdateManyWithoutBankAccountNestedInput
|
||||
posAccounts?: Prisma.PosAccountUpdateManyWithoutBankAccountNestedInput
|
||||
inventoryBankAccounts?: Prisma.InventoryBankAccountUpdateManyWithoutBankAccountNestedInput
|
||||
}
|
||||
|
||||
export type BankAccountUncheckedUpdateWithoutInventoriesInput = {
|
||||
id?: Prisma.IntFieldUpdateOperationsInput | number
|
||||
accountNumber?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
cardNumber?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
name?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
iban?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
branchId?: Prisma.IntFieldUpdateOperationsInput | number
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsUncheckedUpdateManyWithoutBankAccountNestedInput
|
||||
posAccounts?: Prisma.PosAccountUncheckedUpdateManyWithoutBankAccountNestedInput
|
||||
inventoryBankAccounts?: Prisma.InventoryBankAccountUncheckedUpdateManyWithoutBankAccountNestedInput
|
||||
}
|
||||
|
||||
export type BankAccountUncheckedUpdateManyWithoutInventoriesInput = {
|
||||
id?: Prisma.IntFieldUpdateOperationsInput | number
|
||||
accountNumber?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
cardNumber?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
name?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
iban?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
branchId?: Prisma.IntFieldUpdateOperationsInput | number
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Count Type BankAccountCountOutputType
|
||||
*/
|
||||
|
||||
export type BankAccountCountOutputType = {
|
||||
inventories: number
|
||||
purchaseReceiptPayments: number
|
||||
posAccounts: number
|
||||
inventoryBankAccounts: number
|
||||
}
|
||||
|
||||
export type BankAccountCountOutputTypeSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
inventories?: boolean | BankAccountCountOutputTypeCountInventoriesArgs
|
||||
purchaseReceiptPayments?: boolean | BankAccountCountOutputTypeCountPurchaseReceiptPaymentsArgs
|
||||
posAccounts?: boolean | BankAccountCountOutputTypeCountPosAccountsArgs
|
||||
inventoryBankAccounts?: boolean | BankAccountCountOutputTypeCountInventoryBankAccountsArgs
|
||||
@@ -1086,13 +932,6 @@ export type BankAccountCountOutputTypeDefaultArgs<ExtArgs extends runtime.Types.
|
||||
select?: Prisma.BankAccountCountOutputTypeSelect<ExtArgs> | null
|
||||
}
|
||||
|
||||
/**
|
||||
* BankAccountCountOutputType without action
|
||||
*/
|
||||
export type BankAccountCountOutputTypeCountInventoriesArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
where?: Prisma.InventoryWhereInput
|
||||
}
|
||||
|
||||
/**
|
||||
* BankAccountCountOutputType without action
|
||||
*/
|
||||
@@ -1126,7 +965,6 @@ export type BankAccountSelect<ExtArgs extends runtime.Types.Extensions.InternalA
|
||||
updatedAt?: boolean
|
||||
deletedAt?: boolean
|
||||
branch?: boolean | Prisma.BankBranchDefaultArgs<ExtArgs>
|
||||
inventories?: boolean | Prisma.BankAccount$inventoriesArgs<ExtArgs>
|
||||
purchaseReceiptPayments?: boolean | Prisma.BankAccount$purchaseReceiptPaymentsArgs<ExtArgs>
|
||||
posAccounts?: boolean | Prisma.BankAccount$posAccountsArgs<ExtArgs>
|
||||
inventoryBankAccounts?: boolean | Prisma.BankAccount$inventoryBankAccountsArgs<ExtArgs>
|
||||
@@ -1150,7 +988,6 @@ export type BankAccountSelectScalar = {
|
||||
export type BankAccountOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"id" | "accountNumber" | "cardNumber" | "name" | "iban" | "branchId" | "createdAt" | "updatedAt" | "deletedAt", ExtArgs["result"]["bankAccount"]>
|
||||
export type BankAccountInclude<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
branch?: boolean | Prisma.BankBranchDefaultArgs<ExtArgs>
|
||||
inventories?: boolean | Prisma.BankAccount$inventoriesArgs<ExtArgs>
|
||||
purchaseReceiptPayments?: boolean | Prisma.BankAccount$purchaseReceiptPaymentsArgs<ExtArgs>
|
||||
posAccounts?: boolean | Prisma.BankAccount$posAccountsArgs<ExtArgs>
|
||||
inventoryBankAccounts?: boolean | Prisma.BankAccount$inventoryBankAccountsArgs<ExtArgs>
|
||||
@@ -1161,7 +998,6 @@ export type $BankAccountPayload<ExtArgs extends runtime.Types.Extensions.Interna
|
||||
name: "BankAccount"
|
||||
objects: {
|
||||
branch: Prisma.$BankBranchPayload<ExtArgs>
|
||||
inventories: Prisma.$InventoryPayload<ExtArgs>[]
|
||||
purchaseReceiptPayments: Prisma.$PurchaseReceiptPaymentsPayload<ExtArgs>[]
|
||||
posAccounts: Prisma.$PosAccountPayload<ExtArgs>[]
|
||||
inventoryBankAccounts: Prisma.$InventoryBankAccountPayload<ExtArgs>[]
|
||||
@@ -1517,7 +1353,6 @@ readonly fields: BankAccountFieldRefs;
|
||||
export interface Prisma__BankAccountClient<T, Null = never, ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs, GlobalOmitOptions = {}> extends Prisma.PrismaPromise<T> {
|
||||
readonly [Symbol.toStringTag]: "PrismaPromise"
|
||||
branch<T extends Prisma.BankBranchDefaultArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.BankBranchDefaultArgs<ExtArgs>>): Prisma.Prisma__BankBranchClient<runtime.Types.Result.GetResult<Prisma.$BankBranchPayload<ExtArgs>, T, "findUniqueOrThrow", GlobalOmitOptions> | Null, Null, ExtArgs, GlobalOmitOptions>
|
||||
inventories<T extends Prisma.BankAccount$inventoriesArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.BankAccount$inventoriesArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$InventoryPayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
|
||||
purchaseReceiptPayments<T extends Prisma.BankAccount$purchaseReceiptPaymentsArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.BankAccount$purchaseReceiptPaymentsArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$PurchaseReceiptPaymentsPayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
|
||||
posAccounts<T extends Prisma.BankAccount$posAccountsArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.BankAccount$posAccountsArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$PosAccountPayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
|
||||
inventoryBankAccounts<T extends Prisma.BankAccount$inventoryBankAccountsArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.BankAccount$inventoryBankAccountsArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$InventoryBankAccountPayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
|
||||
@@ -1901,30 +1736,6 @@ export type BankAccountDeleteManyArgs<ExtArgs extends runtime.Types.Extensions.I
|
||||
limit?: number
|
||||
}
|
||||
|
||||
/**
|
||||
* BankAccount.inventories
|
||||
*/
|
||||
export type BankAccount$inventoriesArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
/**
|
||||
* Select specific fields to fetch from the Inventory
|
||||
*/
|
||||
select?: Prisma.InventorySelect<ExtArgs> | null
|
||||
/**
|
||||
* Omit specific fields from the Inventory
|
||||
*/
|
||||
omit?: Prisma.InventoryOmit<ExtArgs> | null
|
||||
/**
|
||||
* Choose, which related nodes to fetch as well
|
||||
*/
|
||||
include?: Prisma.InventoryInclude<ExtArgs> | null
|
||||
where?: Prisma.InventoryWhereInput
|
||||
orderBy?: Prisma.InventoryOrderByWithRelationInput | Prisma.InventoryOrderByWithRelationInput[]
|
||||
cursor?: Prisma.InventoryWhereUniqueInput
|
||||
take?: number
|
||||
skip?: number
|
||||
distinct?: Prisma.InventoryScalarFieldEnum | Prisma.InventoryScalarFieldEnum[]
|
||||
}
|
||||
|
||||
/**
|
||||
* BankAccount.purchaseReceiptPayments
|
||||
*/
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -216,7 +216,7 @@ export type PosAccountGroupByOutputType = {
|
||||
name: string
|
||||
code: string
|
||||
description: string | null
|
||||
bankAccountId: number | null
|
||||
bankAccountId: number
|
||||
inventoryId: number
|
||||
createdAt: Date
|
||||
updatedAt: Date
|
||||
@@ -251,7 +251,7 @@ export type PosAccountWhereInput = {
|
||||
name?: Prisma.StringFilter<"PosAccount"> | string
|
||||
code?: Prisma.StringFilter<"PosAccount"> | string
|
||||
description?: Prisma.StringNullableFilter<"PosAccount"> | string | null
|
||||
bankAccountId?: Prisma.IntNullableFilter<"PosAccount"> | number | null
|
||||
bankAccountId?: Prisma.IntFilter<"PosAccount"> | number
|
||||
inventoryId?: Prisma.IntFilter<"PosAccount"> | number
|
||||
createdAt?: Prisma.DateTimeFilter<"PosAccount"> | Date | string
|
||||
updatedAt?: Prisma.DateTimeFilter<"PosAccount"> | Date | string
|
||||
@@ -266,7 +266,7 @@ export type PosAccountOrderByWithRelationInput = {
|
||||
name?: Prisma.SortOrder
|
||||
code?: Prisma.SortOrder
|
||||
description?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
bankAccountId?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
bankAccountId?: Prisma.SortOrder
|
||||
inventoryId?: Prisma.SortOrder
|
||||
createdAt?: Prisma.SortOrder
|
||||
updatedAt?: Prisma.SortOrder
|
||||
@@ -285,7 +285,7 @@ export type PosAccountWhereUniqueInput = Prisma.AtLeast<{
|
||||
NOT?: Prisma.PosAccountWhereInput | Prisma.PosAccountWhereInput[]
|
||||
name?: Prisma.StringFilter<"PosAccount"> | string
|
||||
description?: Prisma.StringNullableFilter<"PosAccount"> | string | null
|
||||
bankAccountId?: Prisma.IntNullableFilter<"PosAccount"> | number | null
|
||||
bankAccountId?: Prisma.IntFilter<"PosAccount"> | number
|
||||
inventoryId?: Prisma.IntFilter<"PosAccount"> | number
|
||||
createdAt?: Prisma.DateTimeFilter<"PosAccount"> | Date | string
|
||||
updatedAt?: Prisma.DateTimeFilter<"PosAccount"> | Date | string
|
||||
@@ -300,7 +300,7 @@ export type PosAccountOrderByWithAggregationInput = {
|
||||
name?: Prisma.SortOrder
|
||||
code?: Prisma.SortOrder
|
||||
description?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
bankAccountId?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
bankAccountId?: Prisma.SortOrder
|
||||
inventoryId?: Prisma.SortOrder
|
||||
createdAt?: Prisma.SortOrder
|
||||
updatedAt?: Prisma.SortOrder
|
||||
@@ -320,7 +320,7 @@ export type PosAccountScalarWhereWithAggregatesInput = {
|
||||
name?: Prisma.StringWithAggregatesFilter<"PosAccount"> | string
|
||||
code?: Prisma.StringWithAggregatesFilter<"PosAccount"> | string
|
||||
description?: Prisma.StringNullableWithAggregatesFilter<"PosAccount"> | string | null
|
||||
bankAccountId?: Prisma.IntNullableWithAggregatesFilter<"PosAccount"> | number | null
|
||||
bankAccountId?: Prisma.IntWithAggregatesFilter<"PosAccount"> | number
|
||||
inventoryId?: Prisma.IntWithAggregatesFilter<"PosAccount"> | number
|
||||
createdAt?: Prisma.DateTimeWithAggregatesFilter<"PosAccount"> | Date | string
|
||||
updatedAt?: Prisma.DateTimeWithAggregatesFilter<"PosAccount"> | Date | string
|
||||
@@ -344,7 +344,7 @@ export type PosAccountUncheckedCreateInput = {
|
||||
name: string
|
||||
code: string
|
||||
description?: string | null
|
||||
bankAccountId?: number | null
|
||||
bankAccountId: number
|
||||
inventoryId: number
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
@@ -368,7 +368,7 @@ export type PosAccountUncheckedUpdateInput = {
|
||||
name?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
code?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
bankAccountId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null
|
||||
bankAccountId?: Prisma.IntFieldUpdateOperationsInput | number
|
||||
inventoryId?: Prisma.IntFieldUpdateOperationsInput | number
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
@@ -380,7 +380,7 @@ export type PosAccountCreateManyInput = {
|
||||
name: string
|
||||
code: string
|
||||
description?: string | null
|
||||
bankAccountId?: number | null
|
||||
bankAccountId: number
|
||||
inventoryId: number
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
@@ -401,7 +401,7 @@ export type PosAccountUncheckedUpdateManyInput = {
|
||||
name?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
code?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
bankAccountId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null
|
||||
bankAccountId?: Prisma.IntFieldUpdateOperationsInput | number
|
||||
inventoryId?: Prisma.IntFieldUpdateOperationsInput | number
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
@@ -654,7 +654,7 @@ export type PosAccountScalarWhereInput = {
|
||||
name?: Prisma.StringFilter<"PosAccount"> | string
|
||||
code?: Prisma.StringFilter<"PosAccount"> | string
|
||||
description?: Prisma.StringNullableFilter<"PosAccount"> | string | null
|
||||
bankAccountId?: Prisma.IntNullableFilter<"PosAccount"> | number | null
|
||||
bankAccountId?: Prisma.IntFilter<"PosAccount"> | number
|
||||
inventoryId?: Prisma.IntFilter<"PosAccount"> | number
|
||||
createdAt?: Prisma.DateTimeFilter<"PosAccount"> | Date | string
|
||||
updatedAt?: Prisma.DateTimeFilter<"PosAccount"> | Date | string
|
||||
@@ -677,7 +677,7 @@ export type PosAccountUncheckedCreateWithoutInventoryInput = {
|
||||
name: string
|
||||
code: string
|
||||
description?: string | null
|
||||
bankAccountId?: number | null
|
||||
bankAccountId: number
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
deletedAt?: Date | string | null
|
||||
@@ -805,7 +805,7 @@ export type PosAccountCreateManyInventoryInput = {
|
||||
name: string
|
||||
code: string
|
||||
description?: string | null
|
||||
bankAccountId?: number | null
|
||||
bankAccountId: number
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
deletedAt?: Date | string | null
|
||||
@@ -827,7 +827,7 @@ export type PosAccountUncheckedUpdateWithoutInventoryInput = {
|
||||
name?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
code?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
bankAccountId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null
|
||||
bankAccountId?: Prisma.IntFieldUpdateOperationsInput | number
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
@@ -838,7 +838,7 @@ export type PosAccountUncheckedUpdateManyWithoutInventoryInput = {
|
||||
name?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
code?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
bankAccountId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null
|
||||
bankAccountId?: Prisma.IntFieldUpdateOperationsInput | number
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
@@ -935,7 +935,7 @@ export type $PosAccountPayload<ExtArgs extends runtime.Types.Extensions.Internal
|
||||
name: string
|
||||
code: string
|
||||
description: string | null
|
||||
bankAccountId: number | null
|
||||
bankAccountId: number
|
||||
inventoryId: number
|
||||
createdAt: Date
|
||||
updatedAt: Date
|
||||
|
||||
@@ -547,6 +547,14 @@ export type SalesInvoiceUncheckedUpdateManyWithoutCustomerNestedInput = {
|
||||
deleteMany?: Prisma.SalesInvoiceScalarWhereInput | Prisma.SalesInvoiceScalarWhereInput[]
|
||||
}
|
||||
|
||||
export type NullableIntFieldUpdateOperationsInput = {
|
||||
set?: number | null
|
||||
increment?: number
|
||||
decrement?: number
|
||||
multiply?: number
|
||||
divide?: number
|
||||
}
|
||||
|
||||
export type SalesInvoiceCreateNestedOneWithoutItemsInput = {
|
||||
create?: Prisma.XOR<Prisma.SalesInvoiceCreateWithoutItemsInput, Prisma.SalesInvoiceUncheckedCreateWithoutItemsInput>
|
||||
connectOrCreate?: Prisma.SalesInvoiceCreateOrConnectWithoutItemsInput
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
import { Module } from '@nestjs/common'
|
||||
import { PrismaModule } from '../prisma/prisma.module'
|
||||
import { InventoriesController } from './inventories.controller'
|
||||
import { InventoriesService } from './inventories.service'
|
||||
|
||||
@Module({
|
||||
imports: [PrismaModule],
|
||||
controllers: [InventoriesController],
|
||||
providers: [InventoriesService],
|
||||
})
|
||||
export class InventoriesModule {}
|
||||
@@ -0,0 +1,6 @@
|
||||
import { IsNumber } from 'class-validator'
|
||||
|
||||
export class UpdateInventoryBankAccountDto {
|
||||
@IsNumber()
|
||||
bankAccountId: number
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
import { Body, Controller, Get, Param, Post } from '@nestjs/common'
|
||||
import { CreateBankAccountDto } from '../../bank-accounts/dto/create-bank-account.dto'
|
||||
import { UpdateInventoryBankAccountDto } from './dto/update-inventory-bank-account.dto'
|
||||
import { InventoryBankAccountsService } from './inventory-bank-accounts.service'
|
||||
|
||||
@Controller('inventories/:inventoryId/bank-accounts')
|
||||
export class InventoryBankAccountsController {
|
||||
constructor(private readonly bankAccountsService: InventoryBankAccountsService) {}
|
||||
|
||||
@Post()
|
||||
create(
|
||||
@Param('inventoryId') inventoryId: string,
|
||||
@Body() bankAccount: CreateBankAccountDto,
|
||||
) {
|
||||
return this.bankAccountsService.create(Number(inventoryId), bankAccount)
|
||||
}
|
||||
|
||||
@Get()
|
||||
findAll(@Param('inventoryId') inventoryId: string) {
|
||||
return this.bankAccountsService.findAll(Number(inventoryId))
|
||||
}
|
||||
|
||||
@Post('/assign')
|
||||
assign(
|
||||
@Param('inventoryId') inventoryId: string,
|
||||
@Body() dto: UpdateInventoryBankAccountDto,
|
||||
) {
|
||||
return this.bankAccountsService.assign(Number(inventoryId), dto.bankAccountId)
|
||||
}
|
||||
|
||||
@Post('/unassign')
|
||||
unassign(
|
||||
@Param('inventoryId') inventoryId: string,
|
||||
@Body() dto: UpdateInventoryBankAccountDto,
|
||||
) {
|
||||
return this.bankAccountsService.unassign(Number(inventoryId), dto.bankAccountId)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
import { Module } from '@nestjs/common'
|
||||
import { PrismaModule } from '../../../prisma/prisma.module'
|
||||
import { InventoryBankAccountsController } from './inventory-bank-accounts.controller'
|
||||
import { InventoryBankAccountsService } from './inventory-bank-accounts.service'
|
||||
|
||||
@Module({
|
||||
imports: [PrismaModule],
|
||||
controllers: [InventoryBankAccountsController],
|
||||
providers: [InventoryBankAccountsService],
|
||||
})
|
||||
export class InventoryBankAccountsModule {}
|
||||
@@ -0,0 +1,76 @@
|
||||
import { Injectable } from '@nestjs/common'
|
||||
import { ResponseMapper } from '../../../common/response/response-mapper'
|
||||
import { PrismaService } from '../../../prisma/prisma.service'
|
||||
import { CreateBankAccountDto } from '../../bank-accounts/dto/create-bank-account.dto'
|
||||
|
||||
@Injectable()
|
||||
export class InventoryBankAccountsService {
|
||||
constructor(private prisma: PrismaService) {}
|
||||
|
||||
async create(inventoryId: number, bankAccount: CreateBankAccountDto) {
|
||||
return this.prisma.bankAccount
|
||||
.create({
|
||||
data: bankAccount,
|
||||
})
|
||||
.then(async res => {
|
||||
await this.prisma.inventoryBankAccount.create({
|
||||
data: {
|
||||
inventoryId,
|
||||
bankAccountId: res.id,
|
||||
},
|
||||
})
|
||||
return ResponseMapper.create(res)
|
||||
})
|
||||
}
|
||||
|
||||
async findAll(inventoryId: number) {
|
||||
const items = await this.prisma.inventoryBankAccount.findMany({
|
||||
where: {
|
||||
inventoryId,
|
||||
},
|
||||
include: {
|
||||
bankAccount: {
|
||||
include: {
|
||||
branch: {
|
||||
include: {
|
||||
bank: {
|
||||
select: { id: true, name: true, shortName: true },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
posAccounts: {
|
||||
select: { id: true, name: true, code: true },
|
||||
},
|
||||
},
|
||||
omit: {
|
||||
bankAccountId: true,
|
||||
inventoryId: true,
|
||||
},
|
||||
})
|
||||
return ResponseMapper.list(
|
||||
items.map(item => ({ posAccounts: item.posAccounts, ...item.bankAccount })),
|
||||
)
|
||||
}
|
||||
|
||||
async assign(inventoryId: number, bankAccountId: number) {
|
||||
const item = await this.prisma.inventoryBankAccount.create({
|
||||
data: {
|
||||
inventoryId,
|
||||
bankAccountId,
|
||||
},
|
||||
})
|
||||
return ResponseMapper.create(item)
|
||||
}
|
||||
|
||||
async unassign(inventoryId: number, bankAccountId: number) {
|
||||
const item = await this.prisma.inventoryBankAccount.deleteMany({
|
||||
where: {
|
||||
inventoryId,
|
||||
bankAccountId,
|
||||
},
|
||||
})
|
||||
return ResponseMapper.single(item)
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import { Body, Controller, Delete, Get, Param, Patch, Post, Query } from '@nestjs/common'
|
||||
import { ApiQuery } from '@nestjs/swagger'
|
||||
import { MovementType } from '../generated/prisma/enums'
|
||||
import { MovementType } from '../../../generated/prisma/enums'
|
||||
import { CreateInventoryDto } from './dto/create-inventory.dto'
|
||||
import { UpdateInventoryDto } from './dto/update-inventory.dto'
|
||||
import { InventoriesService } from './inventories.service'
|
||||
+10
-4
@@ -1,7 +1,7 @@
|
||||
import { Injectable } from '@nestjs/common'
|
||||
import { ResponseMapper } from '../common/response/response-mapper'
|
||||
import { MovementType } from '../generated/prisma/enums'
|
||||
import { PrismaService } from '../prisma/prisma.service'
|
||||
import { ResponseMapper } from '../../../common/response/response-mapper'
|
||||
import { MovementType } from '../../../generated/prisma/enums'
|
||||
import { PrismaService } from '../../../prisma/prisma.service'
|
||||
|
||||
@Injectable()
|
||||
export class InventoriesService {
|
||||
@@ -75,7 +75,12 @@ export class InventoriesService {
|
||||
groups.map(async group => {
|
||||
const movements = await this.prisma.stockMovement.findMany({
|
||||
where: { inventoryId, referenceId: group.referenceId, type },
|
||||
include: { product: true },
|
||||
include: {
|
||||
product: true,
|
||||
counterInventory: {
|
||||
select: { id: true, name: true },
|
||||
},
|
||||
},
|
||||
})
|
||||
let info = null as any
|
||||
const mapped = movements.map(movement => {
|
||||
@@ -89,6 +94,7 @@ export class InventoriesService {
|
||||
totalCost: Number(movement.totalCost),
|
||||
referenceType: movement.referenceType,
|
||||
referenceId: movement.referenceId,
|
||||
counterInventory: movement.counterInventory,
|
||||
createdAt: movement.createdAt,
|
||||
}
|
||||
} else {
|
||||
@@ -0,0 +1,13 @@
|
||||
import { Module } from '@nestjs/common'
|
||||
import { PrismaModule } from '../../prisma/prisma.module'
|
||||
import { InventoryBankAccountsModule } from './bank-accounts/inventory-bank-accounts.module'
|
||||
import { InventoriesController } from './index/inventories.controller'
|
||||
import { InventoriesService } from './index/inventories.service'
|
||||
import { PosAccountsModule } from './pos-accounts/pos-accounts.module'
|
||||
|
||||
@Module({
|
||||
imports: [PrismaModule, InventoryBankAccountsModule, PosAccountsModule],
|
||||
controllers: [InventoriesController],
|
||||
providers: [InventoriesService],
|
||||
})
|
||||
export class InventoriesModule {}
|
||||
@@ -0,0 +1,16 @@
|
||||
import { IsInt, IsOptional, IsString } from 'class-validator'
|
||||
|
||||
export class CreatePosAccountDto {
|
||||
@IsString()
|
||||
name: string
|
||||
|
||||
@IsString()
|
||||
code: string
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
description?: string
|
||||
|
||||
@IsInt()
|
||||
bankAccountId: number
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
import { PartialType } from '@nestjs/swagger'
|
||||
import { IsInt } from 'class-validator'
|
||||
import { CreatePosAccountDto } from './create-pos-accounts.dto'
|
||||
|
||||
export class UpdatePosAccountDto extends PartialType(CreatePosAccountDto) {
|
||||
@IsInt()
|
||||
bankAccountId: number
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
import { Body, Controller, Delete, Get, Param, Patch, Post } from '@nestjs/common'
|
||||
import { CreatePosAccountDto } from './dto/create-pos-accounts.dto'
|
||||
import { UpdatePosAccountDto } from './dto/update-pos-accounts.dto'
|
||||
import { PosAccountsService } from './pos-accounts.service'
|
||||
|
||||
@Controller('inventories/:inventoryId/pos-accounts')
|
||||
export class PosAccountsController {
|
||||
constructor(private readonly posAccountsService: PosAccountsService) {}
|
||||
|
||||
@Post()
|
||||
create(
|
||||
@Param('inventoryId') inventoryId: string,
|
||||
@Body() createPosAccountDto: CreatePosAccountDto,
|
||||
) {
|
||||
return this.posAccountsService.create(Number(inventoryId), createPosAccountDto)
|
||||
}
|
||||
|
||||
@Get()
|
||||
findAll(@Param('inventoryId') inventoryId: string) {
|
||||
return this.posAccountsService.findAll(Number(inventoryId))
|
||||
}
|
||||
|
||||
@Get(':id')
|
||||
findOne(@Param('inventoryId') inventoryId: string, @Param('id') id: string) {
|
||||
return this.posAccountsService.findOne(Number(inventoryId), Number(id))
|
||||
}
|
||||
|
||||
@Patch(':id')
|
||||
update(
|
||||
@Param('inventoryId') inventoryId: string,
|
||||
@Param('id') id: string,
|
||||
@Body() updatePosAccountDto: UpdatePosAccountDto,
|
||||
) {
|
||||
return this.posAccountsService.update(
|
||||
Number(inventoryId),
|
||||
Number(id),
|
||||
updatePosAccountDto,
|
||||
)
|
||||
}
|
||||
|
||||
@Delete(':id')
|
||||
remove(@Param('inventoryId') inventoryId: string, @Param('id') id: string) {
|
||||
return this.posAccountsService.remove(Number(inventoryId), Number(id))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
import { Module } from '@nestjs/common'
|
||||
import { PrismaModule } from '../../../prisma/prisma.module'
|
||||
import { PosAccountsController } from './pos-accounts.controller'
|
||||
import { PosAccountsService } from './pos-accounts.service'
|
||||
|
||||
@Module({
|
||||
imports: [PrismaModule],
|
||||
controllers: [PosAccountsController],
|
||||
providers: [PosAccountsService],
|
||||
})
|
||||
export class PosAccountsModule {}
|
||||
@@ -0,0 +1,120 @@
|
||||
import { Injectable } from '@nestjs/common'
|
||||
import { ResponseMapper } from '../../../common/response/response-mapper'
|
||||
import { PrismaService } from '../../../prisma/prisma.service'
|
||||
import { CreatePosAccountDto } from './dto/create-pos-accounts.dto'
|
||||
import { UpdatePosAccountDto } from './dto/update-pos-accounts.dto'
|
||||
|
||||
@Injectable()
|
||||
export class PosAccountsService {
|
||||
constructor(private prisma: PrismaService) {}
|
||||
|
||||
private async validateBankAccountInventoryLink(
|
||||
inventoryId: number,
|
||||
bankAccountId: number,
|
||||
) {
|
||||
const link = await this.prisma.inventoryBankAccount.findUnique({
|
||||
where: {
|
||||
inventoryId_bankAccountId: {
|
||||
inventoryId,
|
||||
bankAccountId,
|
||||
},
|
||||
},
|
||||
})
|
||||
if (!link) {
|
||||
throw new Error('حساب بانکی به این انبار متصل نیست')
|
||||
}
|
||||
}
|
||||
|
||||
async create(inventoryId: number, dto: CreatePosAccountDto) {
|
||||
if (dto.bankAccountId) {
|
||||
await this.validateBankAccountInventoryLink(inventoryId, dto.bankAccountId)
|
||||
}
|
||||
const item = await this.prisma.posAccount.create({
|
||||
data: {
|
||||
...dto,
|
||||
inventoryId,
|
||||
},
|
||||
})
|
||||
return ResponseMapper.create(item)
|
||||
}
|
||||
|
||||
async findAll(inventoryId: number) {
|
||||
const items = await this.prisma.posAccount.findMany({
|
||||
where: {
|
||||
inventoryId,
|
||||
},
|
||||
include: {
|
||||
bankAccount: {
|
||||
select: {
|
||||
id: true,
|
||||
name: true,
|
||||
accountNumber: true,
|
||||
branch: {
|
||||
select: {
|
||||
id: true,
|
||||
name: true,
|
||||
bank: { select: { id: true, name: true } },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
omit: {
|
||||
inventoryId: true,
|
||||
bankAccountId: true,
|
||||
},
|
||||
})
|
||||
return ResponseMapper.list(items)
|
||||
}
|
||||
|
||||
async findOne(inventoryId: number, id: number) {
|
||||
const item = await this.prisma.posAccount.findFirst({
|
||||
where: {
|
||||
id,
|
||||
inventoryId,
|
||||
},
|
||||
include: {
|
||||
bankAccount: {
|
||||
select: {
|
||||
id: true,
|
||||
name: true,
|
||||
accountNumber: true,
|
||||
branch: {
|
||||
select: {
|
||||
id: true,
|
||||
name: true,
|
||||
bank: { select: { id: true, name: true } },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
omit: {
|
||||
inventoryId: true,
|
||||
bankAccountId: true,
|
||||
},
|
||||
})
|
||||
return ResponseMapper.single(item)
|
||||
}
|
||||
|
||||
async update(inventoryId: number, id: number, dto: UpdatePosAccountDto) {
|
||||
await this.validateBankAccountInventoryLink(inventoryId, dto.bankAccountId)
|
||||
|
||||
const item = await this.prisma.posAccount.update({
|
||||
where: {
|
||||
id,
|
||||
},
|
||||
data: dto,
|
||||
})
|
||||
return ResponseMapper.update(item)
|
||||
}
|
||||
|
||||
async remove(inventoryId: number, id: number) {
|
||||
const item = await this.prisma.posAccount.delete({
|
||||
where: {
|
||||
id,
|
||||
},
|
||||
})
|
||||
return ResponseMapper.delete(item)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user