-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
121 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
export POSTGRES_USER=user | ||
export POSTGRES_USER=root | ||
export POSTGRES_PASSWORD=password | ||
export PGADMIN_EMAIL=admin@admin.com | ||
export PGADMIN_PASSWORD=admin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#!/usr/bin/env sh | ||
|
||
echo -e "Running pre-commit hook - Building and testing project... 🚀\n\n" | ||
echo -e "Running pre-commit hook - Building and testing project... 🚀\n" | ||
|
||
dotnet build | ||
dotnet test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,26 @@ | ||
#!/usr/bin/env sh | ||
|
||
if [ ! -f "$1" ]; then | ||
echo -e "commit message file not found\n\n" | ||
echo -e "commit message file not found\n" | ||
exit 1 | ||
fi | ||
|
||
if ! read -r commit_msg <"$1"; then | ||
echo -e "failed to read commit message\n\n" | ||
echo -e "failed to read commit message\n" | ||
exit 1 | ||
fi | ||
|
||
case "$commit_msg" in | ||
"chore(release):"*) | ||
echo -e "Release commit, skipping linting...\n\n" | ||
echo -e "Release commit, skipping linting...\n" | ||
exit 0 | ||
;; | ||
esac | ||
|
||
if exec </dev/tty; then | ||
echo -e "Running commitizen... 🎁\n\n" | ||
echo -e "Running commitizen... 🎁\n" | ||
node_modules/.bin/cz --hook | ||
else | ||
echo -e "cz not running in a tty, skipping...\n\n" | ||
echo -e "cz not running in a tty, skipping...\n" | ||
true | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,114 @@ | ||
CREATE TABLE IF NOT EXISTS test_table ( | ||
id SERIAL PRIMARY KEY, | ||
name TEXT NOT NULL | ||
CREATE TABLE IF NOT EXISTS client ( | ||
id TEXT PRIMARY KEY DEFAULT gen_random_uuid(), | ||
name TEXT NOT NULL, | ||
last_name TEXT NOT NULL, | ||
phone_number TEXT NOT NULL, | ||
is_active BOOLEAN NOT NULL DEFAULT TRUE, | ||
created_at TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP, | ||
updated_at TIMESTAMPTZ DEFAULT NULL | ||
); | ||
|
||
INSERT INTO test_table (name) VALUES ('some_value'); | ||
CREATE TABLE IF NOT EXISTS transport | ||
( | ||
id TEXT PRIMARY KEY DEFAULT gen_random_uuid(), | ||
name TEXT NOT NULL, | ||
capacity_gr INTEGER NOT NULL, | ||
available_units INTEGER NOT NULL, | ||
is_active BOOLEAN NOT NULL DEFAULT TRUE, | ||
created_at TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP, | ||
updated_at TIMESTAMPTZ DEFAULT NULL | ||
); | ||
|
||
CREATE TABLE IF NOT EXISTS client_order_status ( | ||
id TEXT PRIMARY KEY DEFAULT gen_random_uuid(), | ||
name TEXT NOT NULL, | ||
is_active BOOLEAN NOT NULL DEFAULT TRUE, | ||
created_at TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP, | ||
updated_at TIMESTAMPTZ DEFAULT NULL | ||
); | ||
|
||
CREATE TABLE IF NOT EXISTS product ( | ||
id TEXT PRIMARY KEY DEFAULT gen_random_uuid(), | ||
name TEXT NOT NULL, | ||
weight_gr INTEGER NOT NULL, | ||
is_active BOOLEAN NOT NULL DEFAULT TRUE, | ||
created_at TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP, | ||
updated_at TIMESTAMPTZ DEFAULT NULL | ||
); | ||
|
||
CREATE TABLE IF NOT EXISTS client_order ( | ||
id TEXT PRIMARY KEY DEFAULT gen_random_uuid(), | ||
is_active BOOLEAN NOT NULL DEFAULT TRUE, | ||
created_at TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP, | ||
updated_at TIMESTAMPTZ DEFAULT NULL, | ||
client_id TEXT REFERENCES client(id), | ||
transport_id TEXT REFERENCES transport(id), | ||
order_status_id TEXT REFERENCES client_order_status(id) | ||
); | ||
|
||
CREATE TABLE IF NOT EXISTS delivery_point ( | ||
id TEXT PRIMARY KEY DEFAULT gen_random_uuid(), | ||
latitude DOUBLE PRECISION NOT NULL, | ||
longitude DOUBLE PRECISION NOT NULL, | ||
is_active BOOLEAN NOT NULL DEFAULT TRUE, | ||
created_at TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP, | ||
updated_at TIMESTAMPTZ DEFAULT NULL, | ||
order_id TEXT REFERENCES client_order(id) | ||
); | ||
|
||
CREATE TABLE IF NOT EXISTS client_order_products( | ||
order_id TEXT REFERENCES client_order(id), | ||
product_id TEXT REFERENCES product(id), | ||
quantity INTEGER NOT NULL, | ||
created_at TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP, | ||
updated_at TIMESTAMPTZ DEFAULT NULL, | ||
PRIMARY KEY (order_id, product_id) | ||
); | ||
|
||
INSERT INTO client (id, name, last_name, phone_number) VALUES | ||
('c1d3e678-9b6f-47e1-b0b6-a5f11e7e67a1', 'Carlos', 'Pérez', '789456123'), | ||
('a2b6e412-4b7e-45c9-a78e-58f0e4e54b2d', 'Maria', 'Lopez', '654321987'), | ||
('b3f7d489-5b9f-42ea-bc6b-691d98c983a2', 'Jorge', 'Gonzalez', '321987654'), | ||
('d4e8f594-6c3f-46ea-abc6-792f09d9c8b3', 'Ana', 'Mendoza', '987456321'), | ||
('e5f9g624-7d8e-48ea-bf7b-893fa0e0b9b4', 'Luis', 'Martinez', '123789456'); | ||
|
||
INSERT INTO transport (id, name, capacity_gr, available_units) VALUES | ||
('f1a2b3c4-1234-5678-9101-112131415161', 'Truck - Large', 10000000, 3), | ||
('f2a3b4c5-2234-5678-9201-112131415162', 'Truck - Medium', 7000000, 4), | ||
('f3a4b5c6-3234-5678-9301-112131415163', 'Van', 3500000, 5); | ||
|
||
INSERT INTO client_order_status (id, name) VALUES | ||
('g1h2i3j4-1234-5678-9401-112131415164', 'Pending'), | ||
('g2h3i4j5-2234-5678-9501-112131415165', 'Shipped'), | ||
('g3h4i5j6-3234-5678-9601-112131415166', 'Delivered'), | ||
('g4h5i6j7-4234-5678-9701-112131415167', 'Cancelled'); | ||
|
||
INSERT INTO product (id, name, weight_gr) VALUES | ||
('p1a2b3c4-1234-5678-0801-112131415178', 'Pepsi', 500), | ||
('p2a3b4c5-2234-5678-0901-112131415179', 'Pepsi Black', 500), | ||
('p3a4b5c6-3234-5678-1001-112131415180', 'Guarana', 600), | ||
('p4a5b6c7-4234-5678-1101-112131415181', 'Pacena', 1000), | ||
('p5a6b7c8-5234-5678-1201-112131415182', 'Chicha', 2000), | ||
('p6a7b8c9-6234-5678-1301-112131415183', 'Huari', 1000); | ||
|
||
INSERT INTO client_order (id, client_id, transport_id, order_status_id) VALUES | ||
('h1i2j3k4-1234-5678-9801-112131415168', 'c1d3e678-9b6f-47e1-b0b6-a5f11e7e67a1', 'f1a2b3c4-1234-5678-9101-112131415161', 'g1h2i3j4-1234-5678-9401-112131415164'), | ||
('h2i3j4k5-2234-5678-9901-112131415169', 'a2b6e412-4b7e-45c9-a78e-58f0e4e54b2d', 'f2a3b4c5-2234-5678-9201-112131415162', 'g2h3i4j5-2234-5678-9501-112131415165'), | ||
('h3i4j5k6-3234-5678-0001-112131415170', 'b3f7d489-5b9f-42ea-bc6b-691d98c983a2', 'f3a4b5c6-3234-5678-9301-112131415163', 'g1h2i3j4-1234-5678-9401-112131415164'), | ||
('h4i5j6k7-4234-5678-0101-112131415171', 'd4e8f594-6c3f-46ea-abc6-792f09d9c8b3', 'f1a2b3c4-1234-5678-9101-112131415161', 'g3h4i5j6-3234-5678-9601-112131415166'), | ||
('h5i6j7k8-5234-5678-0201-112131415172', 'e5f9g624-7d8e-48ea-bf7b-893fa0e0b9b4', 'f2a3b4c5-2234-5678-9201-112131415162', 'g2h3i4j5-2234-5678-9501-112131415165'); | ||
|
||
INSERT INTO delivery_point (id, latitude, longitude, order_id) VALUES | ||
('i1j2k3l4-1234-5678-0301-112131415173', -16.500000, -68.150000, 'h1i2j3k4-1234-5678-9801-112131415168'), | ||
('i2j3k4l5-2234-5678-0401-112131415174', -17.393511, -66.145981, 'h2i3j4k5-2234-5678-9901-112131415169'), | ||
('i3j4k5l6-3234-5678-0501-112131415175', -19.033320, -65.262740, 'h3i4j5k6-3234-5678-0001-112131415170'), | ||
('i4j5k6l7-4234-5678-0601-112131415176', -17.783327, -63.182129, 'h4i5j6k7-4234-5678-0101-112131415171'), | ||
('i5j6k7l8-5234-5678-0701-112131415177', -18.478333, -66.486944, 'h5i6j7k8-5234-5678-0201-112131415172'); | ||
|
||
INSERT INTO client_order_products (order_id, product_id, quantity) VALUES | ||
('h1i2j3k4-1234-5678-9801-112131415168', 'p1a2b3c4-1234-5678-0801-112131415178', 200), | ||
('h1i2j3k4-1234-5678-9801-112131415168', 'p2a3b4c5-2234-5678-0901-112131415179', 150), | ||
('h2i3j4k5-2234-5678-9901-112131415169', 'p3a4b5c6-3234-5678-1001-112131415180', 400), | ||
('h3i4j5k6-3234-5678-0001-112131415170', 'p4a5b6c7-4234-5678-1101-112131415181', 300), | ||
('h4i5j6k7-4234-5678-0101-112131415171', 'p5a6b7c8-5234-5678-1201-112131415182', 100), | ||
('h5i6j7k8-5234-5678-0201-112131415172', 'p6a7b8c9-6234-5678-1301-112131415183', 500); |