Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

task-8 #53

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# compiled output
/dist
/node_modules
.env
.serverless

# Logs
logs
Expand Down
29 changes: 29 additions & 0 deletions db-utils/cart.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
create type cart_status as enum ('OPEN', 'ORDERED');

create table carts (
id uuid primary key not null,
user_id uuid not null,
created_at date not null,
updated_at date not null,
status cart_status not null
);

create table cart_items (
id uuid not null primary key,
cart_id uuid references carts(id),
product_id uuid,
count integer
);


insert into carts (id, user_id, created_at, updated_at, status) values
(gen_random_uuid(), gen_random_uuid(), '2023-11-13', '2023-11-13', 'ORDERED'),
(gen_random_uuid(), gen_random_uuid(), '2023-11-13', '2023-11-13', 'ORDERED'),
(gen_random_uuid(), gen_random_uuid(), '2023-11-13', '2023-11-13', 'OPEN'),
(gen_random_uuid(), gen_random_uuid(), '2023-11-13', '2023-11-13', 'OPEN');

insert into cart_items (id, cart_id, product_id, count) values
(gen_random_uuid(), 'd4a5ce44-825a-11ee-b962-0242ac120002', gen_random_uuid(), 2),
(gen_random_uuid(), 'e3e780b4-825a-11ee-b962-0242ac120002', gen_random_uuid(), 5),
(gen_random_uuid(), 'e904a8a6-825a-11ee-b962-0242ac120002', gen_random_uuid(), 4),
(gen_random_uuid(), 'f821b86a-825a-11ee-b962-0242ac120002', gen_random_uuid(), 18);
Loading