upstream sync
This commit is contained in:
@@ -200,19 +200,21 @@ func CreateContract(c *gin.Context) {
|
||||
db := shared.GetDb()
|
||||
|
||||
newContract := models.Contract{
|
||||
BuyerID: payload.BuyerID,
|
||||
SellerID: payload.SellerID,
|
||||
Description: payload.Description,
|
||||
ProductID: payload.ProductID,
|
||||
MinTemp: payload.MinTemp,
|
||||
MaxTemp: payload.MaxTemp,
|
||||
ArrivalDate: time.Unix(payload.ArrivalDate, 0),
|
||||
PenaltyType: payload.PenaltyRec,
|
||||
PenaltyValue: payload.PenaltyValue,
|
||||
PenaltyRec: payload.PenaltyRec,
|
||||
StartLat: payload.StartLat,
|
||||
StartLon: payload.StartLon,
|
||||
Status: models.ContractStatusDraft,
|
||||
BuyerID: payload.BuyerID,
|
||||
SellerID: payload.SellerID,
|
||||
Description: payload.Description,
|
||||
ProductID: payload.ProductID,
|
||||
MinTemp: payload.MinTemp,
|
||||
MaxTemp: payload.MaxTemp,
|
||||
ArrivalDate: time.Unix(payload.ArrivalDate, 0),
|
||||
PenaltyType: payload.PenaltyType,
|
||||
PenaltyValue: payload.PenaltyValue,
|
||||
PenaltyRec: payload.PenaltyRec,
|
||||
StartLat: payload.StartLat,
|
||||
StartLon: payload.StartLon,
|
||||
Status: models.ContractStatusDraft,
|
||||
StartPlaceName: payload.StartPlaceName,
|
||||
EndPlaceName: payload.EndPlaceName,
|
||||
}
|
||||
|
||||
if err := db.Create(&newContract).Error; err != nil {
|
||||
|
||||
@@ -15,6 +15,7 @@ func GetInvoices(c *gin.Context) {
|
||||
buyerName := c.Query("buyer_name")
|
||||
sortBy := c.Query("sort_by")
|
||||
iDsStr := c.QueryArray("ids[]")
|
||||
status := c.QueryArray("status")
|
||||
|
||||
limit, err := strconv.Atoi(limitStr)
|
||||
if err != nil {
|
||||
@@ -39,7 +40,7 @@ func GetInvoices(c *gin.Context) {
|
||||
invoiceIDs = append(invoiceIDs, id)
|
||||
}
|
||||
|
||||
invoices, total, err := invoice.GetInvoices(buyerName, sortBy, limit, offset, invoiceIDs)
|
||||
invoices, total, err := invoice.GetInvoices(buyerName, sortBy, limit, offset, invoiceIDs, status)
|
||||
if err != nil {
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
|
||||
return
|
||||
@@ -59,7 +60,7 @@ func GetInvoiceByID(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
invoices, _, err := invoice.GetInvoices("", "", 1, 0, []int64{int64(id)})
|
||||
invoices, _, err := invoice.GetInvoices("", "", 1, 0, []int64{int64(id)}, nil)
|
||||
if err != nil {
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user