Skip to content

Commit

Permalink
add file Liquibase and fix fe create product
Browse files Browse the repository at this point in the history
  • Loading branch information
dtkhanh committed Oct 23, 2023
1 parent 0f5814d commit 6a38b82
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
10 changes: 8 additions & 2 deletions backoffice/pages/catalog/product-templates/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ const ProductTemplate: NextPage = () => {
};

if (isLoading) return <p>Loading...</p>;
if (!productTemplates) return <p>No Product Templates</p>;
return (
<>
<div className="row mt-5">
Expand All @@ -48,7 +47,12 @@ const ProductTemplate: NextPage = () => {
</Link>
</div>
</div>
<Table striped bordered hover>
{
!productTemplates ?
<p>No Product Templates</p>
:
<>
<Table striped bordered hover>
<thead>
<tr>
<th>Id</th>
Expand Down Expand Up @@ -88,6 +92,8 @@ const ProductTemplate: NextPage = () => {
disabledClassName={'pagination-disabled'}
activeClassName={'pagination-active'}
/>
</>
}
</>
);
};
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
--liquibase formatted sql

--changeset khanhdt:product_template1
insert into product_template (name) values
('Tablet');

--changeset khanhdt:product_template2
insert into product_template (name) values
('Iphone')

--changeset khanhdt:product_template_attribute
insert into product_attribute_template (product_attribute_id, product_template_id, display_order) values
(3, 1, 0),
(6, 2, 0);
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
create table product_template (id bigserial not null, created_by varchar(255), created_on timestamp(6), last_modified_by varchar(255), last_modified_on timestamp(6), name varchar(255), primary key (id));
create table product_attribute_template (id bigserial not null, product_attribute_id bigint not null, product_template_id bigint not null, display_order integer not null,primary key (id));
alter table if exists product_attribute_template add constraint FK_template_atributetemplate foreign key (product_template_id) references product_template;
alter table if exists product_attribute_template add constraint FK_attribute_atributetemplate foreign key (product_attribute_id) references product_attribute;

0 comments on commit 6a38b82

Please sign in to comment.