Files
b2b/i18n/migrations/20260302163100_routes.sql
2026-04-15 12:47:10 +02:00

297 lines
6.9 KiB
SQL

-- +goose Up
-- create routes table
CREATE TABLE IF NOT EXISTS b2b_routes (
id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(255) NOT NULL UNIQUE,
path VARCHAR(255) NULL,
component VARCHAR(255) NOT NULL COMMENT 'path to component file',
meta JSON DEFAULT '{}',
active BOOLEAN DEFAULT TRUE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
INSERT IGNORE INTO `b2b_routes` (`id`, `name`, `path`, `component`, `meta`, `active`) VALUES
(1, 'root', '', '', '{"trans": "route.root"}', 0),
(2, 'home', '', '/views/HomeView.vue', '{"trans": "route.home"}', 1),
(3, 'login', 'login', '/views/LoginView.vue', '{"guest":true}', 1),
(4, 'register', 'register', '/views/RegisterView.vue', '{"guest":true}', 1),
(5, 'password-recovery', 'password-recovery', '/views/PasswordRecoveryView.vue', '{"guest":true}', 1),
(6, 'reset-password', 'reset-password', '/views/ResetPasswordForm.vue', '{"guest":true}', 1),
(7, 'verify-email', 'verify-email', '/views/VerifyEmailView.vue', '{"guest":true}', 1),
(9, 'admin-products-category', 'products/:category_id-:link_rewrite', '/components/admin/PageProducts.vue', '{
"guest":true,
"name": "Products Category"
}', 1),
(10, 'customer-addresses', 'addresses', '/components/customer/PageAddresses.vue', '{
"guest":true,
"name": "Addresses"
}', 1),
(11, 'customer-cart', 'cart/:id', '/components/customer/PageCart.vue', '{
"guest":true,
"name": "Cart"
}', 1),
(12, 'customer-orders', 'orders', '/components/customer/PageOrders.vue', '{
"guest":true,
"name": "Order"
}', 1),
(13, 'customer-statistic', 'statistic', '/components/customer/PageStatistic.vue', '{
"guest":true,
"name": "Statistic"
}
', 1),
(14, 'admin-product-details', 'products/:product_id', '/components/admin/ProductDetailView.vue', '{
"guest":true,
"name": "Products"
}
', 1),
(15, 'admin-products', 'products', '/components/admin/PageProducts.vue', '{
"guest":true,
"name": "Products"
}
', 1),
(16, 'admin-users-list', 'users-list', '/components/admin/UsersList.vue', '{
"guest":true,
"name": "Client List"
}
', 1),
(17, 'customer-management-profile', ':user_id/profile', '/components/customer-management/Profile.vue', '{
"guest":true,
"name": "Profile"
}
', 1),
(18, 'admin-users-search', 'users-search', '/components/admin/UsersSearch.vue', '{
"guest":true,
"name": "Search Clients"
}
', 1),
(19, 'customer-storage-file', 'file-storage', '/components/customer/StorageFileBrowser.vue', '{
"guest":true,
"name": "File Storage"
}', 1),
(20, 'customer-products', 'products', '/components/customer/PageProducts.vue', '{ "guest":true, "name": "Products" }', 1),
(21, 'customer-product-details', 'products/:product_id', '/components/customer/PageProduct.vue', '{ "guest":true, "name": "Products" }', 1),
(22, 'customer-page-carts', 'carts', '/components/customer/PageCarts.vue', '{ "guest":true, "name": "Carts" }', 1);
CREATE TABLE IF NOT EXISTS b2b_top_menu (
menu_id INT AUTO_INCREMENT NOT NULL,
label LONGTEXT NOT NULL DEFAULT '{}',
parent_id INT NULL DEFAULT NULL,
params LONGTEXT NOT NULL DEFAULT '{}',
active TINYINT NOT NULL DEFAULT 1,
position INT NOT NULL DEFAULT 1,
PRIMARY KEY (menu_id),
CONSTRAINT FK_b2b_top_menu_parent_id FOREIGN KEY (parent_id)
REFERENCES b2b_top_menu (menu_id)
ON DELETE RESTRICT ON UPDATE RESTRICT,
INDEX FK_b2b_top_menu_parent_id_idx (parent_id ASC)
) ENGINE = InnoDB;
INSERT IGNORE INTO `b2b_top_menu` (`menu_id`, `label`, `parent_id`, `params`, `active`, `position`) VALUES
(1, '{"name":"root","trans":{"pl":{"label":"Menu główne"},"en":{"label":"Main Menu"},"de":{"label":"Hauptmenü"}}}', NULL, '{}', 1, 1),
(2, '{
"name": "admin-products",
"trans": {
"pl": {
"label": "Products"
},
"en": {
"label": "Products"
},
"de": {
"label": "Products"
}
},
"icon" : "quill:list"
}', 1, '{"route":{"name":"admin-products","params":{"locale":""}}}', 1, 1),
(4, '{
"name": "customer-addresses",
"trans": {
"pl": {
"label": "Addresses"
},
"en": {
"label": "Addresses"
},
"de": {
"label": "Addresses"
}
},
"icon" : "ph:address-book"
}', 1, '{"route":{"name":"customer-addresses","params":{"locale":""}}}', 1, 1),
(5, '{
"name": "customer-orders",
"trans": {
"pl": {
"label": "Orders"
},
"en": {
"label": "Orders"
},
"de": {
"label": "Orders"
}
},
"icon" : "lsicon:order-integral-outline"
}', 1, '{"route":{"name":"customer-orders","params":{"locale":""}}}', 1, 1),
(6, '{
"name": "customer-statistic",
"trans": {
"pl": {
"label": "Statistic"
},
"en": {
"label": "Statistic"
},
"de": {
"label": "Statistic"
}
},
"icon" : "akar-icons:statistic-up"
}', 1, '{
"route": {
"name": "customer-statistic",
"params": {
"locale": ""
}
}
}', 1, 1),
(10, '{
"name": "customer-storage-file",
"trans": {
"pl": {
"label": "File Storage"
},
"en": {
"label": "File Storage"
},
"de": {
"label": "File Storage"
}
},
"icon": "carbon:volume-file-storage"
}', 1, '{
"route": {
"name": "customer-storage-file",
"params": {
"locale": ""
}
}
}', 1, 1),
(12, '{
"name": "admin-users-list",
"trans": {
"pl": {
"label": "Client List"
},
"en": {
"label": "Client List"
},
"de": {
"label": "Client List"
}
},
"icon": "tdesign:user-list"
}', 1, '{
"route": {
"name": "admin-users-list",
"params": {
"locale": ""
}
}
}', 1, 1),
(13, '{
"name": "admin-users-search",
"trans": {
"pl": {
"label": "Search Clients"
},
"en": {
"label": "Search Clients"
},
"de": {
"label": "Search Clients"
}
},
"icon": "material-symbols:search"
}', 1, '{
"route": {
"name": "admin-users-search",
"params": {
"locale": ""
}
}
}', 1, 1),
(14, '{
"name": "customer-management-profile",
"trans": {
"pl": {
"label": "Profile"
},
"en": {
"label": "Profile"
},
"de": {
"label": "Profile"
}
},
"icon": "akar-icons:statistic-up"
}', 1, '{
"route": {
"name": "customer-management-profile",
"params": {
"locale": ""
}
}
}', 1, 1),
(15, '{
"name": "customer-products",
"trans": {
"pl": {
"label": "Products"
},
"en": {
"label": "Products"
},
"de": {
"label": "Products"
}
},
"icon": "akar-icons:statistic-up"
}', 1, '{
"route": {
"name": "customer-products",
"params": {
"locale": ""
}
}
}', 1, 1),
(16, '{
"name": "customer-page-carts",
"trans": {
"pl": {
"label": "Carts"
},
"en": {
"label": "Carts"
},
"de": {
"label": "Carts"
}
},
"icon": "proicons:cart1"
}', 1, '{
"route": {
"name": "customer-page-carts",
"params": {
"locale": ""
}
}
}', 1, 1);
-- +goose Down
DROP TABLE IF EXISTS b2b_routes;
DROP TABLE IF EXISTS b2b_top_menu;
DROP FUNCTION IF EXISTS `slugify_eu`;