Added create contact ednpoint
This commit is contained in:
@@ -13,7 +13,7 @@ import (
|
||||
)
|
||||
|
||||
|
||||
func GetContracts(status string, companyName string, companyAddress string,
|
||||
func GetContracts(status []string, companyName string, companyAddress string,
|
||||
companyEmail string, companyPhone string, startTime *time.Time, endTime *time.Time,
|
||||
contractName string, deviceIDs []int64, contractID int, dateCreated *time.Time, limit, offset int) ([]models.Contract, int64, int, error) {
|
||||
|
||||
@@ -24,10 +24,10 @@ func GetContracts(status string, companyName string, companyAddress string,
|
||||
// Define custom fields to be selected, varies based on joined tables
|
||||
customFields := "contracts.*, array_length(contracts.device_ids, 1) as number_of_devices"
|
||||
|
||||
// Search by Status
|
||||
if status != "" {
|
||||
db = db.Where("contracts.status = ?", status)
|
||||
countDb = countDb.Where("contracts.status = ?", status)
|
||||
// Search by Statuses
|
||||
if len(status) > 0 {
|
||||
db = db.Where("contracts.status IN (?)", status)
|
||||
countDb = countDb.Where("contracts.status IN (?)", status)
|
||||
}
|
||||
|
||||
// Search by Company Fields
|
||||
|
||||
Reference in New Issue
Block a user