https://github.com/GSM-Backend-Dev-Class/Task.1-2

๐Ÿ’ก์š”์•ฝ

โœ… ์š”๊ตฌ์‚ฌํ•ญ

API Sheet


create table member
(
    id           bigint auto_increment
        primary key,
    created_at   timestamp default CURRENT_TIMESTAMP not null,
    updated_at   timestamp default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP,
    address      varchar(255)                        not null,
    email        varchar(255)                        not null,
    is_adult     bit                                 not null,
    name         varchar(255)                        not null,
    password     varchar(255)                        not null,
    phone_number varchar(255)                        not null,
    role         enum ('ROLE_ADMIN', 'ROLE_USER')    not null
);
create table orders
(
    id           bigint auto_increment
        primary key,
    created_at   timestamp default CURRENT_TIMESTAMP                   not null,
    updated_at   timestamp default CURRENT_TIMESTAMP                   not null on update CURRENT_TIMESTAMP,
    address      varchar(255)                                          not null,
    order_number binary(16)                                            not null,
    order_status enum ('CANCELED', 'COMPLETED', 'ORDERED', 'SHIPPING') not null,
    total_price  bigint                                                not null,
    member_id    bigint                                                not null,
    constraint FK1
        foreign key (member_id) references `task-12`.member (id)
);

create table product
(
    id           bigint auto_increment
        primary key,
    created_at   timestamp default CURRENT_TIMESTAMP not null,
    updated_at   timestamp default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP,
    description  varchar(255)                        not null,
    image_url    varchar(255)                        not null,
    price        int                                 not null,
    product_name varchar(255)                        not null,
    stock        int                                 not null
);

create table orders_order_items
(
    order_jpa_entity_id bigint not null,
    order_items_id      bigint not null,
    constraint FK2
        foreign key (order_items_id) references product (id),
    constraint FK3
        foreign key (order_jpa_entity_id) references orders (id)
);

INSERT INTO member (id, name, phone_number, email, password, address, is_adult, role)
VALUES
    (1, '๊น€์ฒ ์ˆ˜', '010-1234-5678', '[email protected]', 'password123', '์„œ์šธ์‹œ ๊ฐ•๋‚จ๊ตฌ', true, 'ROLE_USER'),
    (2, '์ด์˜ํฌ', '010-2345-6789', '[email protected]', 'password123', '๋ถ€์‚ฐ์‹œ ํ•ด์šด๋Œ€๊ตฌ', true, 'ROLE_ADMIN'),
    (3, '๋ฐ•๋ฏผ์ˆ˜', '010-3456-7890', '[email protected]', 'password123', '๋Œ€๊ตฌ์‹œ ์ˆ˜์„ฑ๊ตฌ', true, 'ROLE_USER'),
    (4, '์ตœ์ง€ํ˜„', '010-4567-8901', '[email protected]', 'password123', '์ธ์ฒœ์‹œ ๋‚จ๋™๊ตฌ', true, 'ROLE_USER'),
    (5, '์ •์šฐ์„ฑ', '010-5678-9012', '[email protected]', 'password123', '๊ด‘์ฃผ์‹œ ์„œ๊ตฌ', true, 'ROLE_ADMIN'),
    (6, 'ํ•œ๊ฐ€ํฌ', '010-6789-0123', '[email protected]', 'password123', '๋Œ€์ „์‹œ ์œ ์„ฑ๊ตฌ', false, 'ROLE_USER'),
    (7, '์˜ค์„ธํ›ˆ', '010-7890-1234', '[email protected]', 'password123', '์šธ์‚ฐ์‹œ ๋‚จ๊ตฌ', true, 'ROLE_USER'),
    (8, '๊ฐ•์˜ˆ์ง„', '010-8901-2345', '[email protected]', 'password123', '๊ฒฝ๊ธฐ๋„ ์„ฑ๋‚จ์‹œ', true, 'ROLE_USER');

