|
|
|
@@ -15,10 +15,10 @@ const createDelivery = `-- name: CreateDelivery :one
|
|
|
|
|
INSERT INTO deliveries (
|
|
|
|
|
date, pickup_location, pickup_location_2, warehouse_request_source, warehouse_request_source_2, product_name, product_name_2,
|
|
|
|
|
customer_name, address, street, house, apartment, entrance, floor,
|
|
|
|
|
phone, additional_phone, has_elevator, service_info, comment
|
|
|
|
|
phone, additional_phone, has_elevator, payment_status, service_info, comment
|
|
|
|
|
)
|
|
|
|
|
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19)
|
|
|
|
|
RETURNING id, date, pickup_location, product_name, address, phone, additional_phone, has_elevator, comment, status, created_at, updated_at, customer_name, service_info, pickup_location_2, product_name_2, street, house, apartment, entrance, floor, warehouse_request_source, warehouse_request_source_2
|
|
|
|
|
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20)
|
|
|
|
|
RETURNING id, date, pickup_location, product_name, address, phone, additional_phone, has_elevator, comment, status, created_at, updated_at, customer_name, service_info, pickup_location_2, product_name_2, street, house, apartment, entrance, floor, warehouse_request_source, warehouse_request_source_2, payment_status
|
|
|
|
|
`
|
|
|
|
|
|
|
|
|
|
type CreateDeliveryParams struct {
|
|
|
|
@@ -39,6 +39,7 @@ type CreateDeliveryParams struct {
|
|
|
|
|
Phone string `db:"phone" json:"phone"`
|
|
|
|
|
AdditionalPhone pgtype.Text `db:"additional_phone" json:"additional_phone"`
|
|
|
|
|
HasElevator bool `db:"has_elevator" json:"has_elevator"`
|
|
|
|
|
PaymentStatus string `db:"payment_status" json:"payment_status"`
|
|
|
|
|
ServiceInfo pgtype.Text `db:"service_info" json:"service_info"`
|
|
|
|
|
Comment pgtype.Text `db:"comment" json:"comment"`
|
|
|
|
|
}
|
|
|
|
@@ -62,6 +63,7 @@ func (q *Queries) CreateDelivery(ctx context.Context, arg CreateDeliveryParams)
|
|
|
|
|
arg.Phone,
|
|
|
|
|
arg.AdditionalPhone,
|
|
|
|
|
arg.HasElevator,
|
|
|
|
|
arg.PaymentStatus,
|
|
|
|
|
arg.ServiceInfo,
|
|
|
|
|
arg.Comment,
|
|
|
|
|
)
|
|
|
|
@@ -90,6 +92,7 @@ func (q *Queries) CreateDelivery(ctx context.Context, arg CreateDeliveryParams)
|
|
|
|
|
&i.Floor,
|
|
|
|
|
&i.WarehouseRequestSource,
|
|
|
|
|
&i.WarehouseRequestSource2,
|
|
|
|
|
&i.PaymentStatus,
|
|
|
|
|
)
|
|
|
|
|
return i, err
|
|
|
|
|
}
|
|
|
|
@@ -129,7 +132,7 @@ func (q *Queries) DeleteDelivery(ctx context.Context, id pgtype.UUID) error {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const getDeliveriesByDate = `-- name: GetDeliveriesByDate :many
|
|
|
|
|
SELECT id, date, pickup_location, product_name, address, phone, additional_phone, has_elevator, comment, status, created_at, updated_at, customer_name, service_info, pickup_location_2, product_name_2, street, house, apartment, entrance, floor, warehouse_request_source, warehouse_request_source_2 FROM deliveries WHERE date = $1
|
|
|
|
|
SELECT id, date, pickup_location, product_name, address, phone, additional_phone, has_elevator, comment, status, created_at, updated_at, customer_name, service_info, pickup_location_2, product_name_2, street, house, apartment, entrance, floor, warehouse_request_source, warehouse_request_source_2, payment_status FROM deliveries WHERE date = $1
|
|
|
|
|
`
|
|
|
|
|
|
|
|
|
|
func (q *Queries) GetDeliveriesByDate(ctx context.Context, date pgtype.Date) ([]Delivery, error) {
|
|
|
|
@@ -165,6 +168,7 @@ func (q *Queries) GetDeliveriesByDate(ctx context.Context, date pgtype.Date) ([]
|
|
|
|
|
&i.Floor,
|
|
|
|
|
&i.WarehouseRequestSource,
|
|
|
|
|
&i.WarehouseRequestSource2,
|
|
|
|
|
&i.PaymentStatus,
|
|
|
|
|
); err != nil {
|
|
|
|
|
return nil, err
|
|
|
|
|
}
|
|
|
|
@@ -177,7 +181,7 @@ func (q *Queries) GetDeliveriesByDate(ctx context.Context, date pgtype.Date) ([]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const getDeliveryByID = `-- name: GetDeliveryByID :one
|
|
|
|
|
SELECT id, date, pickup_location, product_name, address, phone, additional_phone, has_elevator, comment, status, created_at, updated_at, customer_name, service_info, pickup_location_2, product_name_2, street, house, apartment, entrance, floor, warehouse_request_source, warehouse_request_source_2 FROM deliveries WHERE id = $1
|
|
|
|
|
SELECT id, date, pickup_location, product_name, address, phone, additional_phone, has_elevator, comment, status, created_at, updated_at, customer_name, service_info, pickup_location_2, product_name_2, street, house, apartment, entrance, floor, warehouse_request_source, warehouse_request_source_2, payment_status FROM deliveries WHERE id = $1
|
|
|
|
|
`
|
|
|
|
|
|
|
|
|
|
func (q *Queries) GetDeliveryByID(ctx context.Context, id pgtype.UUID) (Delivery, error) {
|
|
|
|
@@ -207,6 +211,7 @@ func (q *Queries) GetDeliveryByID(ctx context.Context, id pgtype.UUID) (Delivery
|
|
|
|
|
&i.Floor,
|
|
|
|
|
&i.WarehouseRequestSource,
|
|
|
|
|
&i.WarehouseRequestSource2,
|
|
|
|
|
&i.PaymentStatus,
|
|
|
|
|
)
|
|
|
|
|
return i, err
|
|
|
|
|
}
|
|
|
|
@@ -317,10 +322,11 @@ UPDATE deliveries SET
|
|
|
|
|
phone = $15,
|
|
|
|
|
additional_phone = $16,
|
|
|
|
|
has_elevator = $17,
|
|
|
|
|
service_info = $18,
|
|
|
|
|
comment = $19,
|
|
|
|
|
payment_status = $18,
|
|
|
|
|
service_info = $19,
|
|
|
|
|
comment = $20,
|
|
|
|
|
updated_at = NOW()
|
|
|
|
|
WHERE id = $20
|
|
|
|
|
WHERE id = $21
|
|
|
|
|
`
|
|
|
|
|
|
|
|
|
|
type UpdateDeliveryParams struct {
|
|
|
|
@@ -341,6 +347,7 @@ type UpdateDeliveryParams struct {
|
|
|
|
|
Phone string `db:"phone" json:"phone"`
|
|
|
|
|
AdditionalPhone pgtype.Text `db:"additional_phone" json:"additional_phone"`
|
|
|
|
|
HasElevator bool `db:"has_elevator" json:"has_elevator"`
|
|
|
|
|
PaymentStatus string `db:"payment_status" json:"payment_status"`
|
|
|
|
|
ServiceInfo pgtype.Text `db:"service_info" json:"service_info"`
|
|
|
|
|
Comment pgtype.Text `db:"comment" json:"comment"`
|
|
|
|
|
ID pgtype.UUID `db:"id" json:"id"`
|
|
|
|
@@ -365,6 +372,7 @@ func (q *Queries) UpdateDelivery(ctx context.Context, arg UpdateDeliveryParams)
|
|
|
|
|
arg.Phone,
|
|
|
|
|
arg.AdditionalPhone,
|
|
|
|
|
arg.HasElevator,
|
|
|
|
|
arg.PaymentStatus,
|
|
|
|
|
arg.ServiceInfo,
|
|
|
|
|
arg.Comment,
|
|
|
|
|
arg.ID,
|
|
|
|
|