From f4cc2f89ae4f127761ee2902b88800f352754d64 Mon Sep 17 00:00:00 2001 From: nnn-gif Date: Thu, 22 Aug 2024 09:38:30 +0530 Subject: [PATCH] Update oracle.go --- pkg/model/oracle.go | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/pkg/model/oracle.go b/pkg/model/oracle.go index 61cd5ca49..27ca4e2e7 100644 --- a/pkg/model/oracle.go +++ b/pkg/model/oracle.go @@ -1207,16 +1207,21 @@ func (reldb *RelDB) GetCustomerByPublicKey(publicKey string) (*Customer, error) INNER JOIN wallet_public_keys wpk ON c.customer_id = wpk.customer_id WHERE wpk.public_key = $1 ` - var emailsql sql.NullString + var ( + emailSql sql.NullString + customerPlanSql sql.NullInt16 + paymentStatusSql sql.NullString + paymentSourceSql sql.NullString + ) err := reldb.postgresClient.QueryRow(context.Background(), query, publicKey).Scan( &customer.CustomerID, - &emailsql, + &emailSql, &customer.AccountCreationDate, - &customer.CustomerPlan, + &customerPlanSql, &customer.DeployedOracles, - &customer.PaymentStatus, + &paymentStatusSql, // &customer.LastPayment, - &customer.PaymentSource, + &paymentSourceSql, &customer.NumberOfDataFeeds, &customer.Active, ) @@ -1242,8 +1247,17 @@ func (reldb *RelDB) GetCustomerByPublicKey(publicKey string) (*Customer, error) customer.PublicKeys = append(customer.PublicKeys, publicKey) } - if emailsql.Valid { - customer.Email = emailsql.String + if emailSql.Valid { + customer.Email = emailSql.String + } + if paymentStatusSql.Valid { + customer.PaymentStatus = paymentStatusSql.String + } + if customerPlanSql.Valid { + customer.CustomerPlan = int(customerPlanSql.Int16) + } + if paymentSourceSql.Valid { + customer.PaymentSource = paymentSourceSql.String } if rows.Err() != nil {