INSERT INTO product (id, product_name, price, stock, description, image_url)
VALUES
    (1, '๋ฌด์„  ์ด์–ดํฐ', 99000, 50, '๊ณ ์Œ์งˆ ๋ธ”๋ฃจํˆฌ์Šค ๋ฌด์„  ์ด์–ดํฐ', '<https://example.com/earphone.jpg>'),
    (2, '๊ฒŒ์ด๋ฐ ๋งˆ์šฐ์Šค', 45000, 30, 'RGB ์กฐ๋ช… ๊ธฐ๋Šฅ์ด ์žˆ๋Š” ๊ฒŒ์ด๋ฐ ๋งˆ์šฐ์Šค', '<https://example.com/mouse.jpg>'),
    (3, '๊ธฐ๊ณ„์‹ ํ‚ค๋ณด๋“œ', 120000, 20, '์ฒญ์ถ• ๊ธฐ๊ณ„์‹ ํ‚ค๋ณด๋“œ', '<https://example.com/keyboard.jpg>'),
    (4, '์Šค๋งˆํŠธ์›Œ์น˜', 185000, 15, '๊ฑด๊ฐ• ๊ด€๋ฆฌ ๊ธฐ๋Šฅ์ด ํฌํ•จ๋œ ์Šค๋งˆํŠธ์›Œ์น˜', '<https://example.com/smartwatch.jpg>'),
    (5, '๋ชจ๋‹ˆํ„ฐ 27์ธ์น˜', 300000, 10, '๊ณ ํ•ด์ƒ๋„ IPS ํŒจ๋„ ๋ชจ๋‹ˆํ„ฐ', '<https://example.com/monitor.jpg>'),
    (6, '์™ธ์žฅ SSD 1TB', 160000, 25, '์ดˆ๊ณ ์† ์™ธ์žฅ SSD 1TB', '<https://example.com/ssd.jpg>'),
    (7, '๋ฌด์„  ์ถฉ์ „๊ธฐ', 35000, 40, '๊ณ ์† ์ถฉ์ „์„ ์ง€์›ํ•˜๋Š” ๋ฌด์„  ์ถฉ์ „๊ธฐ', '<https://example.com/charger.jpg>'),
    (8, '๋…ธ์ด์ฆˆ ์บ”์Šฌ๋ง ํ—ค๋“œํฐ', 250000, 12, '์•กํ‹ฐ๋ธŒ ๋…ธ์ด์ฆˆ ์บ”์Šฌ๋ง ๊ธฐ๋Šฅ ํƒ‘์žฌ', '<https://example.com/headphone.jpg>');

INSERT INTO orders (id, member_id, order_number, address, total_price, order_status)
VALUES
    (1, 1, UUID_TO_BIN(UUID()), '์„œ์šธ์‹œ ๊ฐ•๋‚จ๊ตฌ', 120000, 'ORDERED'),
    (2, 2, UUID_TO_BIN(UUID()), '๋ถ€์‚ฐ์‹œ ํ•ด์šด๋Œ€๊ตฌ', 250000, 'COMPLETED'),
    (3, 3, UUID_TO_BIN(UUID()), '๋Œ€๊ตฌ์‹œ ์ˆ˜์„ฑ๊ตฌ', 175000, 'SHIPPING'),
    (4, 4, UUID_TO_BIN(UUID()), '์ธ์ฒœ์‹œ ๋‚จ๋™๊ตฌ', 98000, 'CANCELED'),
    (5, 5, UUID_TO_BIN(UUID()), '๊ด‘์ฃผ์‹œ ์„œ๊ตฌ', 220000, 'ORDERED'),
    (6, 6, UUID_TO_BIN(UUID()), '๋Œ€์ „์‹œ ์œ ์„ฑ๊ตฌ', 320000, 'COMPLETED'),
    (7, 7, UUID_TO_BIN(UUID()), '์šธ์‚ฐ์‹œ ๋‚จ๊ตฌ', 145000, 'ORDERED'),
    (8, 8, UUID_TO_BIN(UUID()), '๊ฒฝ๊ธฐ๋„ ์„ฑ๋‚จ์‹œ', 210000, 'SHIPPING');

INSERT INTO orders_order_items (order_jpa_entity_id, order_items_id)
VALUES
    (1, 1), (1, 3), (1, 5),
    (2, 2), (2, 4),
    (3, 3), (3, 6), (3, 7),
    (4, 1), (4, 5),
    (5, 2), (5, 6),
    (6, 4), (6, 7),
    (7, 3), (7, 8),
    (8, 5), (8, 6), (8, 8);