I have created a sample class that registers some data to the database, shown below.
export class RegisterPricingTransactionInfo {
private pricingTransaction: TransactionArgument = null;
constructor(pricingTransaction: TransactionArgument) {
this.pricingTransaction = pricingTransaction;
this.registerPricingTransactionInfo();
}
private urlCode = new GenerateUrlCode(
this.pricingTransaction.npServiceDivision,
this.pricingTransaction.companyCode,
this.pricingTransaction.shopBranchCode,
this.pricingTransaction.shopRegistrationDateSeq,
this.pricingTransaction.shopCode,
this.pricingTransaction.npTransactionId).getUrlCode();
private transaction: ExecuteTransaction = {
npServiceDivision : this.pricingTransaction.npServiceDivision,
shopCode : this.pricingTransaction.shopCode,
npTransactionId : this.pricingTransaction.npTransactionId,
companyCode : this.pricingTransaction.companyCode,
};
public registerPricingTransactionInfo: RegisterPricingTransactionInfo = async () => {
await getRepository(PricingTransaction)
.createQueryBuilder()
.insert()
.into(PricingTransaction)
.values([this.transaction])
.execute();
return this.transaction;
}
However, I came across the following error:
How can I initialize pricingTransaction
? Thank you
Type 'null' is not assignable to type 'TransactionArgument'.