mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-20 13:31:56 +00:00
Merge branch 'feat/edit-dc' into 'development'
[FEAT][BE]: fix get search keuangan; add bank name to supplier and customer See merge request mbugroup/lti-api!538
This commit is contained in:
+2
@@ -0,0 +1,2 @@
|
|||||||
|
ALTER TABLE customers DROP COLUMN bank_name;
|
||||||
|
ALTER TABLE suppliers DROP COLUMN bank_name;
|
||||||
+2
@@ -0,0 +1,2 @@
|
|||||||
|
ALTER TABLE customers ADD COLUMN bank_name VARCHAR(100) NOT NULL DEFAULT '';
|
||||||
|
ALTER TABLE suppliers ADD COLUMN bank_name VARCHAR(100);
|
||||||
@@ -15,6 +15,7 @@ type Customer struct {
|
|||||||
Phone string `gorm:"not null;size:20"`
|
Phone string `gorm:"not null;size:20"`
|
||||||
Email string `gorm:"type:varchar(50);not null"`
|
Email string `gorm:"type:varchar(50);not null"`
|
||||||
AccountNumber string `gorm:"not null;size:50"`
|
AccountNumber string `gorm:"not null;size:50"`
|
||||||
|
BankName string `gorm:"not null;size:100;default:''"`
|
||||||
Balance float64 `gorm:"default:0"`
|
Balance float64 `gorm:"default:0"`
|
||||||
CreatedBy uint `gorm:"not null"`
|
CreatedBy uint `gorm:"not null"`
|
||||||
CreatedAt time.Time `gorm:"autoCreateTime"`
|
CreatedAt time.Time `gorm:"autoCreateTime"`
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ type Supplier struct {
|
|||||||
Address string `gorm:"not null"`
|
Address string `gorm:"not null"`
|
||||||
Npwp *string `gorm:"size:50"`
|
Npwp *string `gorm:"size:50"`
|
||||||
AccountNumber *string `gorm:"size:50"`
|
AccountNumber *string `gorm:"size:50"`
|
||||||
|
BankName *string `gorm:"size:100"`
|
||||||
Balance float64 `gorm:"type:numeric(15,3);default:0"`
|
Balance float64 `gorm:"type:numeric(15,3);default:0"`
|
||||||
DueDate int `gorm:"not null"`
|
DueDate int `gorm:"not null"`
|
||||||
CreatedBy uint `gorm:"not null"`
|
CreatedBy uint `gorm:"not null"`
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ func (s transactionService) GetAll(c *fiber.Ctx, params *validation.Query) ([]en
|
|||||||
if params.Search != "" {
|
if params.Search != "" {
|
||||||
like := "%" + strings.ToLower(strings.TrimSpace(params.Search)) + "%"
|
like := "%" + strings.ToLower(strings.TrimSpace(params.Search)) + "%"
|
||||||
db = db.Where(
|
db = db.Where(
|
||||||
`LOWER(payment_code) LIKE ? OR
|
`(LOWER(payment_code) LIKE ? OR
|
||||||
LOWER(COALESCE(reference_number, '')) LIKE ? OR
|
LOWER(COALESCE(reference_number, '')) LIKE ? OR
|
||||||
LOWER(COALESCE(payment_method, '')) LIKE ? OR
|
LOWER(COALESCE(payment_method, '')) LIKE ? OR
|
||||||
LOWER(COALESCE(transaction_type, '')) LIKE ? OR
|
LOWER(COALESCE(transaction_type, '')) LIKE ? OR
|
||||||
@@ -100,7 +100,7 @@ func (s transactionService) GetAll(c *fiber.Ctx, params *validation.Query) ([]en
|
|||||||
LOWER(COALESCE(suppliers.name, '')) LIKE ? OR
|
LOWER(COALESCE(suppliers.name, '')) LIKE ? OR
|
||||||
LOWER(COALESCE(banks.name, '')) LIKE ? OR
|
LOWER(COALESCE(banks.name, '')) LIKE ? OR
|
||||||
CAST(payments.nominal AS TEXT) LIKE ? OR
|
CAST(payments.nominal AS TEXT) LIKE ? OR
|
||||||
TO_CHAR(payments.payment_date, 'YYYY-MM-DD') LIKE ?`,
|
TO_CHAR(payments.payment_date, 'YYYY-MM-DD') LIKE ?)`,
|
||||||
like, like, like, like, like, like, like, like, like, like,
|
like, like, like, like, like, like, like, like, like, like,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ type CustomerRelationDTO struct {
|
|||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Type string `json:"type"`
|
Type string `json:"type"`
|
||||||
AccountNumber string `json:"account_number"`
|
AccountNumber string `json:"account_number"`
|
||||||
|
BankName string `json:"bank_name"`
|
||||||
Address string `json:"address,omitempty"`
|
Address string `json:"address,omitempty"`
|
||||||
Balance float64 `json:"balance"`
|
Balance float64 `json:"balance"`
|
||||||
Pic *userDTO.UserRelationDTO `json:"pic,omitempty"`
|
Pic *userDTO.UserRelationDTO `json:"pic,omitempty"`
|
||||||
@@ -28,6 +29,7 @@ type CustomerListDTO struct {
|
|||||||
Phone string `json:"phone"`
|
Phone string `json:"phone"`
|
||||||
Email string `json:"email"`
|
Email string `json:"email"`
|
||||||
AccountNumber string `json:"account_number"`
|
AccountNumber string `json:"account_number"`
|
||||||
|
BankName string `json:"bank_name"`
|
||||||
Balance float64 `json:"balance"`
|
Balance float64 `json:"balance"`
|
||||||
Pic userDTO.UserRelationDTO `json:"pic"`
|
Pic userDTO.UserRelationDTO `json:"pic"`
|
||||||
CreatedUser userDTO.UserRelationDTO `json:"created_user"`
|
CreatedUser userDTO.UserRelationDTO `json:"created_user"`
|
||||||
@@ -53,6 +55,7 @@ func ToCustomerRelationDTO(e entity.Customer) CustomerRelationDTO {
|
|||||||
Name: e.Name,
|
Name: e.Name,
|
||||||
Type: e.Type,
|
Type: e.Type,
|
||||||
AccountNumber: e.AccountNumber,
|
AccountNumber: e.AccountNumber,
|
||||||
|
BankName: e.BankName,
|
||||||
Address: e.Address,
|
Address: e.Address,
|
||||||
Balance: e.Balance,
|
Balance: e.Balance,
|
||||||
Pic: pic,
|
Pic: pic,
|
||||||
@@ -81,6 +84,7 @@ func ToCustomerListDTO(e entity.Customer) CustomerListDTO {
|
|||||||
Phone: e.Phone,
|
Phone: e.Phone,
|
||||||
Email: e.Email,
|
Email: e.Email,
|
||||||
AccountNumber: e.AccountNumber,
|
AccountNumber: e.AccountNumber,
|
||||||
|
BankName: e.BankName,
|
||||||
Pic: pic,
|
Pic: pic,
|
||||||
CreatedAt: e.CreatedAt,
|
CreatedAt: e.CreatedAt,
|
||||||
UpdatedAt: e.UpdatedAt,
|
UpdatedAt: e.UpdatedAt,
|
||||||
|
|||||||
@@ -133,6 +133,7 @@ func (s *customerService) CreateOne(c *fiber.Ctx, req *validation.Create) (*enti
|
|||||||
Phone: req.Phone,
|
Phone: req.Phone,
|
||||||
Email: req.Email,
|
Email: req.Email,
|
||||||
AccountNumber: req.AccountNumber,
|
AccountNumber: req.AccountNumber,
|
||||||
|
BankName: req.BankName,
|
||||||
CreatedBy: actorID,
|
CreatedBy: actorID,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -193,6 +194,10 @@ func (s customerService) UpdateOne(c *fiber.Ctx, req *validation.Update, id uint
|
|||||||
updateBody["account_number"] = *req.AccountNumber
|
updateBody["account_number"] = *req.AccountNumber
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if req.BankName != nil {
|
||||||
|
updateBody["bank_name"] = *req.BankName
|
||||||
|
}
|
||||||
|
|
||||||
if len(updateBody) == 0 {
|
if len(updateBody) == 0 {
|
||||||
return s.GetOne(c, id)
|
return s.GetOne(c, id)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ type Create struct {
|
|||||||
Phone string `json:"phone" validate:"required_strict,max=20"`
|
Phone string `json:"phone" validate:"required_strict,max=20"`
|
||||||
Email string `json:"email" validate:"required_strict,email,max=50"`
|
Email string `json:"email" validate:"required_strict,email,max=50"`
|
||||||
AccountNumber string `json:"account_number" validate:"required_strict,max=50"`
|
AccountNumber string `json:"account_number" validate:"required_strict,max=50"`
|
||||||
|
BankName string `json:"bank_name" validate:"required_strict,max=100"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type Update struct {
|
type Update struct {
|
||||||
@@ -18,6 +19,7 @@ type Update struct {
|
|||||||
Phone *string `json:"phone,omitempty" validate:"omitempty,max=20"`
|
Phone *string `json:"phone,omitempty" validate:"omitempty,max=20"`
|
||||||
Email *string `json:"email,omitempty" validate:"omitempty,max=50"`
|
Email *string `json:"email,omitempty" validate:"omitempty,max=50"`
|
||||||
AccountNumber *string `json:"account_number,omitempty" validate:"omitempty,max=50"`
|
AccountNumber *string `json:"account_number,omitempty" validate:"omitempty,max=50"`
|
||||||
|
BankName *string `json:"bank_name,omitempty" validate:"omitempty,max=100"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type Query struct {
|
type Query struct {
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ type SupplierListDTO struct {
|
|||||||
Address string `json:"address"`
|
Address string `json:"address"`
|
||||||
Npwp *string `json:"npwp,omitempty"`
|
Npwp *string `json:"npwp,omitempty"`
|
||||||
AccountNumber *string `json:"account_number,omitempty"`
|
AccountNumber *string `json:"account_number,omitempty"`
|
||||||
|
BankName *string `json:"bank_name,omitempty"`
|
||||||
Balance float64 `json:"balance"`
|
Balance float64 `json:"balance"`
|
||||||
DueDate int `json:"due_date"`
|
DueDate int `json:"due_date"`
|
||||||
CreatedUser *userDTO.UserRelationDTO `json:"created_user"`
|
CreatedUser *userDTO.UserRelationDTO `json:"created_user"`
|
||||||
@@ -66,6 +67,7 @@ func ToSupplierListDTO(e entity.Supplier) SupplierListDTO {
|
|||||||
Address: e.Address,
|
Address: e.Address,
|
||||||
Npwp: e.Npwp,
|
Npwp: e.Npwp,
|
||||||
AccountNumber: e.AccountNumber,
|
AccountNumber: e.AccountNumber,
|
||||||
|
BankName: e.BankName,
|
||||||
Balance: e.Balance,
|
Balance: e.Balance,
|
||||||
DueDate: e.DueDate,
|
DueDate: e.DueDate,
|
||||||
SupplierRelationDTO: ToSupplierRelationDTO(e),
|
SupplierRelationDTO: ToSupplierRelationDTO(e),
|
||||||
|
|||||||
@@ -160,6 +160,7 @@ func (s *supplierService) CreateOne(c *fiber.Ctx, req *validation.Create) (*enti
|
|||||||
Address: req.Address,
|
Address: req.Address,
|
||||||
Npwp: req.Npwp,
|
Npwp: req.Npwp,
|
||||||
AccountNumber: req.AccountNumber,
|
AccountNumber: req.AccountNumber,
|
||||||
|
BankName: req.BankName,
|
||||||
DueDate: req.DueDate,
|
DueDate: req.DueDate,
|
||||||
CreatedBy: actorID,
|
CreatedBy: actorID,
|
||||||
}
|
}
|
||||||
@@ -243,6 +244,10 @@ func (s supplierService) UpdateOne(c *fiber.Ctx, req *validation.Update, id uint
|
|||||||
updateBody["account_number"] = *req.AccountNumber
|
updateBody["account_number"] = *req.AccountNumber
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if req.BankName != nil {
|
||||||
|
updateBody["bank_name"] = *req.BankName
|
||||||
|
}
|
||||||
|
|
||||||
if req.DueDate != nil {
|
if req.DueDate != nil {
|
||||||
updateBody["due_date"] = *req.DueDate
|
updateBody["due_date"] = *req.DueDate
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ type Create struct {
|
|||||||
Address string `json:"address" validate:"required_strict"`
|
Address string `json:"address" validate:"required_strict"`
|
||||||
Npwp *string `json:"npwp,omitempty" validate:"omitempty,max=50"`
|
Npwp *string `json:"npwp,omitempty" validate:"omitempty,max=50"`
|
||||||
AccountNumber *string `json:"account_number,omitempty" validate:"omitempty,max=50"`
|
AccountNumber *string `json:"account_number,omitempty" validate:"omitempty,max=50"`
|
||||||
|
BankName *string `json:"bank_name,omitempty" validate:"omitempty,max=100"`
|
||||||
DueDate int `json:"due_date" validate:"required_strict,number,gt=0"`
|
DueDate int `json:"due_date" validate:"required_strict,number,gt=0"`
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -27,6 +28,7 @@ type Update struct {
|
|||||||
Address *string `json:"address,omitempty" validate:"omitempty"`
|
Address *string `json:"address,omitempty" validate:"omitempty"`
|
||||||
Npwp *string `json:"npwp,omitempty" validate:"omitempty,max=50"`
|
Npwp *string `json:"npwp,omitempty" validate:"omitempty,max=50"`
|
||||||
AccountNumber *string `json:"account_number,omitempty" validate:"omitempty,max=50"`
|
AccountNumber *string `json:"account_number,omitempty" validate:"omitempty,max=50"`
|
||||||
|
BankName *string `json:"bank_name,omitempty" validate:"omitempty,max=100"`
|
||||||
DueDate *int `json:"due_date,omitempty" validate:"omitempty,number,gt=0"`
|
DueDate *int `json:"due_date,omitempty" validate:"omitempty,number,gt=0"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user