add warehouse_request_source and warehouse_request_source_2 fields to deliveries table with validation and normalization logic
Some checks failed
Build and Push Docker Images / build-backend (push) Has been cancelled
Build and Push Docker Images / build-frontend (push) Has been cancelled

This commit is contained in:
Egor Pozharov
2026-05-04 17:32:03 +06:00
parent f9c54b5172
commit c39bde0b10
13 changed files with 305 additions and 165 deletions

View File

@@ -30,11 +30,11 @@ SELECT * FROM deliveries WHERE date = $1;
-- name: CreateDelivery :one
INSERT INTO deliveries (
date, pickup_location, pickup_location_2, product_name, product_name_2,
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
)
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17)
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19)
RETURNING *;
-- name: GetDeliveryByID :one
@@ -48,22 +48,24 @@ UPDATE deliveries SET
date = $1,
pickup_location = $2,
pickup_location_2 = $3,
product_name = $4,
product_name_2 = $5,
customer_name = $6,
address = $7,
street = $8,
house = $9,
apartment = $10,
entrance = $11,
floor = $12,
phone = $13,
additional_phone = $14,
has_elevator = $15,
service_info = $16,
comment = $17,
warehouse_request_source = $4,
warehouse_request_source_2 = $5,
product_name = $6,
product_name_2 = $7,
customer_name = $8,
address = $9,
street = $10,
house = $11,
apartment = $12,
entrance = $13,
floor = $14,
phone = $15,
additional_phone = $16,
has_elevator = $17,
service_info = $18,
comment = $19,
updated_at = NOW()
WHERE id = $18;
WHERE id = $20;
-- name: GetDeliveryCount :many
SELECT COUNT(*) as count, date FROM deliveries