update: change the discount field of the invoice item from int to decimal

This commit is contained in:
mahyargdz
2025-04-19 12:47:46 +03:30
parent bf3402cc7a
commit 9a12a68cf3
3 changed files with 4 additions and 6 deletions
+1 -1
View File
@@ -13,7 +13,7 @@ export function databaseConfigs(): TypeOrmModuleAsyncOptions {
username: configService.getOrThrow<string>("DB_USER"), username: configService.getOrThrow<string>("DB_USER"),
password: configService.getOrThrow<string>("DB_PASS"), password: configService.getOrThrow<string>("DB_PASS"),
autoLoadEntities: true, autoLoadEntities: true,
synchronize: configService.getOrThrow<string>("NODE_ENV") == "production" ? false : false, synchronize: configService.getOrThrow<string>("NODE_ENV") == "production" ? false : true,
logging: configService.getOrThrow<string>("NODE_ENV") == "production" ? false : true, logging: configService.getOrThrow<string>("NODE_ENV") == "production" ? false : true,
migrationsTableName: "typeorm_migrations", migrationsTableName: "typeorm_migrations",
migrationsRun: false, migrationsRun: false,
@@ -131,9 +131,7 @@ export class DanakServicesRepository extends Repository<DanakService> {
serviceQueryBuilder.orderBy("subscriptionPlans.price", "ASC"); serviceQueryBuilder.orderBy("subscriptionPlans.price", "ASC");
const danakService = await serviceQueryBuilder.getOne(); return serviceQueryBuilder.getOne();
return danakService;
} }
//+******************** //+********************
async getUsersByService(serviceId: string) { async getUsersByService(serviceId: string) {
@@ -18,8 +18,8 @@ export class InvoiceItem extends BaseEntity {
@Column({ type: "int", nullable: false }) @Column({ type: "int", nullable: false })
count: number; count: number;
@Column({ type: "int", nullable: false }) @Column({ type: "decimal", precision: 16, scale: 2, nullable: false, transformer: new DecimalTransformer() })
discount: number; discount: Decimal;
@Column({ type: "decimal", precision: 16, scale: 2, nullable: false, transformer: new DecimalTransformer() }) @Column({ type: "decimal", precision: 16, scale: 2, nullable: false, transformer: new DecimalTransformer() })
unitPrice: Decimal; unitPrice: Decimal;