67 Commits

Author SHA1 Message Date
Daniel Goc
569a805a13 small fix 2026-04-08 13:23:05 +02:00
Daniel Goc
578d8c6cac merged with current main 2026-04-08 13:20:07 +02:00
Daniel Goc
cbd0baaa50 Merge branch 'main' of ssh://git.ma-al.com:8822/goc_daniel/b2b into storage 2026-04-08 13:19:45 +02:00
Daniel Goc
7eee0bd032 rebuilt storage 2026-04-08 13:09:19 +02:00
92ba9c5f07 Merge pull request 'feat: searching on customer list' (#54) from product-procedures into main
Reviewed-on: #54
2026-04-08 07:58:55 +00:00
a121ddc246 Merge branch 'main' into product-procedures 2026-04-07 14:00:27 +00:00
d56650ae5d feat: searching on customer list 2026-04-07 14:42:56 +02:00
1a6311dc3d Merge pull request 'fix: google provider auth' (#53) from product-procedures into main
Reviewed-on: #53
2026-04-07 11:39:08 +00:00
2e645f3368 fix: google provider auth 2026-04-07 13:36:43 +02:00
de3f2d1777 Merge pull request 'product-procedures' (#52) from product-procedures into main
Reviewed-on: #52
Reviewed-by: Marek Goc <goc_marek@ma-al.com>
2026-04-07 08:45:15 +00:00
9187297367 refactor: move lists to their representative repos 2026-04-07 10:32:30 +02:00
813d1f4879 feat: add customer list, modify pagination utils 2026-04-07 09:28:39 +02:00
c5cc4f7a48 Merge branch 'main' of ssh://git.ma-al.com:8822/goc_daniel/b2b into product-procedures 2026-04-03 15:58:40 +02:00
76ca2a2eed chore: adapt code to new teleport feature 2026-04-03 15:58:35 +02:00
84388792f0 Merge pull request 'sanitize and save URL slugs' (#51) from translate_new_field into main
Reviewed-on: #51
Reviewed-by: Arina Yakovenko <yakovenko_arina@ma-al.com>
2026-04-03 13:15:32 +00:00
Daniel Goc
7264a11ba6 sanitize and save URL slugs 2026-04-03 14:58:50 +02:00
61dc240c38 Merge branch 'main' of ssh://git.ma-al.com:8822/goc_daniel/b2b into product-procedures 2026-04-03 14:37:58 +02:00
Daniel Goc
f6b321b602 a few fixes for user teleportation 2026-04-03 13:55:57 +02:00
Daniel Goc
af91842b14 Merge branch 'main' of ssh://git.ma-al.com:8822/goc_daniel/b2b into storage 2026-04-03 13:29:06 +02:00
04e238fd66 Merge pull request 'user_teleport' (#50) from user_teleport into main
Reviewed-on: #50
Reviewed-by: Wiktor Dudzic <dudzic_wiktor@ma-al.com>
2026-04-03 11:27:11 +00:00
Daniel Goc
e0c53c97ba Merge branch 'main' of ssh://git.ma-al.com:8822/goc_daniel/b2b into user_teleport 2026-04-03 13:01:37 +02:00
09a77c14c9 Merge pull request 'add image link (large_default) to product description' (#49) from add_image_link into main
Reviewed-on: #49
Reviewed-by: Wiktor Dudzic <dudzic_wiktor@ma-al.com>
2026-04-03 10:58:21 +00:00
Daniel Goc
c7533a8deb add image link (large_default) to product description 2026-04-03 12:24:05 +02:00
Daniel Goc
1bab7f642f typo 2026-04-03 11:44:15 +02:00
Daniel Goc
a988bbbc33 added copying and moving 2026-04-03 11:25:16 +02:00
701004d005 chore: add bruno endpoints 2026-04-03 09:40:30 +02:00
c31964c41b Merge branch 'main' of ssh://git.ma-al.com:8822/goc_daniel/b2b into product-procedures 2026-04-03 08:42:56 +02:00
0ed9d792b6 feat: roles, permissions 2026-04-02 15:06:00 +02:00
Daniel Goc
395d670298 add storage to .gitignore 2026-04-02 14:00:58 +02:00
Daniel Goc
7d4242abb1 move path to params 2026-04-02 13:52:50 +02:00
Daniel Goc
9c7eb5ee4e Merge branch 'main' of ssh://git.ma-al.com:8822/goc_daniel/b2b into storage 2026-04-02 11:31:39 +02:00
Daniel Goc
833f4a5a07 deleting and uploading files 2026-04-02 11:26:58 +02:00
Daniel Goc
b9bc121d43 getting to upload 2026-04-02 10:27:14 +02:00
Daniel Goc
b2acb8c922 storage 2026-04-01 13:30:54 +02:00
cf4d14a3cb Merge pull request 'front-styles' (#44) from front-styles into main
Reviewed-on: #44
2026-04-01 07:32:26 +00:00
30eb82ba53 fix: categories 2026-04-01 09:10:38 +02:00
a2a2c35ab3 Merge remote-tracking branch 'origin' into front-styles 2026-04-01 09:10:18 +02:00
Daniel Goc
03f04b2f53 Merge branch 'main' of ssh://git.ma-al.com:8822/goc_daniel/b2b into user_teleport 2026-03-31 16:57:44 +02:00
Daniel Goc
55da953f32 add teleporting 2026-03-31 16:56:05 +02:00
684f910090 Merge pull request 'expand_get_menu' (#42) from expand_get_menu into main
Reviewed-on: #42
Reviewed-by: Marek Goc <goc_marek@ma-al.com>
2026-03-31 14:55:35 +00:00
5feaa9e15c Merge remote-tracking branch 'origin/expand_get_menu' into front-styles 2026-03-31 14:34:14 +02:00
Daniel Goc
04e2549a66 missing / in ImageLink 2026-03-31 14:30:47 +02:00
6428ddb527 Merge branch 'main' of ssh://git.ma-al.com:8822/goc_daniel/b2b into product-procedures 2026-03-31 13:42:27 +02:00
fb4f7048ab fix: requests 2026-03-31 12:44:02 +02:00
Daniel Goc
a3f01eca7c misspell fix 2026-03-31 12:27:31 +02:00
Daniel Goc
1fa6206b75 update openapi and add the exists_in_database flag to get-product 2026-03-31 12:00:30 +02:00
Daniel Goc
fa89723eb6 add get-breadcrumb endpoint 2026-03-31 11:40:57 +02:00
Daniel Goc
8665c566ee added new category error, and some fixes 2026-03-31 10:52:36 +02:00
ec5ff123ac Merge pull request 'front-styles' (#38) from front-styles into main
Reviewed-on: #38
2026-03-31 07:30:33 +00:00
17317e778c Merge remote-tracking branch 'origin' into front-styles 2026-03-31 09:19:06 +02:00
94291ccc03 Merge pull request 'improved JWTToken update, added list-users endpoint, debug of getCountries' (#37) from list_users into main
Reviewed-on: #37
Reviewed-by: Marek Goc <goc_marek@ma-al.com>
2026-03-31 07:08:15 +00:00
91c5de1f67 fix: menu and routing 2026-03-30 16:39:14 +02:00
Daniel Goc
d0ce65c287 improved JWTToken update, added list-users endpoint, debug of getCountries 2026-03-30 16:19:26 +02:00
05bfa6e8b8 Merge branch 'main' of ssh://git.ma-al.com:8822/goc_daniel/b2b into product-procedures 2026-03-30 15:17:53 +02:00
68f4850445 'routing, searching, fixes' 2026-03-30 01:04:25 +02:00
9ec329b1d6 fix products listing 2026-03-30 01:02:02 +02:00
f4ad8e02b4 Merge branch 'main' of ssh://git.ma-al.com:8822/goc_daniel/b2b into product-procedures 2026-03-27 08:47:41 +01:00
ec05101037 fix meilisearch 2026-03-27 02:03:26 +01:00
29260080c2 Merge pull request 'fix top menu embeding struct' (#34) from routing into main
Reviewed-on: #34
2026-03-26 17:44:08 +00:00
9336cdfa28 fix top menu embeding struct 2026-03-26 18:43:23 +01:00
bd97ed1a3b feat: creat main products query 2026-03-26 15:59:13 +01:00
396e25b750 Merge pull request 'fix: routing/data table' (#33) from front-styles into main
Reviewed-on: #33
Reviewed-by: Marek Goc <goc_marek@ma-al.com>
2026-03-26 14:57:40 +00:00
df14eb5ae4 Merge branch 'main' of ssh://git.ma-al.com:8822/goc_daniel/b2b into product-procedures 2026-03-26 15:57:21 +01:00
f5d524d45b Merge branch 'main' of ssh://git.ma-al.com:8822/goc_daniel/b2b into product-procedures 2026-03-26 11:46:37 +01:00
78bdac8ff0 Merge branch 'product-procedures' of ssh://git.ma-al.com:8822/goc_daniel/b2b into product-procedures 2026-03-26 10:07:15 +01:00
2c128a4b36 feat: create procedure for retrieving products 2026-03-25 08:38:05 +01:00
dd806bbb1e feat: create procedure for retrieving products 2026-03-19 15:44:42 +01:00
568 changed files with 15259 additions and 4939 deletions

8
.env
View File

@@ -48,6 +48,10 @@ EMAIL_FROM=test@ma-al.com
EMAIL_FROM_NAME=Gitea Manager EMAIL_FROM_NAME=Gitea Manager
EMAIL_ADMIN=goc_marek@ma-al.pl EMAIL_ADMIN=goc_marek@ma-al.pl
# STORAGE
STORAGE_ROOT=./storage
I18N_LANGS=en,pl,cs I18N_LANGS=en,pl,cs
PDF_SERVER_URL=http://localhost:8000 PDF_SERVER_URL=http://localhost:8000
@@ -57,4 +61,6 @@ FILE_MAAL_PL_USER=git_operator
FILE_MAAL_PL_PASSWORD=1FnwqcEgIUjQHjt1 FILE_MAAL_PL_PASSWORD=1FnwqcEgIUjQHjt1
IMAGE_PREFIX=https://www.naluconcept.com # remove prefix to serv them from same host as presta IMAGE_PREFIX=https://www.naluconcept.com # remove prefix to serv them from same host as presta
CORS_ORGIN=https://www.naluconcept.com CORS_ORGIN=https://www.naluconcept.com
DSN=root:Maal12345678@tcp(localhost:3306)/nalu

4
.gitignore vendored
View File

@@ -5,4 +5,6 @@ bin/
i18n/*.json i18n/*.json
*_templ.go *_templ.go
tmp/main tmp/main
test.go test.go
storage/*
!storage/.gitkeep

14
.vscode/launch.json vendored Normal file
View File

@@ -0,0 +1,14 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch Package",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "./app/cmd/main.go",
"cwd": "${workspaceFolder}",
"envFile": "${workspaceFolder}/.env"
}
]
}

View File

@@ -2,7 +2,7 @@
"openapi": "3.0.3", "openapi": "3.0.3",
"info": { "info": {
"title": "b2b API", "title": "b2b API",
"description": "Authentication, user management, and repository time tracking API\n\n## Filter Operators\nAll filter parameters support the following operators by adding a suffix to the parameter name:\n\n| Suffix | Operator | Example |\n|--------|----------|---------|\n| `_eq` | equals | `product_id_eq=12` |\n| `_neq` | not equals | `active_neq=0` |\n| `_gt` | greater than | `price_gt=100` |\n| `_gte` | greater than or equal | `price_gte=10` |\n| `_lt` | less than | `price_lt=500` |\n| `_lte` | less than or equal | `price_lte=500` |\n| `_in` | IN (comma-separated) | `product_id_in=1,2,3,4` |\n\n## Special Filters\n\n| Parameter | Example | Description |\n|-----------|---------|-------------|\n| `name=~text` | `name=~gold` | LIKE search (case-insensitive partial match) |\n| `price=[min,max]` | `price=[100,500]` | BETWEEN range (inclusive) |\n| `sort=field,direction` | `sort=price,desc` | ORDER BY clause (direction: asc/desc, default: desc) |\n| `p` | `p=1` | Page number (1-based, default: 1) |\n| `elems` | `elems=30` | Elements per page (max: 100, default: 30) |", "description": "Authentication, user management, and repository time tracking API\n\n## Filtering\nAll filter parameters support the following operators by adding a suffix to the parameter name:\n\n### Comparison Operators\n\n| Suffix | Operator | Example | Description |\n|--------|----------|---------|-------------|\n| `_eq` | = | `product_id_eq=12` | Equals |\n| `_neq` | != | `active_neq=0` | Not equals |\n| `_gt` | > | `price_gt=100` | Greater than |\n| `_gte` | >= | `price_gte=10` | Greater than or equal |\n| `_lt` | < | `price_lt=500` | Less than |\n| `_lte` | <= | `price_lte=500` | Less than or equal |\n| `_in` | IN | `product_id_in=1,2,3,4` | IN clause (comma-separated values) |\n\n### Special Filters\n\n| Filter | Example | Description |\n|--------|---------|-------------|\n| `~` prefix | `name=~gold` | LIKE search - case-insensitive partial match on string values |\n| `[min,max]` | `price=[100,500]` | BETWEEN range - filters values between min and max (inclusive) |\n| `sort` | `sort=price,desc` | ORDER BY clause - field name and direction (asc/desc, default: desc) |\n| `p` | `p=1` | Page number - 1-based pagination (default: 1) |\n| `elems` | `elems=30` | Elements per page - results per page (max: 100, default: 30) |\n\n### Available Fields for Filtering\n\n**Products (`/api/v1/restricted/list-products/get-listing`):**\n\n| Field | Type | Example |\n|-------|------|---------|\n| `product_id` | integer | `product_id_eq=12`, `product_id_in=1,2,3` |\n| `name` | string | `name=~gold` (LIKE search) |\n| `reference` | string | `reference=ABC123` |\n| `category_name` | string | `category_name=~electronics` |\n| `id_category` | integer | `id_category_eq=5`, `id_category_in=1,2,3` |\n| `quantity` | integer | `quantity_gt=0` |\n| `variants_number` | integer | `variants_number_gte=1` |",
"version": "1.0.0", "version": "1.0.0",
"contact": { "contact": {
"name": "API Support", "name": "API Support",
@@ -42,7 +42,7 @@
}, },
{ {
"name": "Search", "name": "Search",
"description": "MeiliSearch endpoints (under /api/v1/restricted/meili-search, requires authentication)" "description": "MeiliSearch endpoints (under /api/v1/restricted/search, requires authentication)"
}, },
{ {
"name": "Locale", "name": "Locale",
@@ -585,6 +585,35 @@
} }
} }
}, },
"/api/v1/restricted/search/settings": {
"post": {
"tags": ["Search"],
"summary": "Get MeiliSearch settings",
"description": "Returns MeiliSearch index configuration and settings. Requires authentication.",
"operationId": "getMeiliSearchSettings",
"security": [
{
"CookieAuth": [],
"BearerAuth": []
}
],
"responses": {
"200": {
"description": "Settings retrieved successfully"
},
"401": {
"description": "Not authenticated",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
}
}
},
"/api/v1/public/auth/me": { "/api/v1/public/auth/me": {
"get": { "get": {
"tags": ["Auth"], "tags": ["Auth"],
@@ -593,7 +622,8 @@
"operationId": "getMe", "operationId": "getMe",
"security": [ "security": [
{ {
"CookieAuth": [] "CookieAuth": [],
"BearerAuth": []
} }
], ],
"responses": { "responses": {
@@ -633,7 +663,8 @@
"operationId": "updateChoice", "operationId": "updateChoice",
"security": [ "security": [
{ {
"CookieAuth": [] "CookieAuth": [],
"BearerAuth": []
} }
], ],
"responses": { "responses": {
@@ -788,18 +819,19 @@
"get": { "get": {
"tags": ["Products"], "tags": ["Products"],
"summary": "Get product listing", "summary": "Get product listing",
"description": "Returns a paginated list of products with their basic information. Supports filtering via query parameters with operators (e.g., product_id_eq=12, name=~wałek). Use sort parameter for ordering. Requires authentication.", "description": "Returns a paginated list of products with their basic information. Supports filtering via query parameters with operators (e.g., product_id_eq=12, name=~wałek, quantity_gt=0). Use sort parameter for ordering. Requires authentication.\n\n### Filterable Fields\n- `product_id` - Product ID (integer)\n- `name` - Product name (string, supports LIKE with ~ prefix)\n- `reference` - Product reference (string)\n- `category_name` - Category name (string, supports LIKE with ~ prefix)\n- `id_category` - Category ID (integer)\n- `quantity` - Stock quantity (integer)\n- `variants_number` - Number of variants (integer)\n\n### Example Requests\n```\nGET /api/v1/restricted/list-products/get-listing?product_id_eq=12\nGET /api/v1/restricted/list-products/get-listing?name=~wałek&sort=price,asc\nGET /api/v1/restricted/list-products/get-listing?quantity_gt=0&elems=50&p=2\n```",
"operationId": "getProductListing", "operationId": "getProductListing",
"security": [ "security": [
{ {
"CookieAuth": [] "CookieAuth": [],
"BearerAuth": []
} }
], ],
"parameters": [ "parameters": [
{ {
"name": "p", "name": "p",
"in": "query", "in": "query",
"description": "Page number (1-based)", "description": "Page number (1-based, default: 1)",
"required": false, "required": false,
"schema": { "schema": {
"type": "integer", "type": "integer",
@@ -819,66 +851,12 @@
{ {
"name": "sort", "name": "sort",
"in": "query", "in": "query",
"description": "Sort field and direction. Format: field,direction (e.g., 'product_id,desc' or 'name,asc')", "description": "Sort order: field,direction (direction: asc/desc, default: desc). Sortable fields: product_id, name, reference, category_name, id_category, quantity, variants_number",
"required": false, "required": false,
"schema": { "schema": {
"type": "string", "type": "string",
"example": "product_id,desc" "example": "product_id,desc"
} }
},
{
"name": "product_id",
"in": "query",
"description": "Filter by product ID. Use suffix _eq, _gt, _gte, _lt, _lte, _neq, _in for operators.",
"required": false,
"schema": {
"type": "integer"
}
},
{
"name": "name",
"in": "query",
"description": "Filter by product name using LIKE (case-insensitive). Use ~ prefix for partial match (e.g., '~wałek')",
"required": false,
"schema": {
"type": "string"
}
},
{
"name": "reference",
"in": "query",
"description": "Filter by product reference using LIKE (case-insensitive)",
"required": false,
"schema": {
"type": "string"
}
},
{
"name": "id_category",
"in": "query",
"description": "Filter by category ID. Use suffix _eq, _gt, _gte, _lt, _lte, _neq, _in for operators.",
"required": false,
"schema": {
"type": "integer"
}
},
{
"name": "category_name",
"in": "query",
"description": "Filter by category name using LIKE (case-insensitive)",
"required": false,
"schema": {
"type": "string"
}
},
{
"name": "quantity",
"in": "query",
"description": "Filter by quantity. Use suffix _eq, _gt, _gte, _lt, _lte for operators.",
"required": false,
"schema": {
"type": "integer"
}
} }
], ],
"responses": { "responses": {
@@ -923,7 +901,8 @@
"operationId": "getProductDescription", "operationId": "getProductDescription",
"security": [ "security": [
{ {
"CookieAuth": [] "CookieAuth": [],
"BearerAuth": []
} }
], ],
"parameters": [ "parameters": [
@@ -990,7 +969,8 @@
"operationId": "saveProductDescription", "operationId": "saveProductDescription",
"security": [ "security": [
{ {
"CookieAuth": [] "CookieAuth": [],
"BearerAuth": []
} }
], ],
"parameters": [ "parameters": [
@@ -1067,7 +1047,8 @@
"operationId": "translateProductDescription", "operationId": "translateProductDescription",
"security": [ "security": [
{ {
"CookieAuth": [] "CookieAuth": [],
"BearerAuth": []
} }
], ],
"parameters": [ "parameters": [
@@ -1146,20 +1127,32 @@
} }
} }
}, },
"/api/v1/restricted/menu/get-menu": { "/api/v1/restricted/menu/get-category-tree": {
"get": { "get": {
"tags": ["Menu"], "tags": ["Menu"],
"summary": "Get menu structure", "summary": "Get category tree",
"description": "Returns the menu structure for the current language. Requires authentication.", "description": "Returns the category tree rooted at the given category ID for the current language. Requires authentication.",
"operationId": "getMenu", "operationId": "getCategoryTree",
"security": [ "security": [
{ {
"CookieAuth": [] "CookieAuth": [],
"BearerAuth": []
}
],
"parameters": [
{
"name": "root_category_id",
"in": "query",
"description": "Root category ID to build the tree from",
"required": true,
"schema": {
"type": "integer"
}
} }
], ],
"responses": { "responses": {
"200": { "200": {
"description": "Menu retrieved successfully", "description": "Category tree retrieved successfully",
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
@@ -1169,7 +1162,7 @@
} }
}, },
"400": { "400": {
"description": "Invalid request", "description": "Invalid request or root category not found",
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
@@ -1191,17 +1184,78 @@
} }
} }
}, },
"/api/v1/restricted/menu/get-routes": { "/api/v1/restricted/menu/get-breadcrumb": {
"get": {
"tags": ["Menu"],
"summary": "Get breadcrumb",
"description": "Returns the breadcrumb path from the root category to the specified category for the current language. Requires authentication.",
"operationId": "getBreadcrumb",
"security": [
{
"CookieAuth": [],
"BearerAuth": []
}
],
"parameters": [
{
"name": "root_category_id",
"in": "query",
"description": "Root category ID (breadcrumb starting point)",
"required": true,
"schema": {
"type": "integer"
}
},
{
"name": "category_id",
"in": "query",
"description": "Target category ID (breadcrumb destination)",
"required": true,
"schema": {
"type": "integer"
}
}
],
"responses": {
"200": {
"description": "Breadcrumb retrieved successfully",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ApiResponse"
}
}
}
},
"400": {
"description": "Invalid request, category not found, or root never reached",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"401": {
"description": "Not authenticated",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
}
}
},
"/api/v1/public/menu/get-routes": {
"get": { "get": {
"tags": ["Menu"], "tags": ["Menu"],
"summary": "Get routes", "summary": "Get routes",
"description": "Returns the routing structure for the current language. Requires authentication.", "description": "Returns the routing structure for the current language.",
"operationId": "getRoutes", "operationId": "getRoutes",
"security": [
{
"CookieAuth": []
}
],
"responses": { "responses": {
"200": { "200": {
"description": "Routes retrieved successfully", "description": "Routes retrieved successfully",
@@ -1222,16 +1276,6 @@
} }
} }
} }
},
"401": {
"description": "Not authenticated",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
} }
} }
} }
@@ -1244,7 +1288,8 @@
"operationId": "getTopMenu", "operationId": "getTopMenu",
"security": [ "security": [
{ {
"CookieAuth": [] "CookieAuth": [],
"BearerAuth": []
} }
], ],
"responses": { "responses": {
@@ -1253,7 +1298,23 @@
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"$ref": "#/components/schemas/ApiResponse" "type": "object",
"properties": {
"message": {
"type": "string"
},
"items": {
"type": "array",
"items": {
"$ref": "#/components/schemas/B2BTopMenu"
},
"description": "Root menu items with nested children"
},
"count": {
"type": "integer",
"description": "Number of root menu items"
}
}
} }
} }
} }
@@ -1281,81 +1342,35 @@
} }
} }
}, },
"/api/v1/restricted/meili-search/search": { "/api/v1/restricted/search/search": {
"get": { "post": {
"tags": ["Search"], "tags": ["Search"],
"summary": "Search products", "summary": "Search products",
"description": "Searches products using MeiliSearch. Requires authentication.", "description": "Searches products using MeiliSearch. Requires authentication. Request body should contain MeiliSearch search parameters.",
"operationId": "searchProducts", "operationId": "searchProducts",
"security": [ "security": [
{ {
"CookieAuth": [] "CookieAuth": [],
"BearerAuth": []
} }
], ],
"parameters": [ "requestBody": {
{ "required": true,
"name": "query", "content": {
"in": "query", "application/json": {
"description": "Search query string", "schema": {
"required": true, "type": "object",
"schema": { "description": "MeiliSearch search parameters (query, limit, filter, etc.)"
"type": "string"
}
},
{
"name": "limit",
"in": "query",
"description": "Maximum number of results",
"required": true,
"schema": {
"type": "integer",
"format": "uint"
}
},
{
"name": "id_category",
"in": "query",
"description": "Filter by category ID",
"required": false,
"schema": {
"type": "integer",
"format": "uint"
}
},
{
"name": "price_lower_bound",
"in": "query",
"description": "Lower price bound",
"required": false,
"schema": {
"type": "number",
"format": "double"
}
},
{
"name": "price_upper_bound",
"in": "query",
"description": "Upper price bound",
"required": false,
"schema": {
"type": "number",
"format": "double"
}
}
],
"responses": {
"200": {
"description": "Search results retrieved successfully",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ApiResponse"
}
} }
} }
}
},
"responses": {
"200": {
"description": "Search results retrieved successfully"
}, },
"400": { "400": {
"description": "Invalid request parameters", "description": "Invalid request body",
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
@@ -1377,7 +1392,7 @@
} }
} }
}, },
"/api/v1/restricted/meili-search/create-index": { "/api/v1/restricted/search/create-index": {
"get": { "get": {
"tags": ["Search"], "tags": ["Search"],
"summary": "Create search index", "summary": "Create search index",
@@ -1385,7 +1400,8 @@
"operationId": "createSearchIndex", "operationId": "createSearchIndex",
"security": [ "security": [
{ {
"CookieAuth": [] "CookieAuth": [],
"BearerAuth": []
} }
], ],
"responses": { "responses": {
@@ -1422,51 +1438,6 @@
} }
} }
}, },
"/api/v1/restricted/meili-search/test": {
"get": {
"tags": ["Search"],
"summary": "Test MeiliSearch",
"description": "Tests the MeiliSearch search. Must be removed before proper release.",
"operationId": "testMeiliSearch",
"security": [
{
"CookieAuth": []
}
],
"responses": {
"200": {
"description": "MeiliSearch test successful",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ApiResponse"
}
}
}
},
"400": {
"description": "Invalid request",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"401": {
"description": "Not authenticated",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
}
}
},
"/api/v1/restricted/langs-and-countries/get-languages": { "/api/v1/restricted/langs-and-countries/get-languages": {
"get": { "get": {
"tags": ["Locale"], "tags": ["Locale"],
@@ -1475,7 +1446,8 @@
"operationId": "getAvailableLanguages", "operationId": "getAvailableLanguages",
"security": [ "security": [
{ {
"CookieAuth": [] "CookieAuth": [],
"BearerAuth": []
} }
], ],
"responses": { "responses": {
@@ -1520,7 +1492,8 @@
"operationId": "getCountriesAndCurrencies", "operationId": "getCountriesAndCurrencies",
"security": [ "security": [
{ {
"CookieAuth": [] "CookieAuth": [],
"BearerAuth": []
} }
], ],
"responses": { "responses": {
@@ -1565,7 +1538,8 @@
"operationId": "addNewCart", "operationId": "addNewCart",
"security": [ "security": [
{ {
"CookieAuth": [] "CookieAuth": [],
"BearerAuth": []
} }
], ],
"responses": { "responses": {
@@ -1600,7 +1574,8 @@
"operationId": "changeCartName", "operationId": "changeCartName",
"security": [ "security": [
{ {
"CookieAuth": [] "CookieAuth": [],
"BearerAuth": []
} }
], ],
"parameters": [ "parameters": [
@@ -1665,7 +1640,8 @@
"operationId": "retrieveCartsInfo", "operationId": "retrieveCartsInfo",
"security": [ "security": [
{ {
"CookieAuth": [] "CookieAuth": [],
"BearerAuth": []
} }
], ],
"responses": { "responses": {
@@ -1700,7 +1676,8 @@
"operationId": "retrieveCart", "operationId": "retrieveCart",
"security": [ "security": [
{ {
"CookieAuth": [] "CookieAuth": [],
"BearerAuth": []
} }
], ],
"parameters": [ "parameters": [
@@ -1756,7 +1733,8 @@
"operationId": "addProductToCart", "operationId": "addProductToCart",
"security": [ "security": [
{ {
"CookieAuth": [] "CookieAuth": [],
"BearerAuth": []
} }
], ],
"parameters": [ "parameters": [
@@ -2110,46 +2088,6 @@
} }
} }
}, },
"MenuItem": {
"type": "object",
"description": "Menu item structure",
"properties": {
"category_id": {
"type": "integer",
"format": "uint",
"description": "Category ID"
},
"label": {
"type": "string",
"description": "Menu item label"
},
"params": {
"$ref": "#/components/schemas/MenuItemParams"
},
"children": {
"type": "array",
"items": {
"$ref": "#/components/schemas/MenuItem"
},
"description": "Child menu items"
}
}
},
"MenuItemParams": {
"type": "object",
"properties": {
"category_id": {
"type": "integer",
"format": "uint"
},
"link_rewrite": {
"type": "string"
},
"locale": {
"type": "string"
}
}
},
"Route": { "Route": {
"type": "object", "type": "object",
"description": "Application route", "description": "Application route",
@@ -2453,6 +2391,58 @@
"description": "Build date in RFC3339 format" "description": "Build date in RFC3339 format"
} }
} }
},
"CategoryInBreadcrumb": {
"type": "object",
"description": "A single item in a category breadcrumb path",
"properties": {
"category_id": {
"type": "integer",
"format": "uint",
"description": "Category ID"
},
"name": {
"type": "string",
"description": "Category name"
}
}
},
"B2BTopMenu": {
"type": "object",
"description": "Top-level menu item for B2B back-office",
"properties": {
"menu_id": {
"type": "integer",
"description": "Menu item ID"
},
"label": {
"type": "object",
"description": "Menu label as JSON (multilingual, e.g. {\"en\": \"Dashboard\", \"pl\": \"Panel\"})"
},
"parent_id": {
"type": "integer",
"description": "Parent menu ID (null for root items)"
},
"params": {
"type": "object",
"description": "Menu item parameters as JSON"
},
"active": {
"type": "integer",
"description": "Active status (1 = active, 0 = inactive)"
},
"position": {
"type": "integer",
"description": "Sort position"
},
"children": {
"type": "array",
"items": {
"$ref": "#/components/schemas/B2BTopMenu"
},
"description": "Child menu items"
}
}
} }
}, },
"securitySchemes": { "securitySchemes": {

View File

@@ -2,8 +2,10 @@ package config
import ( import (
"fmt" "fmt"
"log"
"log/slog" "log/slog"
"os" "os"
"path/filepath"
"reflect" "reflect"
"strconv" "strconv"
"strings" "strings"
@@ -24,6 +26,8 @@ type Config struct {
GoogleTranslate GoogleTranslateConfig GoogleTranslate GoogleTranslateConfig
Image ImageConfig Image ImageConfig
Cors CorsConfig Cors CorsConfig
MeiliSearch MeiliSearchConfig
Storage StorageConfig
} }
type I18n struct { type I18n struct {
@@ -38,6 +42,11 @@ type CorsConfig struct {
Origins []string `env:"CORS_ORGIN"` Origins []string `env:"CORS_ORGIN"`
} }
type MeiliSearchConfig struct {
ServerURL string `env:"MEILISEARCH_URL"`
ApiKey string `env:"MEILISEARCH_API_KEY"`
}
type ImageConfig struct { type ImageConfig struct {
ImagePrefix string `env:"IMAGE_PREFIX"` ImagePrefix string `env:"IMAGE_PREFIX"`
} }
@@ -89,6 +98,10 @@ type EmailConfig struct {
Enabled bool `env:"EMAIL_ENABLED,false"` Enabled bool `env:"EMAIL_ENABLED,false"`
} }
type StorageConfig struct {
RootFolder string `env:"STORAGE_ROOT"`
}
type PdfPrinter struct { type PdfPrinter struct {
ServerUrl string `env:"PDF_SERVER_URL,http://localhost:8000"` ServerUrl string `env:"PDF_SERVER_URL,http://localhost:8000"`
} }
@@ -149,7 +162,7 @@ func load() *Config {
err = loadEnv(&cfg.OAuth.Google) err = loadEnv(&cfg.OAuth.Google)
if err != nil { if err != nil {
slog.Error("not possible to load env variables for outh google : ", err.Error(), "") slog.Error("not possible to load env variables for oauth google : ", err.Error(), "")
} }
err = loadEnv(&cfg.App) err = loadEnv(&cfg.App)
@@ -164,12 +177,12 @@ func load() *Config {
err = loadEnv(&cfg.I18n) err = loadEnv(&cfg.I18n)
if err != nil { if err != nil {
slog.Error("not possible to load env variables for email : ", err.Error(), "") slog.Error("not possible to load env variables for i18n : ", err.Error(), "")
} }
err = loadEnv(&cfg.Pdf) err = loadEnv(&cfg.Pdf)
if err != nil { if err != nil {
slog.Error("not possible to load env variables for email : ", err.Error(), "") slog.Error("not possible to load env variables for pdf : ", err.Error(), "")
} }
err = loadEnv(&cfg.GoogleTranslate) err = loadEnv(&cfg.GoogleTranslate)
@@ -179,13 +192,25 @@ func load() *Config {
err = loadEnv(&cfg.Image) err = loadEnv(&cfg.Image)
if err != nil { if err != nil {
slog.Error("not possible to load env variables for google translate : ", err.Error(), "") slog.Error("not possible to load env variables for image : ", err.Error(), "")
} }
err = loadEnv(&cfg.Cors) err = loadEnv(&cfg.Cors)
if err != nil { if err != nil {
slog.Error("not possible to load env variables for google translate : ", err.Error(), "") slog.Error("not possible to load env variables for cors : ", err.Error(), "")
} }
err = loadEnv(&cfg.MeiliSearch)
if err != nil {
slog.Error("not possible to load env variables for meili search : ", err.Error(), "")
}
err = loadEnv(&cfg.Storage)
if err != nil {
slog.Error("not possible to load env variables for storage : ", err.Error(), "")
}
cfg.Storage.RootFolder = ResolveRelativePath(cfg.Storage.RootFolder)
return cfg return cfg
} }
@@ -296,6 +321,22 @@ func setValue(field reflect.Value, val string, key string) error {
return nil return nil
} }
func ResolveRelativePath(relativePath string) string {
// get working directory (where program was started)
wd, err := os.Getwd()
if err != nil {
log.Fatal(err)
}
// convert to absolute path
absPath := relativePath
if !filepath.IsAbs(absPath) {
absPath = filepath.Join(wd, absPath)
}
return filepath.Clean(absPath)
}
func parseEnvTag(tag string) (key string, def *string) { func parseEnvTag(tag string) (key string, def *string) {
if tag == "" { if tag == "" {
return "", nil return "", nil

View File

@@ -7,6 +7,7 @@ import (
"git.ma-al.com/goc_daniel/b2b/app/config" "git.ma-al.com/goc_daniel/b2b/app/config"
extraClausePlugin "github.com/WinterYukky/gorm-extra-clause-plugin"
"gorm.io/driver/mysql" "gorm.io/driver/mysql"
"gorm.io/gorm" "gorm.io/gorm"
"gorm.io/gorm/logger" "gorm.io/gorm/logger"
@@ -52,7 +53,10 @@ func newMySQLDB(cfg *config.DatabaseConfig) (*gorm.DB, error) {
sqlDB.SetConnMaxLifetime(cfg.ConnMaxLifetime) sqlDB.SetConnMaxLifetime(cfg.ConnMaxLifetime)
log.Println("✓ Database connection established successfully") log.Println("✓ Database connection established successfully")
err = db.Use(extraClausePlugin.New())
if err != nil {
panic(err)
}
return db, nil return db, nil
} }

View File

@@ -1,11 +1,16 @@
package middleware package middleware
import ( import (
"encoding/base64"
"strconv"
"strings" "strings"
"time"
"git.ma-al.com/goc_daniel/b2b/app/config" "git.ma-al.com/goc_daniel/b2b/app/config"
"git.ma-al.com/goc_daniel/b2b/app/model" "git.ma-al.com/goc_daniel/b2b/app/model"
"git.ma-al.com/goc_daniel/b2b/app/service/authService" "git.ma-al.com/goc_daniel/b2b/app/service/authService"
constdata "git.ma-al.com/goc_daniel/b2b/app/utils/const_data"
"git.ma-al.com/goc_daniel/b2b/app/utils/localeExtractor"
"github.com/gofiber/fiber/v3" "github.com/gofiber/fiber/v3"
) )
@@ -59,9 +64,52 @@ func AuthMiddleware() fiber.Handler {
}) })
} }
// Set user in context // Create locale. LangID is overwritten by auth Token
c.Locals("user", user.ToSession()) var userLocale model.UserLocale
c.Locals("userID", user.ID) userLocale.OriginalUser = user
// Check if target user is present
targetUserIDAttribute := c.Query("target_user_id")
if targetUserIDAttribute == "" {
userLocale.User = user
c.Locals(constdata.USER_LOCALE, &userLocale)
return c.Next()
}
// We now populate the target user
if model.CustomerRole(user.Role.Name) != model.RoleAdmin {
return c.Status(fiber.StatusForbidden).JSON(fiber.Map{
"error": "admin access required",
})
}
targetUserID, err := strconv.Atoi(targetUserIDAttribute)
if err != nil {
return c.Status(fiber.StatusInternalServerError).JSON(fiber.Map{
"error": "invalid target user id attribute",
})
}
// to verify target user, we use the same functionality as for verifying original user
// Get target user from database
user, err = authService.GetUserByID(uint(targetUserID))
if err != nil {
return c.Status(fiber.StatusUnauthorized).JSON(fiber.Map{
"error": "target user not found",
})
}
// Check if target user is active
if !user.IsActive {
return c.Status(fiber.StatusForbidden).JSON(fiber.Map{
"error": "target user account is inactive",
})
}
userLocale.User = user
c.Locals(constdata.USER_LOCALE, &userLocale)
return c.Next() return c.Next()
} }
@@ -70,21 +118,14 @@ func AuthMiddleware() fiber.Handler {
// RequireAdmin creates admin-only middleware // RequireAdmin creates admin-only middleware
func RequireAdmin() fiber.Handler { func RequireAdmin() fiber.Handler {
return func(c fiber.Ctx) error { return func(c fiber.Ctx) error {
user := c.Locals("user") originalUserRole, ok := localeExtractor.GetOriginalUserRole(c)
if user == nil { if !ok {
return c.Status(fiber.StatusUnauthorized).JSON(fiber.Map{ return c.Status(fiber.StatusUnauthorized).JSON(fiber.Map{
"error": "not authenticated", "error": "not authenticated",
}) })
} }
userSession, ok := user.(*model.UserSession) if model.CustomerRole(originalUserRole.Name) != model.RoleAdmin {
if !ok {
return c.Status(fiber.StatusInternalServerError).JSON(fiber.Map{
"error": "invalid user session",
})
}
if userSession.Role != model.RoleAdmin {
return c.Status(fiber.StatusForbidden).JSON(fiber.Map{ return c.Status(fiber.StatusForbidden).JSON(fiber.Map{
"error": "admin access required", "error": "admin access required",
}) })
@@ -94,22 +135,70 @@ func RequireAdmin() fiber.Handler {
} }
} }
// GetUserID extracts user ID from context // Webdav
func GetUserID(c fiber.Ctx) uint { func Webdav() fiber.Handler {
userID, ok := c.Locals("userID").(uint) authService := authService.NewAuthService()
if !ok {
return 0
}
return userID
}
// GetUser extracts user from context return func(c fiber.Ctx) error {
func GetUser(c fiber.Ctx) *model.UserSession { authHeader := c.Get("Authorization")
user, ok := c.Locals("user").(*model.UserSession) if authHeader == "" {
if !ok { c.Set("WWW-Authenticate", `Basic realm="webdav"`)
return nil return c.Status(fiber.StatusUnauthorized).JSON(fiber.Map{
"error": "authorization token required",
})
}
if !strings.HasPrefix(authHeader, "Basic ") {
c.Set("WWW-Authenticate", `Basic realm="webdav"`)
return c.Status(fiber.StatusUnauthorized).JSON(fiber.Map{
"error": "invalid authorization token",
})
}
encoded := strings.TrimPrefix(authHeader, "Basic ")
decoded, err := base64.StdEncoding.DecodeString(encoded)
if err != nil {
c.Set("WWW-Authenticate", `Basic realm="webdav"`)
return c.Status(fiber.StatusUnauthorized).JSON(fiber.Map{
"error": "invalid authorization token",
})
}
credentials := strings.SplitN(string(decoded), ":", 2)
rawToken := ""
if len(credentials) == 1 {
rawToken = credentials[0]
} else if len(credentials) == 2 {
rawToken = credentials[1]
}
if len(rawToken) != constdata.NBYTES_IN_WEBDAV_TOKEN*2 {
c.Set("WWW-Authenticate", `Basic realm="webdav"`)
return c.Status(fiber.StatusUnauthorized).JSON(fiber.Map{
"error": "invalid authorization token",
})
}
// we identify user based on this token.
user, err := authService.GetUserByWebdavToken(rawToken)
if err != nil {
return c.Status(fiber.StatusUnauthorized).JSON(fiber.Map{
"error": "user not found",
})
}
if user.WebdavExpires != nil && user.WebdavExpires.Before(time.Now()) {
return c.Status(fiber.StatusUnauthorized).JSON(fiber.Map{
"error": "invalid or expired token",
})
}
var userLocale model.UserLocale
userLocale.OriginalUser = user
userLocale.User = user
c.Locals(constdata.USER_LOCALE, &userLocale)
return c.Next()
} }
return user
} }
// GetConfig returns the app config // GetConfig returns the app config

View File

@@ -4,7 +4,9 @@ import (
"strconv" "strconv"
"strings" "strings"
"git.ma-al.com/goc_daniel/b2b/app/model"
"git.ma-al.com/goc_daniel/b2b/app/service/langsService" "git.ma-al.com/goc_daniel/b2b/app/service/langsService"
constdata "git.ma-al.com/goc_daniel/b2b/app/utils/const_data"
"github.com/gofiber/fiber/v3" "github.com/gofiber/fiber/v3"
) )
@@ -22,12 +24,8 @@ func LanguageMiddleware() fiber.Handler {
if id, err := strconv.ParseUint(langIDStr, 10, 32); err == nil { if id, err := strconv.ParseUint(langIDStr, 10, 32); err == nil {
langID = uint(id) langID = uint(id)
if langID > 0 { if langID > 0 {
lang, err := langService.GetLanguageById(langID) c.Locals(constdata.USER_LOCALE, returnNewLocale(langID))
if err == nil { return c.Next()
c.Locals("langID", langID)
c.Locals("lang", lang)
return c.Next()
}
} }
} }
} }
@@ -38,12 +36,8 @@ func LanguageMiddleware() fiber.Handler {
if id, err := strconv.ParseUint(cookieLang, 10, 32); err == nil { if id, err := strconv.ParseUint(cookieLang, 10, 32); err == nil {
langID = uint(id) langID = uint(id)
if langID > 0 { if langID > 0 {
lang, err := langService.GetLanguageById(langID) c.Locals(constdata.USER_LOCALE, returnNewLocale(langID))
if err == nil { return c.Next()
c.Locals("langID", langID)
c.Locals("lang", lang)
return c.Next()
}
} }
} }
} }
@@ -57,8 +51,7 @@ func LanguageMiddleware() fiber.Handler {
lang, err := langService.GetLanguageByISOCode(isoCode) lang, err := langService.GetLanguageByISOCode(isoCode)
if err == nil && lang != nil { if err == nil && lang != nil {
langID = uint(lang.ID) langID = uint(lang.ID)
c.Locals("langID", langID) c.Locals(constdata.USER_LOCALE, returnNewLocale(langID))
c.Locals("lang", lang)
return c.Next() return c.Next()
} }
} }
@@ -68,8 +61,7 @@ func LanguageMiddleware() fiber.Handler {
defaultLang, err := langService.GetDefaultLanguage() defaultLang, err := langService.GetDefaultLanguage()
if err == nil && defaultLang != nil { if err == nil && defaultLang != nil {
langID = uint(defaultLang.ID) langID = uint(defaultLang.ID)
c.Locals("langID", langID) c.Locals(constdata.USER_LOCALE, returnNewLocale(langID))
c.Locals("lang", defaultLang)
} }
return c.Next() return c.Next()
@@ -104,11 +96,9 @@ func parseAcceptLanguage(header string) string {
return strings.ToLower(first) return strings.ToLower(first)
} }
// GetLanguageID extracts language ID from context func returnNewLocale(lang_id uint) *model.UserLocale {
func GetLanguageID(c fiber.Ctx) uint { newLocale := model.UserLocale{}
langID, ok := c.Locals("langID").(uint) newLocale.OriginalUser = &model.Customer{}
if !ok { newLocale.OriginalUser.LangID = lang_id
return 0 return &newLocale
}
return langID
} }

View File

@@ -0,0 +1,28 @@
package middleware
import (
"git.ma-al.com/goc_daniel/b2b/app/delivery/middleware/perms"
"git.ma-al.com/goc_daniel/b2b/app/model"
"github.com/gofiber/fiber/v3"
)
func Require(p perms.Permission) fiber.Handler {
return func(c fiber.Ctx) error {
u := c.Locals("user")
if u == nil {
return c.SendStatus(fiber.StatusUnauthorized)
}
user, ok := u.(*model.UserSession)
if !ok {
return c.SendStatus(fiber.StatusInternalServerError)
}
for _, perm := range user.Permissions {
if perm == p {
return c.Next()
}
}
return c.SendStatus(fiber.StatusForbidden)
}
}

View File

@@ -0,0 +1,10 @@
package perms
type Permission string
const (
UserReadAny Permission = "user.read.any"
UserWriteAny Permission = "user.write.any"
UserDeleteAny Permission = "user.delete.any"
CurrencyWrite Permission = "currency.write"
)

View File

@@ -2,13 +2,17 @@ package public
import ( import (
"log" "log"
"strconv"
"time" "time"
"git.ma-al.com/goc_daniel/b2b/app/config" "git.ma-al.com/goc_daniel/b2b/app/config"
"git.ma-al.com/goc_daniel/b2b/app/delivery/middleware" "git.ma-al.com/goc_daniel/b2b/app/delivery/middleware"
"git.ma-al.com/goc_daniel/b2b/app/model" "git.ma-al.com/goc_daniel/b2b/app/model"
"git.ma-al.com/goc_daniel/b2b/app/service/authService" "git.ma-al.com/goc_daniel/b2b/app/service/authService"
constdata "git.ma-al.com/goc_daniel/b2b/app/utils/const_data"
"git.ma-al.com/goc_daniel/b2b/app/utils/i18n" "git.ma-al.com/goc_daniel/b2b/app/utils/i18n"
"git.ma-al.com/goc_daniel/b2b/app/utils/nullable"
"git.ma-al.com/goc_daniel/b2b/app/utils/response"
"git.ma-al.com/goc_daniel/b2b/app/utils/responseErrors" "git.ma-al.com/goc_daniel/b2b/app/utils/responseErrors"
"github.com/gofiber/fiber/v3" "github.com/gofiber/fiber/v3"
@@ -264,15 +268,15 @@ func (h *AuthHandler) RefreshToken(c fiber.Ctx) error {
// Me returns the current user info // Me returns the current user info
func (h *AuthHandler) Me(c fiber.Ctx) error { func (h *AuthHandler) Me(c fiber.Ctx) error {
user := c.Locals("user") userLocale := c.Locals(constdata.USER_LOCALE).(*model.UserLocale)
if user == nil { if userLocale.OriginalUser == nil {
return c.Status(fiber.StatusUnauthorized).JSON(fiber.Map{ return c.Status(fiber.StatusUnauthorized).JSON(fiber.Map{
"error": responseErrors.GetErrorCode(c, responseErrors.ErrNotAuthenticated), "error": responseErrors.GetErrorCode(c, responseErrors.ErrNotAuthenticated),
}) })
} }
return c.JSON(fiber.Map{ return c.JSON(fiber.Map{
"user": user, "user": *userLocale.OriginalUser,
}) })
} }
@@ -345,9 +349,49 @@ func (h *AuthHandler) CompleteRegistration(c fiber.Ctx) error {
return c.Status(fiber.StatusCreated).JSON(response) return c.Status(fiber.StatusCreated).JSON(response)
} }
// Updates JWT Tokens // Updates JWT Tokens. Requires authentication and updates access token only
func (h *AuthHandler) UpdateJWTToken(c fiber.Ctx) error { func (h *AuthHandler) UpdateJWTToken(c fiber.Ctx) error {
return h.authService.UpdateJWTToken(c) userLocale, ok := c.Locals(constdata.USER_LOCALE).(*model.UserLocale)
if !ok {
return c.Status(fiber.StatusUnauthorized).
JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, responseErrors.ErrNotAuthenticated)))
}
// Parse language and country_id from query params
langIDStr := c.Query("lang_id")
if langIDStr != "" {
parsedID, err := strconv.ParseUint(langIDStr, 10, 32)
if err != nil {
return c.Status(fiber.StatusBadRequest).
JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, responseErrors.ErrBadLangID)))
}
userLocale.OriginalUser.LangID = uint(parsedID)
}
countryIDStr := c.Query("country_id")
if countryIDStr != "" {
parsedID, err := strconv.ParseUint(countryIDStr, 10, 32)
if err != nil {
return c.Status(fiber.StatusBadRequest).
JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, responseErrors.ErrBadCountryID)))
}
userLocale.OriginalUser.CountryID = uint(parsedID)
}
newAccessToken, err := h.authService.UpdateJWTToken(userLocale.OriginalUser)
if err != nil {
return c.Status(responseErrors.GetErrorStatus(err)).JSON(fiber.Map{
"error": responseErrors.GetErrorCode(c, err),
})
}
// does not reset refresh token
h.setAuthCookies(c, newAccessToken, "")
return c.JSON(response.Make(&fiber.Map{"token": newAccessToken}, 0, i18n.T_(c, response.Message_OK)))
} }
// GoogleLogin redirects the user to Google's OAuth2 consent page // GoogleLogin redirects the user to Google's OAuth2 consent page
@@ -414,12 +458,12 @@ func (h *AuthHandler) GoogleCallback(c fiber.Ctx) error {
// Redirect to the locale-prefixed charts page after successful Google login. // Redirect to the locale-prefixed charts page after successful Google login.
// The user's preferred language is stored in the auth response; fall back to "en". // The user's preferred language is stored in the auth response; fall back to "en".
lang, err := h.authService.GetLangISOCode(response.User.LangID) lang_iso_code, err := h.authService.GetLangISOCode(response.User.LangID)
if err != nil { if err != nil {
return c.Status(responseErrors.GetErrorStatus(responseErrors.ErrBadLangID)).JSON(fiber.Map{ return c.Status(responseErrors.GetErrorStatus(err)).JSON(fiber.Map{
"error": responseErrors.GetErrorCode(c, responseErrors.ErrBadLangID), "error": responseErrors.GetErrorCode(c, err),
}) })
} }
return c.Redirect().To(h.config.App.BaseURL + "/" + lang) return c.Redirect().To(h.config.App.BaseURL + "/" + lang_iso_code)
} }

View File

@@ -0,0 +1,46 @@
package public
import (
"git.ma-al.com/goc_daniel/b2b/app/service/menuService"
"git.ma-al.com/goc_daniel/b2b/app/utils/i18n"
"git.ma-al.com/goc_daniel/b2b/app/utils/localeExtractor"
"git.ma-al.com/goc_daniel/b2b/app/utils/nullable"
"git.ma-al.com/goc_daniel/b2b/app/utils/response"
"git.ma-al.com/goc_daniel/b2b/app/utils/responseErrors"
"github.com/gofiber/fiber/v3"
)
type RoutingHandler struct {
menuService *menuService.MenuService
}
func NewRoutingHandler() *RoutingHandler {
menuService := menuService.New()
return &RoutingHandler{
menuService: menuService,
}
}
// AuthHandlerRoutes registers all auth routes
func RoutingHandlerRoutes(r fiber.Router) fiber.Router {
handler := NewRoutingHandler()
r.Get("/get-routes", handler.GetRouting)
return r
}
func (h *RoutingHandler) GetRouting(c fiber.Ctx) error {
lang_id, ok := localeExtractor.GetLangID(c)
if !ok {
return c.Status(responseErrors.GetErrorStatus(responseErrors.ErrBadAttribute)).
JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, responseErrors.ErrBadAttribute)))
}
menu, err := h.menuService.GetRoutes(lang_id)
if err != nil {
return c.Status(responseErrors.GetErrorStatus(err)).
JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, err)))
}
return c.JSON(response.Make(&menu, 0, i18n.T_(c, response.Message_OK)))
}

View File

@@ -5,6 +5,7 @@ import (
"git.ma-al.com/goc_daniel/b2b/app/service/cartsService" "git.ma-al.com/goc_daniel/b2b/app/service/cartsService"
"git.ma-al.com/goc_daniel/b2b/app/utils/i18n" "git.ma-al.com/goc_daniel/b2b/app/utils/i18n"
"git.ma-al.com/goc_daniel/b2b/app/utils/localeExtractor"
"git.ma-al.com/goc_daniel/b2b/app/utils/nullable" "git.ma-al.com/goc_daniel/b2b/app/utils/nullable"
"git.ma-al.com/goc_daniel/b2b/app/utils/response" "git.ma-al.com/goc_daniel/b2b/app/utils/response"
"git.ma-al.com/goc_daniel/b2b/app/utils/responseErrors" "git.ma-al.com/goc_daniel/b2b/app/utils/responseErrors"
@@ -37,7 +38,7 @@ func CartsHandlerRoutes(r fiber.Router) fiber.Router {
} }
func (h *CartsHandler) AddNewCart(c fiber.Ctx) error { func (h *CartsHandler) AddNewCart(c fiber.Ctx) error {
userID, ok := c.Locals("userID").(uint) userID, ok := localeExtractor.GetUserID(c)
if !ok { if !ok {
return c.Status(responseErrors.GetErrorStatus(responseErrors.ErrInvalidBody)). return c.Status(responseErrors.GetErrorStatus(responseErrors.ErrInvalidBody)).
JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, responseErrors.ErrInvalidBody))) JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, responseErrors.ErrInvalidBody)))
@@ -53,7 +54,7 @@ func (h *CartsHandler) AddNewCart(c fiber.Ctx) error {
} }
func (h *CartsHandler) ChangeCartName(c fiber.Ctx) error { func (h *CartsHandler) ChangeCartName(c fiber.Ctx) error {
userID, ok := c.Locals("userID").(uint) userID, ok := localeExtractor.GetUserID(c)
if !ok { if !ok {
return c.Status(responseErrors.GetErrorStatus(responseErrors.ErrInvalidBody)). return c.Status(responseErrors.GetErrorStatus(responseErrors.ErrInvalidBody)).
JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, responseErrors.ErrInvalidBody))) JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, responseErrors.ErrInvalidBody)))
@@ -78,7 +79,7 @@ func (h *CartsHandler) ChangeCartName(c fiber.Ctx) error {
} }
func (h *CartsHandler) RetrieveCartsInfo(c fiber.Ctx) error { func (h *CartsHandler) RetrieveCartsInfo(c fiber.Ctx) error {
userID, ok := c.Locals("userID").(uint) userID, ok := localeExtractor.GetUserID(c)
if !ok { if !ok {
return c.Status(responseErrors.GetErrorStatus(responseErrors.ErrInvalidBody)). return c.Status(responseErrors.GetErrorStatus(responseErrors.ErrInvalidBody)).
JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, responseErrors.ErrInvalidBody))) JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, responseErrors.ErrInvalidBody)))
@@ -94,7 +95,7 @@ func (h *CartsHandler) RetrieveCartsInfo(c fiber.Ctx) error {
} }
func (h *CartsHandler) RetrieveCart(c fiber.Ctx) error { func (h *CartsHandler) RetrieveCart(c fiber.Ctx) error {
userID, ok := c.Locals("userID").(uint) userID, ok := localeExtractor.GetUserID(c)
if !ok { if !ok {
return c.Status(responseErrors.GetErrorStatus(responseErrors.ErrInvalidBody)). return c.Status(responseErrors.GetErrorStatus(responseErrors.ErrInvalidBody)).
JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, responseErrors.ErrInvalidBody))) JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, responseErrors.ErrInvalidBody)))
@@ -117,7 +118,7 @@ func (h *CartsHandler) RetrieveCart(c fiber.Ctx) error {
} }
func (h *CartsHandler) AddProduct(c fiber.Ctx) error { func (h *CartsHandler) AddProduct(c fiber.Ctx) error {
userID, ok := c.Locals("userID").(uint) userID, ok := localeExtractor.GetUserID(c)
if !ok { if !ok {
return c.Status(responseErrors.GetErrorStatus(responseErrors.ErrInvalidBody)). return c.Status(responseErrors.GetErrorStatus(responseErrors.ErrInvalidBody)).
JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, responseErrors.ErrInvalidBody))) JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, responseErrors.ErrInvalidBody)))

View File

@@ -0,0 +1,70 @@
package restricted
import (
"strconv"
"git.ma-al.com/goc_daniel/b2b/app/config"
"git.ma-al.com/goc_daniel/b2b/app/delivery/middleware"
"git.ma-al.com/goc_daniel/b2b/app/delivery/middleware/perms"
"git.ma-al.com/goc_daniel/b2b/app/model"
"git.ma-al.com/goc_daniel/b2b/app/service/currencyService"
"git.ma-al.com/goc_daniel/b2b/app/utils/i18n"
"git.ma-al.com/goc_daniel/b2b/app/utils/nullable"
"git.ma-al.com/goc_daniel/b2b/app/utils/response"
"git.ma-al.com/goc_daniel/b2b/app/utils/responseErrors"
"github.com/gofiber/fiber/v3"
)
type CurrencyHandler struct {
CurrencyService *currencyService.CurrencyService
config *config.Config
}
func NewCurrencyHandler() *CurrencyHandler {
currencyService := currencyService.New()
return &CurrencyHandler{
CurrencyService: currencyService,
config: config.Get(),
}
}
func CurrencyHandlerRoutes(r fiber.Router) fiber.Router {
handler := NewCurrencyHandler()
r.Post("/currency-rate", middleware.Require(perms.CurrencyWrite), handler.PostCurrencyRate)
r.Get("/currency-rate/:id", handler.GetCurrencyRate)
return r
}
func (h *CurrencyHandler) PostCurrencyRate(c fiber.Ctx) error {
var currencyRate model.CurrencyRate
if err := c.Bind().Body(&currencyRate); err != nil {
return c.Status(responseErrors.GetErrorStatus(responseErrors.ErrJSONBody)).
JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, responseErrors.ErrJSONBody)))
}
err := h.CurrencyService.CreateCurrencyRate(&currencyRate)
if err != nil {
return c.Status(responseErrors.GetErrorStatus(err)).
JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, err)))
}
return c.JSON(response.Make(nullable.GetNil(""), 1, i18n.T_(c, response.Message_OK)))
}
func (h *CurrencyHandler) GetCurrencyRate(c fiber.Ctx) error {
idStr := c.Params("id")
id, err := strconv.Atoi(idStr)
if err != nil {
return c.Status(responseErrors.GetErrorStatus(err)).JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, err)))
}
currency, err := h.CurrencyService.GetCurrency(uint(id))
if err != nil {
return c.Status(responseErrors.GetErrorStatus(err)).JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, err)))
}
return c.JSON(response.Make(currency, 0, i18n.T_(c, response.Message_OK)))
}

View File

@@ -0,0 +1,111 @@
package restricted
import (
"strconv"
"git.ma-al.com/goc_daniel/b2b/app/delivery/middleware/perms"
"git.ma-al.com/goc_daniel/b2b/app/model"
"git.ma-al.com/goc_daniel/b2b/app/service/customerService"
"git.ma-al.com/goc_daniel/b2b/app/utils/i18n"
"git.ma-al.com/goc_daniel/b2b/app/utils/localeExtractor"
"git.ma-al.com/goc_daniel/b2b/app/utils/nullable"
"git.ma-al.com/goc_daniel/b2b/app/utils/query/query_params"
"git.ma-al.com/goc_daniel/b2b/app/utils/response"
"git.ma-al.com/goc_daniel/b2b/app/utils/responseErrors"
"github.com/gofiber/fiber/v3"
)
type customerHandler struct {
service *customerService.CustomerService
}
func NewCustomerHandler() *customerHandler {
customerService := customerService.New()
return &customerHandler{
service: customerService,
}
}
func CustomerHandlerRoutes(r fiber.Router) fiber.Router {
handler := NewCustomerHandler()
r.Get("", handler.customerData)
r.Get("/list", handler.listCustomers)
return r
}
func (h *customerHandler) customerData(fc fiber.Ctx) error {
var customerId uint
user, ok := localeExtractor.GetCustomer(fc)
if !ok || user == nil {
return fc.Status(responseErrors.GetErrorStatus(responseErrors.ErrBadAttribute)).
JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(fc, responseErrors.ErrBadAttribute)))
}
customerIdStr := fc.Query("id")
if customerIdStr != "" {
id, err := strconv.ParseUint(customerIdStr, 10, 64)
if err != nil {
return fiber.ErrBadRequest
}
if user.ID != uint(id) && !user.HasPermission(perms.UserReadAny) {
return fc.Status(fiber.StatusForbidden).
JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(fc, responseErrors.ErrForbidden)))
}
customerId = uint(id)
} else {
customerId = user.ID
}
customer, err := h.service.GetById(customerId)
if err != nil {
return fc.Status(responseErrors.GetErrorStatus(err)).
JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(fc, err)))
}
return fc.JSON(response.Make(&customer, 0, i18n.T_(fc, response.Message_OK)))
}
func (h *customerHandler) listCustomers(fc fiber.Ctx) error {
user, ok := localeExtractor.GetCustomer(fc)
if !ok || user == nil {
return fc.Status(responseErrors.GetErrorStatus(responseErrors.ErrBadAttribute)).
JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(fc, responseErrors.ErrBadAttribute)))
}
if !user.HasPermission(perms.UserReadAny) {
return fc.Status(fiber.StatusForbidden).
JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(fc, responseErrors.ErrForbidden)))
}
p, filt, err := query_params.ParseFilters[model.Customer](fc, columnMappingListUsers)
if err != nil {
return fc.Status(responseErrors.GetErrorStatus(err)).
JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(fc, err)))
}
search := fc.Query("search")
if search != "" {
if !user.HasPermission(perms.UserReadAny) {
return fc.Status(fiber.StatusForbidden).
JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(fc, responseErrors.ErrForbidden)))
}
}
customer, err := h.service.Find(user.LangID, p, filt, search)
if err != nil {
return fc.Status(responseErrors.GetErrorStatus(err)).
JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(fc, err)))
}
return fc.JSON(response.Make(&customer, 0, i18n.T_(fc, response.Message_OK)))
}
var columnMappingListUsers map[string]string = map[string]string{
"user_id": "users.id",
"email": "users.email",
"first_name": "users.first_name",
"last_name": "users.last_name",
}

View File

@@ -1,67 +0,0 @@
package restricted
import (
"git.ma-al.com/goc_daniel/b2b/app/config"
"git.ma-al.com/goc_daniel/b2b/app/model"
"git.ma-al.com/goc_daniel/b2b/app/service/listProductsService"
"git.ma-al.com/goc_daniel/b2b/app/utils/i18n"
"git.ma-al.com/goc_daniel/b2b/app/utils/nullable"
"git.ma-al.com/goc_daniel/b2b/app/utils/query/query_params"
"git.ma-al.com/goc_daniel/b2b/app/utils/response"
"git.ma-al.com/goc_daniel/b2b/app/utils/responseErrors"
"github.com/gofiber/fiber/v3"
)
// ListProductsHandler handles endpoints that receive, save and translate product descriptions.
type ListProductsHandler struct {
listProductsService *listProductsService.ListProductsService
config *config.Config
}
// NewListProductsHandler creates a new ListProductsHandler instance
func NewListProductsHandler() *ListProductsHandler {
listProductsService := listProductsService.New()
return &ListProductsHandler{
listProductsService: listProductsService,
config: config.Get(),
}
}
func ListProductsHandlerRoutes(r fiber.Router) fiber.Router {
handler := NewListProductsHandler()
r.Get("/get-listing", handler.GetListing)
return r
}
func (h *ListProductsHandler) GetListing(c fiber.Ctx) error {
paging, filters, err := query_params.ParseFilters[model.Product](c, columnMappingGetListing)
if err != nil {
return c.Status(responseErrors.GetErrorStatus(err)).
JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, err)))
}
id_lang, ok := c.Locals("langID").(uint)
if !ok {
return c.Status(responseErrors.GetErrorStatus(responseErrors.ErrBadAttribute)).
JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, responseErrors.ErrBadAttribute)))
}
listing, err := h.listProductsService.GetListing(id_lang, paging, filters)
if err != nil {
return c.Status(responseErrors.GetErrorStatus(err)).
JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, err)))
}
return c.JSON(response.Make(&listing.Items, int(listing.Count), i18n.T_(c, response.Message_OK)))
}
var columnMappingGetListing map[string]string = map[string]string{
"product_id": "ps.id_product",
"name": "pl.name",
"reference": "ps.reference",
"category_name": "cl.name",
"id_category": "cp.id_category",
"quantity": "sa.quantity",
}

View File

@@ -1,8 +1,11 @@
package restricted package restricted
import ( import (
"strconv"
"git.ma-al.com/goc_daniel/b2b/app/service/menuService" "git.ma-al.com/goc_daniel/b2b/app/service/menuService"
"git.ma-al.com/goc_daniel/b2b/app/utils/i18n" "git.ma-al.com/goc_daniel/b2b/app/utils/i18n"
"git.ma-al.com/goc_daniel/b2b/app/utils/localeExtractor"
"git.ma-al.com/goc_daniel/b2b/app/utils/nullable" "git.ma-al.com/goc_daniel/b2b/app/utils/nullable"
"git.ma-al.com/goc_daniel/b2b/app/utils/response" "git.ma-al.com/goc_daniel/b2b/app/utils/response"
"git.ma-al.com/goc_daniel/b2b/app/utils/responseErrors" "git.ma-al.com/goc_daniel/b2b/app/utils/responseErrors"
@@ -23,50 +26,73 @@ func NewMenuHandler() *MenuHandler {
func MenuHandlerRoutes(r fiber.Router) fiber.Router { func MenuHandlerRoutes(r fiber.Router) fiber.Router {
handler := NewMenuHandler() handler := NewMenuHandler()
r.Get("/get-menu", handler.GetMenu) r.Get("/get-category-tree", handler.GetCategoryTree)
r.Get("/get-routes", handler.GetRouting) r.Get("/get-breadcrumb", handler.GetBreadcrumb)
r.Get("/get-top-menu", handler.GetTopMenu) r.Get("/get-top-menu", handler.GetTopMenu)
return r return r
} }
func (h *MenuHandler) GetMenu(c fiber.Ctx) error { func (h *MenuHandler) GetCategoryTree(c fiber.Ctx) error {
lang_id, ok := c.Locals("langID").(uint) lang_id, ok := localeExtractor.GetLangID(c)
if !ok { if !ok {
return c.Status(responseErrors.GetErrorStatus(responseErrors.ErrBadAttribute)). return c.Status(responseErrors.GetErrorStatus(responseErrors.ErrBadAttribute)).
JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, responseErrors.ErrBadAttribute))) JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, responseErrors.ErrBadAttribute)))
} }
menu, err := h.menuService.GetMenu(lang_id)
root_category_id_attribute := c.Query("root_category_id")
root_category_id, err := strconv.Atoi(root_category_id_attribute)
if err != nil {
return c.Status(responseErrors.GetErrorStatus(responseErrors.ErrBadAttribute)).
JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, responseErrors.ErrBadAttribute)))
}
category_tree, err := h.menuService.GetCategoryTree(uint(root_category_id), lang_id)
if err != nil { if err != nil {
return c.Status(responseErrors.GetErrorStatus(err)). return c.Status(responseErrors.GetErrorStatus(err)).
JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, err))) JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, err)))
} }
return c.JSON(response.Make(&menu, 0, i18n.T_(c, response.Message_OK))) return c.JSON(response.Make(&category_tree, 0, i18n.T_(c, response.Message_OK)))
} }
func (h *MenuHandler) GetRouting(c fiber.Ctx) error { func (h *MenuHandler) GetBreadcrumb(c fiber.Ctx) error {
lang_id, ok := c.Locals("langID").(uint) lang_id, ok := localeExtractor.GetLangID(c)
if !ok { if !ok {
return c.Status(responseErrors.GetErrorStatus(responseErrors.ErrBadAttribute)). return c.Status(responseErrors.GetErrorStatus(responseErrors.ErrBadAttribute)).
JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, responseErrors.ErrBadAttribute))) JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, responseErrors.ErrBadAttribute)))
} }
menu, err := h.menuService.GetRoutes(lang_id)
root_category_id_attribute := c.Query("root_category_id")
root_category_id, err := strconv.Atoi(root_category_id_attribute)
if err != nil {
return c.Status(responseErrors.GetErrorStatus(responseErrors.ErrBadAttribute)).
JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, responseErrors.ErrBadAttribute)))
}
category_id_attribute := c.Query("category_id")
category_id, err := strconv.Atoi(category_id_attribute)
if err != nil {
return c.Status(responseErrors.GetErrorStatus(responseErrors.ErrBadAttribute)).
JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, responseErrors.ErrBadAttribute)))
}
breadcrumb, err := h.menuService.GetBreadcrumb(uint(root_category_id), uint(category_id), lang_id)
if err != nil { if err != nil {
return c.Status(responseErrors.GetErrorStatus(err)). return c.Status(responseErrors.GetErrorStatus(err)).
JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, err))) JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, err)))
} }
return c.JSON(response.Make(&menu, 0, i18n.T_(c, response.Message_OK))) return c.JSON(response.Make(&breadcrumb, 0, i18n.T_(c, response.Message_OK)))
} }
func (h *MenuHandler) GetTopMenu(c fiber.Ctx) error { func (h *MenuHandler) GetTopMenu(c fiber.Ctx) error {
lang_id, ok := c.Locals("langID").(uint) customer, ok := localeExtractor.GetCustomer(c)
if !ok { if !ok || customer == nil {
return c.Status(responseErrors.GetErrorStatus(responseErrors.ErrBadAttribute)). return c.Status(responseErrors.GetErrorStatus(responseErrors.ErrBadAttribute)).
JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, responseErrors.ErrBadAttribute))) JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, responseErrors.ErrBadAttribute)))
} }
menu, err := h.menuService.GetTopMenu(lang_id) menu, err := h.menuService.GetTopMenu(customer.LangID, customer.RoleID)
if err != nil { if err != nil {
return c.Status(responseErrors.GetErrorStatus(err)). return c.Status(responseErrors.GetErrorStatus(err)).
JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, err))) JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, err)))

View File

@@ -0,0 +1,109 @@
package restricted
import (
"strconv"
"git.ma-al.com/goc_daniel/b2b/app/config"
"git.ma-al.com/goc_daniel/b2b/app/model"
"git.ma-al.com/goc_daniel/b2b/app/service/productService"
"git.ma-al.com/goc_daniel/b2b/app/utils/i18n"
"git.ma-al.com/goc_daniel/b2b/app/utils/localeExtractor"
"git.ma-al.com/goc_daniel/b2b/app/utils/nullable"
"git.ma-al.com/goc_daniel/b2b/app/utils/query/query_params"
"git.ma-al.com/goc_daniel/b2b/app/utils/response"
"git.ma-al.com/goc_daniel/b2b/app/utils/responseErrors"
"github.com/gofiber/fiber/v3"
)
type ProductsHandler struct {
productService *productService.ProductService
config *config.Config
}
// NewListProductsHandler creates a new ListProductsHandler instance
func NewProductsHandler() *ProductsHandler {
productService := productService.New()
return &ProductsHandler{
productService: productService,
config: config.Get(),
}
}
func ProductsHandlerRoutes(r fiber.Router) fiber.Router {
handler := NewProductsHandler()
r.Get("/:id/:country_id/:quantity", handler.GetProductJson)
r.Get("/list", handler.ListProducts)
return r
}
func (h *ProductsHandler) GetProductJson(c fiber.Ctx) error {
idStr := c.Params("id")
p_id_product, err := strconv.Atoi(idStr)
if err != nil {
return c.Status(responseErrors.GetErrorStatus(err)).
JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, err)))
}
country_idStr := c.Params("country_id")
b2b_id_country, err := strconv.Atoi(country_idStr)
if err != nil {
return c.Status(responseErrors.GetErrorStatus(err)).
JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, err)))
}
quantityStr := c.Params("quantity")
p_quantity, err := strconv.Atoi(quantityStr)
if err != nil {
return c.Status(responseErrors.GetErrorStatus(err)).
JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, err)))
}
customer, ok := localeExtractor.GetCustomer(c)
if !ok || customer == nil {
return c.Status(responseErrors.GetErrorStatus(responseErrors.ErrBadAttribute)).
JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, responseErrors.ErrBadAttribute)))
}
productJson, err := h.productService.GetJSON(p_id_product, int(customer.LangID), int(customer.ID), b2b_id_country, p_quantity)
if err != nil {
return c.Status(responseErrors.GetErrorStatus(err)).
JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, err)))
}
return c.JSON(response.Make(&productJson, 1, i18n.T_(c, response.Message_OK)))
}
func (h *ProductsHandler) ListProducts(c fiber.Ctx) error {
paging, filters, err := query_params.ParseFilters[model.Product](c, columnMappingListProducts)
if err != nil {
return c.Status(responseErrors.GetErrorStatus(err)).
JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, err)))
}
id_lang, ok := localeExtractor.GetLangID(c)
if !ok {
return c.Status(responseErrors.GetErrorStatus(responseErrors.ErrBadAttribute)).
JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, responseErrors.ErrBadAttribute)))
}
list, err := h.productService.Find(id_lang, paging, filters)
if err != nil {
return c.Status(responseErrors.GetErrorStatus(err)).
JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, err)))
}
return c.JSON(response.Make(&list.Items, int(list.Count), i18n.T_(c, response.Message_OK)))
}
var columnMappingListProducts map[string]string = map[string]string{
"product_id": "ps.id_product",
"name": "pl.name",
"reference": "p.reference",
"category_name": "cl.name",
"category_id": "cp.id_category",
"quantity": "sa.quantity",
}

View File

@@ -4,8 +4,10 @@ import (
"strconv" "strconv"
"git.ma-al.com/goc_daniel/b2b/app/config" "git.ma-al.com/goc_daniel/b2b/app/config"
"git.ma-al.com/goc_daniel/b2b/app/model"
"git.ma-al.com/goc_daniel/b2b/app/service/productTranslationService" "git.ma-al.com/goc_daniel/b2b/app/service/productTranslationService"
"git.ma-al.com/goc_daniel/b2b/app/utils/i18n" "git.ma-al.com/goc_daniel/b2b/app/utils/i18n"
"git.ma-al.com/goc_daniel/b2b/app/utils/localeExtractor"
"git.ma-al.com/goc_daniel/b2b/app/utils/nullable" "git.ma-al.com/goc_daniel/b2b/app/utils/nullable"
"git.ma-al.com/goc_daniel/b2b/app/utils/response" "git.ma-al.com/goc_daniel/b2b/app/utils/response"
"git.ma-al.com/goc_daniel/b2b/app/utils/responseErrors" "git.ma-al.com/goc_daniel/b2b/app/utils/responseErrors"
@@ -41,7 +43,7 @@ func ProductTranslationHandlerRoutes(r fiber.Router) fiber.Router {
// GetProductDescription returns the product description for a given product ID // GetProductDescription returns the product description for a given product ID
func (h *ProductTranslationHandler) GetProductDescription(c fiber.Ctx) error { func (h *ProductTranslationHandler) GetProductDescription(c fiber.Ctx) error {
userID, ok := c.Locals("userID").(uint) userID, ok := localeExtractor.GetUserID(c)
if !ok { if !ok {
return c.Status(responseErrors.GetErrorStatus(responseErrors.ErrInvalidBody)). return c.Status(responseErrors.GetErrorStatus(responseErrors.ErrInvalidBody)).
JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, responseErrors.ErrInvalidBody))) JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, responseErrors.ErrInvalidBody)))
@@ -72,12 +74,18 @@ func (h *ProductTranslationHandler) GetProductDescription(c fiber.Ctx) error {
// SaveProductDescription saves the description for a given product ID, in given language // SaveProductDescription saves the description for a given product ID, in given language
func (h *ProductTranslationHandler) SaveProductDescription(c fiber.Ctx) error { func (h *ProductTranslationHandler) SaveProductDescription(c fiber.Ctx) error {
userID, ok := c.Locals("userID").(uint) userID, ok := localeExtractor.GetUserID(c)
if !ok { if !ok {
return c.Status(responseErrors.GetErrorStatus(responseErrors.ErrInvalidBody)). return c.Status(responseErrors.GetErrorStatus(responseErrors.ErrInvalidBody)).
JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, responseErrors.ErrInvalidBody))) JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, responseErrors.ErrInvalidBody)))
} }
userRole, ok := localeExtractor.GetOriginalUserRole(c)
if !ok || model.CustomerRole(userRole.Name) != model.RoleAdmin {
return c.Status(responseErrors.GetErrorStatus(responseErrors.ErrAdminAccessRequired)).
JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, responseErrors.ErrAdminAccessRequired)))
}
productID_attribute := c.Query("productID") productID_attribute := c.Query("productID")
productID, err := strconv.Atoi(productID_attribute) productID, err := strconv.Atoi(productID_attribute)
if err != nil { if err != nil {
@@ -109,12 +117,18 @@ func (h *ProductTranslationHandler) SaveProductDescription(c fiber.Ctx) error {
// TranslateProductDescription returns translated product description // TranslateProductDescription returns translated product description
func (h *ProductTranslationHandler) TranslateProductDescription(c fiber.Ctx) error { func (h *ProductTranslationHandler) TranslateProductDescription(c fiber.Ctx) error {
userID, ok := c.Locals("userID").(uint) userID, ok := localeExtractor.GetUserID(c)
if !ok { if !ok {
return c.Status(responseErrors.GetErrorStatus(responseErrors.ErrInvalidBody)). return c.Status(responseErrors.GetErrorStatus(responseErrors.ErrInvalidBody)).
JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, responseErrors.ErrInvalidBody))) JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, responseErrors.ErrInvalidBody)))
} }
userRole, ok := localeExtractor.GetOriginalUserRole(c)
if !ok || model.CustomerRole(userRole.Name) != model.RoleAdmin {
return c.Status(responseErrors.GetErrorStatus(responseErrors.ErrAdminAccessRequired)).
JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, responseErrors.ErrAdminAccessRequired)))
}
productID_attribute := c.Query("productID") productID_attribute := c.Query("productID")
productID, err := strconv.Atoi(productID_attribute) productID, err := strconv.Atoi(productID_attribute)
if err != nil { if err != nil {

View File

@@ -1,10 +1,14 @@
package restricted package restricted
import ( import (
"strconv" "encoding/json"
"fmt"
"git.ma-al.com/goc_daniel/b2b/app/model"
"git.ma-al.com/goc_daniel/b2b/app/service/meiliService" "git.ma-al.com/goc_daniel/b2b/app/service/meiliService"
searchservice "git.ma-al.com/goc_daniel/b2b/app/service/searchService"
"git.ma-al.com/goc_daniel/b2b/app/utils/i18n" "git.ma-al.com/goc_daniel/b2b/app/utils/i18n"
"git.ma-al.com/goc_daniel/b2b/app/utils/localeExtractor"
"git.ma-al.com/goc_daniel/b2b/app/utils/nullable" "git.ma-al.com/goc_daniel/b2b/app/utils/nullable"
"git.ma-al.com/goc_daniel/b2b/app/utils/response" "git.ma-al.com/goc_daniel/b2b/app/utils/response"
"git.ma-al.com/goc_daniel/b2b/app/utils/responseErrors" "git.ma-al.com/goc_daniel/b2b/app/utils/responseErrors"
@@ -12,104 +16,98 @@ import (
) )
type MeiliSearchHandler struct { type MeiliSearchHandler struct {
meiliService *meiliService.MeiliService meiliService *meiliService.MeiliService
searchService *searchservice.SearchService
} }
func NewMeiliSearchHandler() *MeiliSearchHandler { func NewMeiliSearchHandler() *MeiliSearchHandler {
meiliService := meiliService.New()
return &MeiliSearchHandler{ return &MeiliSearchHandler{
meiliService: meiliService, meiliService: meiliService.New(),
searchService: searchservice.New(),
} }
} }
func MeiliSearchHandlerRoutes(r fiber.Router) fiber.Router { func MeiliSearchHandlerRoutes(r fiber.Router) fiber.Router {
handler := NewMeiliSearchHandler() handler := NewMeiliSearchHandler()
// for testing purposes only. Must be removed before proper release.
r.Get("/create-index", handler.CreateIndex) r.Get("/create-index", handler.CreateIndex)
r.Get("/test", handler.Test) r.Post("/search", handler.Search)
r.Post("/settings", handler.GetSettings)
// for all users
r.Get("/search", handler.Search)
return r return r
} }
func (h *MeiliSearchHandler) CreateIndex(c fiber.Ctx) error { func (h *MeiliSearchHandler) CreateIndex(c fiber.Ctx) error {
id_lang, ok := c.Locals("langID").(uint) id_lang, ok := localeExtractor.GetLangID(c)
if !ok { if !ok {
return c.Status(responseErrors.GetErrorStatus(responseErrors.ErrBadAttribute)). return c.Status(responseErrors.GetErrorStatus(responseErrors.ErrBadAttribute)).
JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, responseErrors.ErrBadAttribute))) JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, responseErrors.ErrBadAttribute)))
} }
userRole, ok := localeExtractor.GetOriginalUserRole(c)
if !ok || model.CustomerRole(userRole.Name) != model.RoleAdmin {
return c.Status(responseErrors.GetErrorStatus(responseErrors.ErrAdminAccessRequired)).
JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, responseErrors.ErrAdminAccessRequired)))
}
err := h.meiliService.CreateIndex(id_lang) err := h.meiliService.CreateIndex(id_lang)
if err != nil { if err != nil {
fmt.Printf("CreateIndex error: %v\n", err)
return c.Status(responseErrors.GetErrorStatus(err)). return c.Status(responseErrors.GetErrorStatus(err)).
JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, err))) JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, err)))
} }
nothing := "" return c.JSON(response.Make(nullable.GetNil(""), 0, i18n.T_(c, response.Message_OK)))
return c.JSON(response.Make(&nothing, 0, i18n.T_(c, response.Message_OK)))
}
func (h *MeiliSearchHandler) Test(c fiber.Ctx) error {
id_lang, ok := c.Locals("langID").(uint)
if !ok {
return c.Status(responseErrors.GetErrorStatus(responseErrors.ErrBadAttribute)).
JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, responseErrors.ErrBadAttribute)))
}
test, err := h.meiliService.Test(id_lang)
if err != nil {
return c.Status(responseErrors.GetErrorStatus(err)).
JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, err)))
}
return c.JSON(response.Make(&test, 0, i18n.T_(c, response.Message_OK)))
} }
func (h *MeiliSearchHandler) Search(c fiber.Ctx) error { func (h *MeiliSearchHandler) Search(c fiber.Ctx) error {
id_lang, ok := c.Locals("langID").(uint) id_lang, ok := localeExtractor.GetLangID(c)
if !ok { if !ok {
return c.Status(responseErrors.GetErrorStatus(responseErrors.ErrBadAttribute)). return c.Status(responseErrors.GetErrorStatus(responseErrors.ErrBadAttribute)).
JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, responseErrors.ErrBadAttribute))) JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, responseErrors.ErrBadAttribute)))
} }
query := c.Query("query") index := meiliService.GetIndexName(id_lang)
limit_attribute := c.Query("limit") var body map[string]interface{}
limit, err := strconv.Atoi(limit_attribute) if err := json.Unmarshal(c.Body(), &body); err != nil {
if err != nil { return c.Status(responseErrors.GetErrorStatus(responseErrors.ErrInvalidBody)).
return c.Status(responseErrors.GetErrorStatus(responseErrors.ErrBadAttribute)). JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, responseErrors.ErrInvalidBody)))
JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, responseErrors.ErrBadAttribute)))
} }
id_category_attribute := c.Query("id_category", "0") result, err := h.searchService.Search(index, c.Body(), id_lang)
id_category, err := strconv.Atoi(id_category_attribute)
if err != nil {
return c.Status(responseErrors.GetErrorStatus(responseErrors.ErrBadAttribute)).
JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, responseErrors.ErrBadAttribute)))
}
price_lower_bound_attribute := c.Query("price_lower_bound", "-1.0")
price_lower_bound, err := strconv.ParseFloat(price_lower_bound_attribute, 64)
if err != nil {
return c.Status(responseErrors.GetErrorStatus(responseErrors.ErrBadAttribute)).
JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, responseErrors.ErrBadAttribute)))
}
price_upper_bound_attribute := c.Query("price_upper_bound", "-1.0")
price_upper_bound, err := strconv.ParseFloat(price_upper_bound_attribute, 64)
if err != nil {
return c.Status(responseErrors.GetErrorStatus(responseErrors.ErrBadAttribute)).
JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, responseErrors.ErrBadAttribute)))
}
meili_response, err := h.meiliService.Search(id_lang, query, uint(limit), uint(id_category), price_lower_bound, price_upper_bound)
if err != nil { if err != nil {
return c.Status(responseErrors.GetErrorStatus(err)). return c.Status(responseErrors.GetErrorStatus(err)).
JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, err))) JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, err)))
} }
return c.JSON(response.Make(&meili_response, 0, i18n.T_(c, response.Message_OK))) if h.searchService.IsIndexNotFound(result.Body) {
if createErr := h.meiliService.CreateIndex(id_lang); createErr == nil {
result, err = h.searchService.Search(index, c.Body(), id_lang)
if err != nil {
return c.Status(responseErrors.GetErrorStatus(err)).
JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, err)))
}
}
}
return c.Status(result.StatusCode).Send(result.Body)
}
func (h *MeiliSearchHandler) GetSettings(c fiber.Ctx) error {
id_lang, ok := localeExtractor.GetLangID(c)
if !ok {
return c.Status(responseErrors.GetErrorStatus(responseErrors.ErrBadAttribute)).
JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, responseErrors.ErrBadAttribute)))
}
index := meiliService.GetIndexName(id_lang)
result, err := h.searchService.GetIndexSettings(index)
if err != nil {
return c.Status(responseErrors.GetErrorStatus(err)).
JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, err)))
}
return c.Status(result.StatusCode).Send(result.Body)
} }

View File

@@ -0,0 +1,100 @@
package restricted
import (
"strconv"
"git.ma-al.com/goc_daniel/b2b/app/config"
"git.ma-al.com/goc_daniel/b2b/app/model"
"git.ma-al.com/goc_daniel/b2b/app/service/storageService"
"git.ma-al.com/goc_daniel/b2b/app/utils/i18n"
"git.ma-al.com/goc_daniel/b2b/app/utils/localeExtractor"
"git.ma-al.com/goc_daniel/b2b/app/utils/nullable"
"git.ma-al.com/goc_daniel/b2b/app/utils/response"
"git.ma-al.com/goc_daniel/b2b/app/utils/responseErrors"
"github.com/gofiber/fiber/v3"
)
type StorageHandler struct {
storageService *storageService.StorageService
config *config.Config
}
func NewStorageHandler() *StorageHandler {
return &StorageHandler{
storageService: storageService.New(),
config: config.Get(),
}
}
func StorageHandlerRoutes(r fiber.Router) fiber.Router {
handler := NewStorageHandler()
// for all users
r.Get("/list-content/*", handler.ListContent)
r.Get("/download-file/*", handler.DownloadFile)
// for admins only
r.Get("/create-new-webdav-token", handler.CreateNewWebdavToken)
return r
}
// accepted path looks like e.g. "/folder1/" or "folder1"
func (h *StorageHandler) ListContent(c fiber.Ctx) error {
// relative path defaults to root directory
abs_path, err := h.storageService.AbsPath(h.config.Storage.RootFolder, c.Params("*"))
if err != nil {
return c.Status(responseErrors.GetErrorStatus(err)).
JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, err)))
}
entries_in_list, err := h.storageService.ListContent(abs_path)
if err != nil {
return c.Status(responseErrors.GetErrorStatus(err)).
JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, err)))
}
return c.JSON(response.Make(entries_in_list, 0, i18n.T_(c, response.Message_OK)))
}
func (h *StorageHandler) DownloadFile(c fiber.Ctx) error {
abs_path, err := h.storageService.AbsPath(h.config.Storage.RootFolder, c.Params("*"))
if err != nil {
return c.Status(responseErrors.GetErrorStatus(err)).
JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, err)))
}
f, filename, filesize, err := h.storageService.DownloadFilePrep(abs_path)
if err != nil {
return c.Status(responseErrors.GetErrorStatus(err)).
JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, err)))
}
c.Attachment(filename)
c.Set("Content-Length", strconv.FormatInt(filesize, 10))
c.Set("Content-Type", "application/octet-stream")
return c.SendStream(f, int(filesize))
}
func (h *StorageHandler) CreateNewWebdavToken(c fiber.Ctx) error {
userID, ok := localeExtractor.GetUserID(c)
if !ok {
return c.Status(responseErrors.GetErrorStatus(responseErrors.ErrInvalidBody)).
JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, responseErrors.ErrInvalidBody)))
}
userRole, ok := localeExtractor.GetOriginalUserRole(c)
if !ok || model.CustomerRole(userRole.Name) != model.RoleAdmin {
return c.Status(responseErrors.GetErrorStatus(responseErrors.ErrAdminAccessRequired)).
JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, responseErrors.ErrAdminAccessRequired)))
}
new_token, err := h.storageService.NewWebdavToken(userID)
if err != nil {
return c.Status(responseErrors.GetErrorStatus(err)).
JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, err)))
}
return c.JSON(response.Make(&new_token, 0, i18n.T_(c, response.Message_OK)))
}

View File

@@ -21,10 +21,12 @@ type SettingsResponse struct {
// AppSettings represents app configuration // AppSettings represents app configuration
type AppSettings struct { type AppSettings struct {
Name string `json:"name"` Name string `json:"name"`
Environment string `json:"environment"` Environment string `json:"environment"`
BaseURL string `json:"base_url"` BaseURL string `json:"base_url"`
PasswordRegex string `json:"password_regex"` PasswordRegex string `json:"password_regex"`
CategoryTreeRootID uint `json:"category_tree_root_id"`
ShopDefaultLanguage uint `json:"shop_default_language"`
// Config config.Config `json:"config"` // Config config.Config `json:"config"`
} }
@@ -65,10 +67,12 @@ func (h *SettingsHandler) GetSettings(cfg *config.Config) fiber.Handler {
return func(c fiber.Ctx) error { return func(c fiber.Ctx) error {
settings := SettingsResponse{ settings := SettingsResponse{
App: AppSettings{ App: AppSettings{
Name: cfg.App.Name, Name: cfg.App.Name,
Environment: cfg.App.Environment, Environment: cfg.App.Environment,
BaseURL: cfg.App.BaseURL, BaseURL: cfg.App.BaseURL,
PasswordRegex: constdata.PASSWORD_VALIDATION_REGEX, PasswordRegex: constdata.PASSWORD_VALIDATION_REGEX,
CategoryTreeRootID: constdata.CATEGORY_TREE_ROOT_ID,
ShopDefaultLanguage: constdata.SHOP_DEFAULT_LANGUAGE,
// Config: *config.Get(), // Config: *config.Get(),
}, },
Server: ServerSettings{ Server: ServerSettings{

View File

@@ -0,0 +1,198 @@
package webdav
import (
"bytes"
"io"
"net/http"
"strconv"
"git.ma-al.com/goc_daniel/b2b/app/config"
"git.ma-al.com/goc_daniel/b2b/app/service/storageService"
"git.ma-al.com/goc_daniel/b2b/app/utils/responseErrors"
"github.com/gofiber/fiber/v3"
)
type StorageHandler struct {
storageService *storageService.StorageService
config *config.Config
}
func NewStorageHandler() *StorageHandler {
return &StorageHandler{
storageService: storageService.New(),
config: config.Get(),
}
}
func StorageHandlerRoutes(r fiber.Router) fiber.Router {
handler := NewStorageHandler()
// for webdav use only
r.Get("/*", handler.Get)
r.Head("/*", handler.Get)
r.Put("/*", handler.Put)
r.Delete("/*", handler.Delete)
r.Add([]string{"MKCOL"}, "/*", handler.Mkcol)
r.Add([]string{"PROPFIND"}, "/*", handler.Propfind)
r.Add([]string{"PROPPATCH"}, "/*", handler.Proppatch)
r.Add([]string{"MOVE"}, "/*", handler.Move)
r.Add([]string{"COPY"}, "/*", handler.Copy)
return r
}
func (h *StorageHandler) Get(c fiber.Ctx) error {
// fmt.Println("GET")
absPath, err := h.storageService.AbsPath(h.config.Storage.RootFolder, c.Params("*"))
if err != nil {
return c.SendStatus(responseErrors.GetErrorStatus(err))
}
info, err := h.storageService.EntryInfo(absPath)
if err != nil {
return c.SendStatus(responseErrors.GetErrorStatus(err))
}
if info.IsDir() {
xml, err := h.storageService.Propfind(h.config.Storage.RootFolder, absPath, "1")
if err != nil {
return c.SendStatus(responseErrors.GetErrorStatus(err))
}
c.Set("Content-Type", `application/xml; charset="utf-8"`)
return c.Status(http.StatusMultiStatus).SendString(xml)
} else {
f, filename, filesize, err := h.storageService.DownloadFilePrep(absPath)
if err != nil {
return c.SendStatus(responseErrors.GetErrorStatus(err))
}
c.Attachment(filename)
c.Set("Content-Length", strconv.FormatInt(filesize, 10))
c.Set("Content-Type", "application/octet-stream")
return c.SendStream(f, int(filesize))
}
}
func (h *StorageHandler) Put(c fiber.Ctx) error {
// fmt.Println("PUT")
absPath, err := h.storageService.AbsPath(h.config.Storage.RootFolder, c.Params("*"))
if err != nil {
return c.SendStatus(responseErrors.GetErrorStatus(err))
}
var src io.Reader
if bodyStream := c.Request().BodyStream(); bodyStream != nil {
defer c.Request().CloseBodyStream()
src = bodyStream
} else {
src = bytes.NewReader(c.Body())
}
err = h.storageService.Put(absPath, src)
if err != nil {
return c.SendStatus(responseErrors.GetErrorStatus(err))
}
return c.SendStatus(http.StatusCreated)
}
func (h *StorageHandler) Delete(c fiber.Ctx) error {
// fmt.Println("DELETE")
absPath, err := h.storageService.AbsPath(h.config.Storage.RootFolder, c.Params("*"))
if err != nil {
return c.SendStatus(responseErrors.GetErrorStatus(err))
}
if absPath == h.config.Storage.RootFolder {
return c.SendStatus(responseErrors.GetErrorStatus(responseErrors.ErrAccessDenied))
}
err = h.storageService.Delete(absPath)
if err != nil {
return c.SendStatus(responseErrors.GetErrorStatus(err))
}
return c.SendStatus(http.StatusNoContent)
}
func (h *StorageHandler) Mkcol(c fiber.Ctx) error {
// fmt.Println("Mkcol")
absPath, err := h.storageService.AbsPath(h.config.Storage.RootFolder, c.Params("*"))
if err != nil {
return c.SendStatus(responseErrors.GetErrorStatus(err))
}
err = h.storageService.Mkcol(absPath)
if err != nil {
return c.SendStatus(responseErrors.GetErrorStatus(err))
}
return c.SendStatus(http.StatusCreated)
}
func (h *StorageHandler) Propfind(c fiber.Ctx) error {
// fmt.Println("PROPFIND")
absPath, err := h.storageService.AbsPath(h.config.Storage.RootFolder, c.Params("*"))
if err != nil {
return c.SendStatus(responseErrors.GetErrorStatus(err))
}
xml, err := h.storageService.Propfind(h.config.Storage.RootFolder, absPath, "1")
if err != nil {
return c.SendStatus(responseErrors.GetErrorStatus(err))
}
c.Set("Content-Type", `application/xml; charset="utf-8"`)
return c.Status(http.StatusMultiStatus).SendString(xml)
}
func (h *StorageHandler) Proppatch(c fiber.Ctx) error {
return c.SendStatus(http.StatusNotImplemented) // 501
}
func (h *StorageHandler) Move(c fiber.Ctx) error {
// fmt.Println("MOVE")
srcAbsPath, err := h.storageService.AbsPath(h.config.Storage.RootFolder, c.Params("*"))
if err != nil {
return c.SendStatus(responseErrors.GetErrorStatus(err))
}
dest := c.Get("Destination")
if dest == "" {
return c.SendStatus(http.StatusBadRequest)
}
destAbsPath, err := h.storageService.ObtainDestPath(h.config.Storage.RootFolder, dest)
if err != nil {
return c.SendStatus(responseErrors.GetErrorStatus(err))
}
err = h.storageService.Move(srcAbsPath, destAbsPath)
if err != nil {
return c.SendStatus(responseErrors.GetErrorStatus(err))
}
return c.SendStatus(http.StatusCreated)
}
func (h *StorageHandler) Copy(c fiber.Ctx) error {
// fmt.Println("COPY")
srcAbsPath, err := h.storageService.AbsPath(h.config.Storage.RootFolder, c.Params("*"))
if err != nil {
return c.SendStatus(responseErrors.GetErrorStatus(err))
}
dest := c.Get("Destination")
if dest == "" {
return c.SendStatus(http.StatusBadRequest)
}
destAbsPath, err := h.storageService.ObtainDestPath(h.config.Storage.RootFolder, dest)
if err != nil {
return c.SendStatus(responseErrors.GetErrorStatus(err))
}
err = h.storageService.Copy(srcAbsPath, destAbsPath)
if err != nil {
return c.SendStatus(responseErrors.GetErrorStatus(err))
}
return c.SendStatus(http.StatusCreated)
}

View File

@@ -14,11 +14,10 @@ import (
"git.ma-al.com/goc_daniel/b2b/app/delivery/web/api" "git.ma-al.com/goc_daniel/b2b/app/delivery/web/api"
"git.ma-al.com/goc_daniel/b2b/app/delivery/web/api/public" "git.ma-al.com/goc_daniel/b2b/app/delivery/web/api/public"
"git.ma-al.com/goc_daniel/b2b/app/delivery/web/api/restricted" "git.ma-al.com/goc_daniel/b2b/app/delivery/web/api/restricted"
"git.ma-al.com/goc_daniel/b2b/app/delivery/web/api/webdav"
"git.ma-al.com/goc_daniel/b2b/app/delivery/web/general" "git.ma-al.com/goc_daniel/b2b/app/delivery/web/general"
// "github.com/gofiber/fiber/v2/middleware/filesystem"
"github.com/gofiber/fiber/v3" "github.com/gofiber/fiber/v3"
// "github.com/gofiber/fiber/v3/middleware/filesystem"
"github.com/gofiber/fiber/v3/middleware/logger" "github.com/gofiber/fiber/v3/middleware/logger"
"github.com/gofiber/fiber/v3/middleware/recover" "github.com/gofiber/fiber/v3/middleware/recover"
) )
@@ -27,6 +26,7 @@ import (
type Server struct { type Server struct {
app *fiber.App app *fiber.App
cfg *config.Config cfg *config.Config
webdav fiber.Router
api fiber.Router api fiber.Router
public fiber.Router public fiber.Router
restricted fiber.Router restricted fiber.Router
@@ -44,12 +44,23 @@ func (s *Server) Cfg() *config.Config {
// New creates a new server instance // New creates a new server instance
func New() *Server { func New() *Server {
return &Server{ var s Server
app: fiber.New(fiber.Config{
ErrorHandler: customErrorHandler, app :=
}), fiber.New(fiber.Config{
cfg: config.Get(), ErrorHandler: customErrorHandler,
} BodyLimit: 50 * 1024 * 1024, // 50 MB
StreamRequestBody: true,
RequestMethods: []string{
fiber.MethodGet, fiber.MethodHead, fiber.MethodPost, fiber.MethodPut,
fiber.MethodDelete, fiber.MethodConnect, fiber.MethodOptions,
fiber.MethodTrace, fiber.MethodPatch, "MKCOL", "PROPFIND", "PROPPATCH", "MOVE", "COPY",
},
})
s.app = app
s.cfg = config.Get()
return &s
} }
// Setup configures the server with routes and middleware // Setup configures the server with routes and middleware
@@ -78,6 +89,8 @@ func (s *Server) Setup() error {
s.public = s.api.Group("/public") s.public = s.api.Group("/public")
s.restricted = s.api.Group("/restricted") s.restricted = s.api.Group("/restricted")
s.restricted.Use(middleware.AuthMiddleware()) s.restricted.Use(middleware.AuthMiddleware())
s.webdav = s.api.Group("/webdav")
s.webdav.Use(middleware.Webdav())
// initialize language endpoints (general) // initialize language endpoints (general)
api.NewLangHandler().InitLanguage(s.api, s.cfg) api.NewLangHandler().InitLanguage(s.api, s.cfg)
@@ -89,13 +102,18 @@ func (s *Server) Setup() error {
auth := s.public.Group("/auth") auth := s.public.Group("/auth")
public.AuthHandlerRoutes(auth) public.AuthHandlerRoutes(auth)
menuRouting := s.public.Group("/menu")
public.RoutingHandlerRoutes(menuRouting)
pCustomer := s.restricted.Group("/customer")
restricted.CustomerHandlerRoutes(pCustomer)
// product translation routes (restricted) // product translation routes (restricted)
productTranslation := s.restricted.Group("/product-translation") productTranslation := s.restricted.Group("/product-translation")
restricted.ProductTranslationHandlerRoutes(productTranslation) restricted.ProductTranslationHandlerRoutes(productTranslation)
// listing products routes (restricted) product := s.restricted.Group("/product")
listProducts := s.restricted.Group("/list-products") restricted.ProductsHandlerRoutes(product)
restricted.ListProductsHandlerRoutes(listProducts)
// locale selector (restricted) // locale selector (restricted)
// this is basically for changing user's selected language and country // this is basically for changing user's selected language and country
@@ -107,13 +125,21 @@ func (s *Server) Setup() error {
restricted.MenuHandlerRoutes(menu) restricted.MenuHandlerRoutes(menu)
// meili search (restricted) // meili search (restricted)
meiliSearch := s.restricted.Group("/meili-search") meiliSearch := s.restricted.Group("/search")
restricted.MeiliSearchHandlerRoutes(meiliSearch) restricted.MeiliSearchHandlerRoutes(meiliSearch)
// carts (restricted) // carts (restricted)
carts := s.restricted.Group("/carts") carts := s.restricted.Group("/carts")
restricted.CartsHandlerRoutes(carts) restricted.CartsHandlerRoutes(carts)
// storage (uses various authorization means)
restrictedStorage := s.restricted.Group("/storage")
webdavStorage := s.webdav.Group("/storage")
restricted.StorageHandlerRoutes(restrictedStorage)
webdav.StorageHandlerRoutes(webdavStorage)
restricted.CurrencyHandlerRoutes(s.restricted)
s.api.All("*", func(c fiber.Ctx) error { s.api.All("*", func(c fiber.Ctx) error {
return c.SendStatus(fiber.StatusNotFound) return c.SendStatus(fiber.StatusNotFound)
}) })

33
app/model/category.go Normal file
View File

@@ -0,0 +1,33 @@
package model
type ScannedCategory struct {
CategoryID uint `gorm:"column:category_id;primaryKey"`
Name string `gorm:"column:name"`
Active uint `gorm:"column:active"`
Position uint `gorm:"column:position"`
ParentID uint `gorm:"column:id_parent"`
IsRoot uint `gorm:"column:is_root_category"`
LinkRewrite string `gorm:"column:link_rewrite"`
IsoCode string `gorm:"column:iso_code"`
Visited bool //this is for internal backend use only
}
type Category struct {
CategoryID uint `json:"category_id" form:"category_id"`
Label string `json:"label" form:"label"`
// Active bool `json:"active" form:"active"`
Params CategoryParams `json:"params" form:"params"`
Children []Category `json:"children" form:"children"`
}
type CategoryParams struct {
CategoryID uint `json:"category_id" form:"category_id"`
LinkRewrite string `json:"link_rewrite" form:"link_rewrite"`
Locale string `json:"locale" form:"locale"`
}
type CategoryInBreadcrumb struct {
CategoryID uint `json:"category_id" form:"category_id"`
Name string `json:"name" form:"name"`
}

View File

@@ -1,31 +1,17 @@
package model package model
import "git.ma-al.com/goc_daniel/b2b/app/model/dbmodel"
// Represents a country together with its associated currency // Represents a country together with its associated currency
type Country struct { type Country struct {
ID uint `gorm:"primaryKey;column:id" json:"id"` ID uint `gorm:"primaryKey;column:id" json:"id"`
Name string `gorm:"column:name" json:"name"` Name string `gorm:"column:name" json:"name"`
Flag string `gorm:"size:16;not null;column:flag" json:"flag"` Flag string `gorm:"size:16;not null;column:flag" json:"flag"`
CurrencyID uint `gorm:"column:id_currency" json:"currency_id"`
CurrencyISOCode string `gorm:"column:iso_code" json:"currency_iso_code"` PSCurrencyID uint `gorm:"column:currency_id" json:"currency_id"`
CurrencyName string `gorm:"column:name" json:"currency_name"` PSCurrency *dbmodel.PsCurrency `gorm:"foreignKey:PSCurrencyID;references:IDCurrency" json:"ps_currency"`
// PSCountryID int `gorm:"column:id_country" json:"ps_country_id"`
// PSCountry *PSCountry `gorm:"foreignKey:PSCountryID;references:ID" json:"ps_country"`
PSCurrencyID uint `gorm:"column:currency" json:"currency"`
PSCurrency *PSCurrency `gorm:"foreignKey:PSCurrencyID;references:currency_id" json:"ps_currency"`
} }
func (Country) TableName() string { func (Country) TableName() string {
return "b2b_countries" return "b2b_countries"
} }
type PSCountry struct {
CurrencyID uint `gorm:"column:id_currency" json:"currency_id"`
}
func (PSCountry) TableName() string {
return "ps_country"
}
type PSCurrency struct {
Currency int `gorm:"column:currency" json:"currency"`
}

25
app/model/currency.go Normal file
View File

@@ -0,0 +1,25 @@
package model
import "time"
type Currency struct {
ID int `json:"id"`
PsIDCurrency uint `json:"ps_id_currency"`
IsDefault bool `json:"is_default"`
IsActive bool `json:"is_active"`
ConversionRate *float64 `json:"conversion_rate,omitempty"`
}
func (Currency) TableName() string {
return "b2b_currencies"
}
type CurrencyRate struct {
B2bIdCurrency uint `json:"b2b_id_currency"`
CreatedAt time.Time `json:"created_at"`
ConversionRate *float64 `json:"conversion_rate,omitempty"`
}
func (CurrencyRate) TableName() string {
return "b2b_currency_rates"
}

View File

@@ -3,6 +3,7 @@ package model
import ( import (
"time" "time"
"git.ma-al.com/goc_daniel/b2b/app/delivery/middleware/perms"
"gorm.io/gorm" "gorm.io/gorm"
) )
@@ -13,7 +14,8 @@ type Customer struct {
Password string `gorm:"size:255" json:"-"` // Hashed password, not exposed in JSON Password string `gorm:"size:255" json:"-"` // Hashed password, not exposed in JSON
FirstName string `gorm:"size:100" json:"first_name"` FirstName string `gorm:"size:100" json:"first_name"`
LastName string `gorm:"size:100" json:"last_name"` LastName string `gorm:"size:100" json:"last_name"`
Role CustomerRole `gorm:"type:varchar(20);default:'user'" json:"role"` RoleID uint `gorm:"column:role_id;not null;default:1" json:"-"`
Role *Role `gorm:"foreignKey:RoleID" json:"role,omitempty"`
Provider AuthProvider `gorm:"type:varchar(20);default:'local'" json:"provider"` Provider AuthProvider `gorm:"type:varchar(20);default:'local'" json:"provider"`
ProviderID string `gorm:"size:255" json:"provider_id,omitempty"` // ID from OAuth provider ProviderID string `gorm:"size:255" json:"provider_id,omitempty"` // ID from OAuth provider
AvatarURL string `gorm:"size:500" json:"avatar_url,omitempty"` AvatarURL string `gorm:"size:500" json:"avatar_url,omitempty"`
@@ -23,6 +25,8 @@ type Customer struct {
EmailVerificationExpires *time.Time `json:"-"` EmailVerificationExpires *time.Time `json:"-"`
PasswordResetToken string `gorm:"size:255" json:"-"` PasswordResetToken string `gorm:"size:255" json:"-"`
PasswordResetExpires *time.Time `json:"-"` PasswordResetExpires *time.Time `json:"-"`
WebdavToken string `gorm:"size:255" json:"-"`
WebdavExpires *time.Time `json:"-"`
LastPasswordResetRequest *time.Time `json:"-"` LastPasswordResetRequest *time.Time `json:"-"`
LastLoginAt *time.Time `json:"last_login_at,omitempty"` LastLoginAt *time.Time `json:"last_login_at,omitempty"`
LangID uint `gorm:"default:2" json:"lang_id"` // User's preferred language LangID uint `gorm:"default:2" json:"lang_id"` // User's preferred language
@@ -32,13 +36,14 @@ type Customer struct {
DeletedAt gorm.DeletedAt `gorm:"index" json:"-"` DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
} }
// CustomerRole represents the role of a user func (u *Customer) HasPermission(permission perms.Permission) bool {
type CustomerRole string for _, p := range u.Role.Permissions {
if p.Name == permission {
const ( return true
RoleUser CustomerRole = "user" }
RoleAdmin CustomerRole = "admin" }
) return false
}
// AuthProvider represents the authentication provider // AuthProvider represents the authentication provider
type AuthProvider string type AuthProvider string
@@ -53,16 +58,6 @@ func (Customer) TableName() string {
return "b2b_customers" return "b2b_customers"
} }
// IsAdmin checks if the user has admin role
func (u *Customer) IsAdmin() bool {
return u.Role == RoleAdmin
}
// CanManageUsers checks if the user can manage other users
func (u *Customer) CanManageUsers() bool {
return u.Role == RoleAdmin
}
// FullName returns the user's full name // FullName returns the user's full name
func (u *Customer) FullName() string { func (u *Customer) FullName() string {
if u.FirstName == "" && u.LastName == "" { if u.FirstName == "" && u.LastName == "" {
@@ -73,29 +68,65 @@ func (u *Customer) FullName() string {
// UserSession represents a user session for JWT claims // UserSession represents a user session for JWT claims
type UserSession struct { type UserSession struct {
UserID uint `json:"user_id"` UserID uint `json:"user_id"`
Email string `json:"email"` Email string `json:"email"`
Username string `json:"username"` Username string `json:"username"`
Role CustomerRole `json:"role"` RoleID uint `json:"role_id"`
LangID uint `json:"lang_id"` RoleName string `json:"role_name"`
CountryID uint `json:"country_id"` LangID uint `json:"lang_id"`
CountryID uint `json:"country_id"`
IsActive bool `json:"is_active"`
Permissions []perms.Permission `json:"permissions"`
}
func (us *UserSession) HasPermission(permission perms.Permission) bool {
for _, p := range us.Permissions {
if p == permission {
return true
}
}
return false
}
type UserLocale struct {
// User is the Target user if present, otherwise same as Original.
// User ought to be used in applications
User *Customer
// Original user is the one associated with auth token
OriginalUser *Customer
// Importantly, lang_id used in application is stored as OriginalUser.LangID
} }
// ToSession converts User to UserSession // ToSession converts User to UserSession
func (u *Customer) ToSession() *UserSession { func (u *Customer) ToSession() *UserSession {
return &UserSession{ return &UserSession{
UserID: u.ID, UserID: u.ID,
Email: u.Email, Email: u.Email,
Role: u.Role, RoleID: u.Role.ID,
LangID: u.LangID, RoleName: u.Role.Name,
CountryID: u.CountryID, Permissions: BuildPermissionSlice(u),
LangID: u.LangID,
CountryID: u.CountryID,
IsActive: u.IsActive,
} }
} }
func BuildPermissionSlice(user *Customer) []perms.Permission {
var perms []perms.Permission
for _, p := range user.Role.Permissions {
perms = append(perms, p.Name)
}
return perms
}
// LoginRequest represents the login form data // LoginRequest represents the login form data
type LoginRequest struct { type LoginRequest struct {
Email string `json:"email" form:"email"` Email string `json:"email" form:"email"`
Password string `json:"password" form:"password"` Password string `json:"password" form:"password"`
LangID *uint `json:"lang_id" form:"lang_id"`
} }
// RegisterRequest represents the initial registration form data // RegisterRequest represents the initial registration form data
@@ -142,3 +173,10 @@ type RefreshToken struct {
func (RefreshToken) TableName() string { func (RefreshToken) TableName() string {
return "b2b_refresh_tokens" return "b2b_refresh_tokens"
} }
type UserInList struct {
UserID uint `gorm:"primaryKey;column:id" json:"user_id"`
Email string `gorm:"column:email" json:"email"`
FirstName string `gorm:"column:first_name" json:"first_name"`
LastName string `gorm:"column:last_name" json:"last_name"`
}

View File

@@ -1,8 +1,8 @@
// Code generated by gorm.io/gen. DO NOT EDIT. // Code generated by gormcol. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
package prestadb package dbmodel
import "git.ma-al.com/goc_marek/gormcol"
const TableNamePsAccess = "ps_access" const TableNamePsAccess = "ps_access"
@@ -16,3 +16,11 @@ type PsAccess struct {
func (*PsAccess) TableName() string { func (*PsAccess) TableName() string {
return TableNamePsAccess return TableNamePsAccess
} }
var PsAccessCols = struct {
IDProfile gormcol.Field
IDAuthorizationRole gormcol.Field
}{
IDProfile: gormcol.Field{}.Set((&PsAccess{}).TableName(), "id_profile"),
IDAuthorizationRole: gormcol.Field{}.Set((&PsAccess{}).TableName(), "id_authorization_role"),
}

View File

@@ -1,8 +1,8 @@
// Code generated by gorm.io/gen. DO NOT EDIT. // Code generated by gormcol. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
package prestadb package dbmodel
import "git.ma-al.com/goc_marek/gormcol"
const TableNamePsAccessory = "ps_accessory" const TableNamePsAccessory = "ps_accessory"
@@ -16,3 +16,11 @@ type PsAccessory struct {
func (*PsAccessory) TableName() string { func (*PsAccessory) TableName() string {
return TableNamePsAccessory return TableNamePsAccessory
} }
var PsAccessoryCols = struct {
IDProduct1 gormcol.Field
IDProduct2 gormcol.Field
}{
IDProduct1: gormcol.Field{}.Set((&PsAccessory{}).TableName(), "id_product_1"),
IDProduct2: gormcol.Field{}.Set((&PsAccessory{}).TableName(), "id_product_2"),
}

View File

@@ -0,0 +1,98 @@
// Code generated by gormcol. DO NOT EDIT.
package dbmodel
import (
"git.ma-al.com/goc_marek/gormcol"
"time"
)
const TableNamePsAddress = "ps_address"
// PsAddress mapped from table <ps_address>
type PsAddress struct {
IDAddress int32 `gorm:"column:id_address;primaryKey;autoIncrement:true" json:"id_address"`
IDCountry int32 `gorm:"column:id_country;not null;index:id_country,priority:1" json:"id_country"`
IDState *int32 `gorm:"column:id_state;index:id_state,priority:1" json:"id_state"`
IDCustomer int32 `gorm:"column:id_customer;not null;index:address_customer,priority:1" json:"id_customer"`
IDManufacturer int32 `gorm:"column:id_manufacturer;not null;index:id_manufacturer,priority:1" json:"id_manufacturer"`
IDSupplier int32 `gorm:"column:id_supplier;not null;index:id_supplier,priority:1" json:"id_supplier"`
IDWarehouse int32 `gorm:"column:id_warehouse;not null;index:id_warehouse,priority:1" json:"id_warehouse"`
Alias string `gorm:"column:alias;not null" json:"alias"`
Company *string `gorm:"column:company" json:"company"`
Lastname string `gorm:"column:lastname;not null" json:"lastname"`
Firstname string `gorm:"column:firstname;not null" json:"firstname"`
Address1 string `gorm:"column:address1;not null" json:"address1"`
Address2 *string `gorm:"column:address2" json:"address2"`
Postcode *string `gorm:"column:postcode" json:"postcode"`
City string `gorm:"column:city;not null" json:"city"`
Other *string `gorm:"column:other" json:"other"`
Phone *string `gorm:"column:phone" json:"phone"`
PhoneMobile *string `gorm:"column:phone_mobile" json:"phone_mobile"`
VatNumber *string `gorm:"column:vat_number" json:"vat_number"`
Dni *string `gorm:"column:dni" json:"dni"`
DateAdd time.Time `gorm:"column:date_add;not null" json:"date_add"`
DateUpd time.Time `gorm:"column:date_upd;not null" json:"date_upd"`
Active bool `gorm:"column:active;not null;default:1" json:"active"`
Deleted bool `gorm:"column:deleted;not null" json:"deleted"`
IsNovat int32 `gorm:"column:is_novat;not null" json:"is_novat"`
}
// TableName PsAddress's table name
func (*PsAddress) TableName() string {
return TableNamePsAddress
}
var PsAddressCols = struct {
IDAddress gormcol.Field
IDCountry gormcol.Field
IDState gormcol.Field
IDCustomer gormcol.Field
IDManufacturer gormcol.Field
IDSupplier gormcol.Field
IDWarehouse gormcol.Field
Alias gormcol.Field
Company gormcol.Field
Lastname gormcol.Field
Firstname gormcol.Field
Address1 gormcol.Field
Address2 gormcol.Field
Postcode gormcol.Field
City gormcol.Field
Other gormcol.Field
Phone gormcol.Field
PhoneMobile gormcol.Field
VatNumber gormcol.Field
Dni gormcol.Field
DateAdd gormcol.Field
DateUpd gormcol.Field
Active gormcol.Field
Deleted gormcol.Field
IsNovat gormcol.Field
}{
IDAddress: gormcol.Field{}.Set((&PsAddress{}).TableName(), "id_address"),
IDCountry: gormcol.Field{}.Set((&PsAddress{}).TableName(), "id_country"),
IDState: gormcol.Field{}.Set((&PsAddress{}).TableName(), "id_state"),
IDCustomer: gormcol.Field{}.Set((&PsAddress{}).TableName(), "id_customer"),
IDManufacturer: gormcol.Field{}.Set((&PsAddress{}).TableName(), "id_manufacturer"),
IDSupplier: gormcol.Field{}.Set((&PsAddress{}).TableName(), "id_supplier"),
IDWarehouse: gormcol.Field{}.Set((&PsAddress{}).TableName(), "id_warehouse"),
Alias: gormcol.Field{}.Set((&PsAddress{}).TableName(), "alias"),
Company: gormcol.Field{}.Set((&PsAddress{}).TableName(), "company"),
Lastname: gormcol.Field{}.Set((&PsAddress{}).TableName(), "lastname"),
Firstname: gormcol.Field{}.Set((&PsAddress{}).TableName(), "firstname"),
Address1: gormcol.Field{}.Set((&PsAddress{}).TableName(), "address1"),
Address2: gormcol.Field{}.Set((&PsAddress{}).TableName(), "address2"),
Postcode: gormcol.Field{}.Set((&PsAddress{}).TableName(), "postcode"),
City: gormcol.Field{}.Set((&PsAddress{}).TableName(), "city"),
Other: gormcol.Field{}.Set((&PsAddress{}).TableName(), "other"),
Phone: gormcol.Field{}.Set((&PsAddress{}).TableName(), "phone"),
PhoneMobile: gormcol.Field{}.Set((&PsAddress{}).TableName(), "phone_mobile"),
VatNumber: gormcol.Field{}.Set((&PsAddress{}).TableName(), "vat_number"),
Dni: gormcol.Field{}.Set((&PsAddress{}).TableName(), "dni"),
DateAdd: gormcol.Field{}.Set((&PsAddress{}).TableName(), "date_add"),
DateUpd: gormcol.Field{}.Set((&PsAddress{}).TableName(), "date_upd"),
Active: gormcol.Field{}.Set((&PsAddress{}).TableName(), "active"),
Deleted: gormcol.Field{}.Set((&PsAddress{}).TableName(), "deleted"),
IsNovat: gormcol.Field{}.Set((&PsAddress{}).TableName(), "is_novat"),
}

View File

@@ -1,8 +1,8 @@
// Code generated by gorm.io/gen. DO NOT EDIT. // Code generated by gormcol. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
package prestadb package dbmodel
import "git.ma-al.com/goc_marek/gormcol"
const TableNamePsAddressFormat = "ps_address_format" const TableNamePsAddressFormat = "ps_address_format"
@@ -16,3 +16,11 @@ type PsAddressFormat struct {
func (*PsAddressFormat) TableName() string { func (*PsAddressFormat) TableName() string {
return TableNamePsAddressFormat return TableNamePsAddressFormat
} }
var PsAddressFormatCols = struct {
IDCountry gormcol.Field
Format gormcol.Field
}{
IDCountry: gormcol.Field{}.Set((&PsAddressFormat{}).TableName(), "id_country"),
Format: gormcol.Field{}.Set((&PsAddressFormat{}).TableName(), "format"),
}

View File

@@ -1,8 +1,8 @@
// Code generated by gorm.io/gen. DO NOT EDIT. // Code generated by gormcol. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
package prestadb package dbmodel
import "git.ma-al.com/goc_marek/gormcol"
const TableNamePsAdminFilter = "ps_admin_filter" const TableNamePsAdminFilter = "ps_admin_filter"
@@ -21,3 +21,21 @@ type PsAdminFilter struct {
func (*PsAdminFilter) TableName() string { func (*PsAdminFilter) TableName() string {
return TableNamePsAdminFilter return TableNamePsAdminFilter
} }
var PsAdminFilterCols = struct {
ID gormcol.Field
Employee gormcol.Field
Shop gormcol.Field
Controller gormcol.Field
Action gormcol.Field
Filter gormcol.Field
FilterID gormcol.Field
}{
ID: gormcol.Field{}.Set((&PsAdminFilter{}).TableName(), "id"),
Employee: gormcol.Field{}.Set((&PsAdminFilter{}).TableName(), "employee"),
Shop: gormcol.Field{}.Set((&PsAdminFilter{}).TableName(), "shop"),
Controller: gormcol.Field{}.Set((&PsAdminFilter{}).TableName(), "controller"),
Action: gormcol.Field{}.Set((&PsAdminFilter{}).TableName(), "action"),
Filter: gormcol.Field{}.Set((&PsAdminFilter{}).TableName(), "filter"),
FilterID: gormcol.Field{}.Set((&PsAdminFilter{}).TableName(), "filter_id"),
}

View File

@@ -0,0 +1,53 @@
// Code generated by gormcol. DO NOT EDIT.
package dbmodel
import "git.ma-al.com/goc_marek/gormcol"
const TableNamePsAdvice = "ps_advice"
// PsAdvice mapped from table <ps_advice>
type PsAdvice struct {
IDAdvice int32 `gorm:"column:id_advice;primaryKey;autoIncrement:true" json:"id_advice"`
IDPsAdvice int32 `gorm:"column:id_ps_advice;not null" json:"id_ps_advice"`
IDTab int32 `gorm:"column:id_tab;not null" json:"id_tab"`
IdsTab *string `gorm:"column:ids_tab" json:"ids_tab"`
Validated bool `gorm:"column:validated;not null" json:"validated"`
Hide bool `gorm:"column:hide;not null" json:"hide"`
Location string `gorm:"column:location;not null" json:"location"`
Selector *string `gorm:"column:selector" json:"selector"`
StartDay int32 `gorm:"column:start_day;not null" json:"start_day"`
StopDay int32 `gorm:"column:stop_day;not null" json:"stop_day"`
Weight *int32 `gorm:"column:weight;default:1" json:"weight"`
}
// TableName PsAdvice's table name
func (*PsAdvice) TableName() string {
return TableNamePsAdvice
}
var PsAdviceCols = struct {
IDAdvice gormcol.Field
IDPsAdvice gormcol.Field
IDTab gormcol.Field
IdsTab gormcol.Field
Validated gormcol.Field
Hide gormcol.Field
Location gormcol.Field
Selector gormcol.Field
StartDay gormcol.Field
StopDay gormcol.Field
Weight gormcol.Field
}{
IDAdvice: gormcol.Field{}.Set((&PsAdvice{}).TableName(), "id_advice"),
IDPsAdvice: gormcol.Field{}.Set((&PsAdvice{}).TableName(), "id_ps_advice"),
IDTab: gormcol.Field{}.Set((&PsAdvice{}).TableName(), "id_tab"),
IdsTab: gormcol.Field{}.Set((&PsAdvice{}).TableName(), "ids_tab"),
Validated: gormcol.Field{}.Set((&PsAdvice{}).TableName(), "validated"),
Hide: gormcol.Field{}.Set((&PsAdvice{}).TableName(), "hide"),
Location: gormcol.Field{}.Set((&PsAdvice{}).TableName(), "location"),
Selector: gormcol.Field{}.Set((&PsAdvice{}).TableName(), "selector"),
StartDay: gormcol.Field{}.Set((&PsAdvice{}).TableName(), "start_day"),
StopDay: gormcol.Field{}.Set((&PsAdvice{}).TableName(), "stop_day"),
Weight: gormcol.Field{}.Set((&PsAdvice{}).TableName(), "weight"),
}

View File

@@ -1,8 +1,8 @@
// Code generated by gorm.io/gen. DO NOT EDIT. // Code generated by gormcol. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
package prestadb package dbmodel
import "git.ma-al.com/goc_marek/gormcol"
const TableNamePsAdviceLang = "ps_advice_lang" const TableNamePsAdviceLang = "ps_advice_lang"
@@ -17,3 +17,13 @@ type PsAdviceLang struct {
func (*PsAdviceLang) TableName() string { func (*PsAdviceLang) TableName() string {
return TableNamePsAdviceLang return TableNamePsAdviceLang
} }
var PsAdviceLangCols = struct {
IDAdvice gormcol.Field
IDLang gormcol.Field
HTML gormcol.Field
}{
IDAdvice: gormcol.Field{}.Set((&PsAdviceLang{}).TableName(), "id_advice"),
IDLang: gormcol.Field{}.Set((&PsAdviceLang{}).TableName(), "id_lang"),
HTML: gormcol.Field{}.Set((&PsAdviceLang{}).TableName(), "html"),
}

View File

@@ -1,8 +1,8 @@
// Code generated by gorm.io/gen. DO NOT EDIT. // Code generated by gormcol. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
package prestadb package dbmodel
import "git.ma-al.com/goc_marek/gormcol"
const TableNamePsAlias = "ps_alias" const TableNamePsAlias = "ps_alias"
@@ -18,3 +18,15 @@ type PsAlias struct {
func (*PsAlias) TableName() string { func (*PsAlias) TableName() string {
return TableNamePsAlias return TableNamePsAlias
} }
var PsAliasCols = struct {
IDAlias gormcol.Field
Alias gormcol.Field
Search gormcol.Field
Active gormcol.Field
}{
IDAlias: gormcol.Field{}.Set((&PsAlias{}).TableName(), "id_alias"),
Alias: gormcol.Field{}.Set((&PsAlias{}).TableName(), "alias"),
Search: gormcol.Field{}.Set((&PsAlias{}).TableName(), "search"),
Active: gormcol.Field{}.Set((&PsAlias{}).TableName(), "active"),
}

View File

@@ -0,0 +1,35 @@
// Code generated by gormcol. DO NOT EDIT.
package dbmodel
import "git.ma-al.com/goc_marek/gormcol"
const TableNamePsAttachment = "ps_attachment"
// PsAttachment mapped from table <ps_attachment>
type PsAttachment struct {
IDAttachment int32 `gorm:"column:id_attachment;primaryKey;autoIncrement:true" json:"id_attachment"`
File string `gorm:"column:file;not null" json:"file"`
FileName string `gorm:"column:file_name;not null" json:"file_name"`
FileSize int64 `gorm:"column:file_size;not null" json:"file_size"`
Mime string `gorm:"column:mime;not null" json:"mime"`
}
// TableName PsAttachment's table name
func (*PsAttachment) TableName() string {
return TableNamePsAttachment
}
var PsAttachmentCols = struct {
IDAttachment gormcol.Field
File gormcol.Field
FileName gormcol.Field
FileSize gormcol.Field
Mime gormcol.Field
}{
IDAttachment: gormcol.Field{}.Set((&PsAttachment{}).TableName(), "id_attachment"),
File: gormcol.Field{}.Set((&PsAttachment{}).TableName(), "file"),
FileName: gormcol.Field{}.Set((&PsAttachment{}).TableName(), "file_name"),
FileSize: gormcol.Field{}.Set((&PsAttachment{}).TableName(), "file_size"),
Mime: gormcol.Field{}.Set((&PsAttachment{}).TableName(), "mime"),
}

View File

@@ -1,8 +1,8 @@
// Code generated by gorm.io/gen. DO NOT EDIT. // Code generated by gormcol. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
package prestadb package dbmodel
import "git.ma-al.com/goc_marek/gormcol"
const TableNamePsAttachmentLang = "ps_attachment_lang" const TableNamePsAttachmentLang = "ps_attachment_lang"
@@ -18,3 +18,15 @@ type PsAttachmentLang struct {
func (*PsAttachmentLang) TableName() string { func (*PsAttachmentLang) TableName() string {
return TableNamePsAttachmentLang return TableNamePsAttachmentLang
} }
var PsAttachmentLangCols = struct {
IDAttachment gormcol.Field
IDLang gormcol.Field
Name gormcol.Field
Description gormcol.Field
}{
IDAttachment: gormcol.Field{}.Set((&PsAttachmentLang{}).TableName(), "id_attachment"),
IDLang: gormcol.Field{}.Set((&PsAttachmentLang{}).TableName(), "id_lang"),
Name: gormcol.Field{}.Set((&PsAttachmentLang{}).TableName(), "name"),
Description: gormcol.Field{}.Set((&PsAttachmentLang{}).TableName(), "description"),
}

View File

@@ -1,8 +1,8 @@
// Code generated by gorm.io/gen. DO NOT EDIT. // Code generated by gormcol. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
package prestadb package dbmodel
import "git.ma-al.com/goc_marek/gormcol"
const TableNamePsAttribute = "ps_attribute" const TableNamePsAttribute = "ps_attribute"
@@ -18,3 +18,15 @@ type PsAttribute struct {
func (*PsAttribute) TableName() string { func (*PsAttribute) TableName() string {
return TableNamePsAttribute return TableNamePsAttribute
} }
var PsAttributeCols = struct {
IDAttribute gormcol.Field
IDAttributeGroup gormcol.Field
Color gormcol.Field
Position gormcol.Field
}{
IDAttribute: gormcol.Field{}.Set((&PsAttribute{}).TableName(), "id_attribute"),
IDAttributeGroup: gormcol.Field{}.Set((&PsAttribute{}).TableName(), "id_attribute_group"),
Color: gormcol.Field{}.Set((&PsAttribute{}).TableName(), "color"),
Position: gormcol.Field{}.Set((&PsAttribute{}).TableName(), "position"),
}

View File

@@ -1,8 +1,8 @@
// Code generated by gorm.io/gen. DO NOT EDIT. // Code generated by gormcol. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
package prestadb package dbmodel
import "git.ma-al.com/goc_marek/gormcol"
const TableNamePsAttributeGroup = "ps_attribute_group" const TableNamePsAttributeGroup = "ps_attribute_group"
@@ -18,3 +18,15 @@ type PsAttributeGroup struct {
func (*PsAttributeGroup) TableName() string { func (*PsAttributeGroup) TableName() string {
return TableNamePsAttributeGroup return TableNamePsAttributeGroup
} }
var PsAttributeGroupCols = struct {
IDAttributeGroup gormcol.Field
IsColorGroup gormcol.Field
GroupType gormcol.Field
Position gormcol.Field
}{
IDAttributeGroup: gormcol.Field{}.Set((&PsAttributeGroup{}).TableName(), "id_attribute_group"),
IsColorGroup: gormcol.Field{}.Set((&PsAttributeGroup{}).TableName(), "is_color_group"),
GroupType: gormcol.Field{}.Set((&PsAttributeGroup{}).TableName(), "group_type"),
Position: gormcol.Field{}.Set((&PsAttributeGroup{}).TableName(), "position"),
}

View File

@@ -1,8 +1,8 @@
// Code generated by gorm.io/gen. DO NOT EDIT. // Code generated by gormcol. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
package prestadb package dbmodel
import "git.ma-al.com/goc_marek/gormcol"
const TableNamePsAttributeGroupLang = "ps_attribute_group_lang" const TableNamePsAttributeGroupLang = "ps_attribute_group_lang"
@@ -18,3 +18,15 @@ type PsAttributeGroupLang struct {
func (*PsAttributeGroupLang) TableName() string { func (*PsAttributeGroupLang) TableName() string {
return TableNamePsAttributeGroupLang return TableNamePsAttributeGroupLang
} }
var PsAttributeGroupLangCols = struct {
IDAttributeGroup gormcol.Field
IDLang gormcol.Field
Name gormcol.Field
PublicName gormcol.Field
}{
IDAttributeGroup: gormcol.Field{}.Set((&PsAttributeGroupLang{}).TableName(), "id_attribute_group"),
IDLang: gormcol.Field{}.Set((&PsAttributeGroupLang{}).TableName(), "id_lang"),
Name: gormcol.Field{}.Set((&PsAttributeGroupLang{}).TableName(), "name"),
PublicName: gormcol.Field{}.Set((&PsAttributeGroupLang{}).TableName(), "public_name"),
}

View File

@@ -1,8 +1,8 @@
// Code generated by gorm.io/gen. DO NOT EDIT. // Code generated by gormcol. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
package prestadb package dbmodel
import "git.ma-al.com/goc_marek/gormcol"
const TableNamePsAttributeGroupShop = "ps_attribute_group_shop" const TableNamePsAttributeGroupShop = "ps_attribute_group_shop"
@@ -16,3 +16,11 @@ type PsAttributeGroupShop struct {
func (*PsAttributeGroupShop) TableName() string { func (*PsAttributeGroupShop) TableName() string {
return TableNamePsAttributeGroupShop return TableNamePsAttributeGroupShop
} }
var PsAttributeGroupShopCols = struct {
IDAttributeGroup gormcol.Field
IDShop gormcol.Field
}{
IDAttributeGroup: gormcol.Field{}.Set((&PsAttributeGroupShop{}).TableName(), "id_attribute_group"),
IDShop: gormcol.Field{}.Set((&PsAttributeGroupShop{}).TableName(), "id_shop"),
}

View File

@@ -1,8 +1,8 @@
// Code generated by gorm.io/gen. DO NOT EDIT. // Code generated by gormcol. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
package prestadb package dbmodel
import "git.ma-al.com/goc_marek/gormcol"
const TableNamePsAttributeImpact = "ps_attribute_impact" const TableNamePsAttributeImpact = "ps_attribute_impact"
@@ -19,3 +19,17 @@ type PsAttributeImpact struct {
func (*PsAttributeImpact) TableName() string { func (*PsAttributeImpact) TableName() string {
return TableNamePsAttributeImpact return TableNamePsAttributeImpact
} }
var PsAttributeImpactCols = struct {
IDAttributeImpact gormcol.Field
IDProduct gormcol.Field
IDAttribute gormcol.Field
Weight gormcol.Field
Price gormcol.Field
}{
IDAttributeImpact: gormcol.Field{}.Set((&PsAttributeImpact{}).TableName(), "id_attribute_impact"),
IDProduct: gormcol.Field{}.Set((&PsAttributeImpact{}).TableName(), "id_product"),
IDAttribute: gormcol.Field{}.Set((&PsAttributeImpact{}).TableName(), "id_attribute"),
Weight: gormcol.Field{}.Set((&PsAttributeImpact{}).TableName(), "weight"),
Price: gormcol.Field{}.Set((&PsAttributeImpact{}).TableName(), "price"),
}

View File

@@ -1,8 +1,8 @@
// Code generated by gorm.io/gen. DO NOT EDIT. // Code generated by gormcol. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
package prestadb package dbmodel
import "git.ma-al.com/goc_marek/gormcol"
const TableNamePsAttributeLang = "ps_attribute_lang" const TableNamePsAttributeLang = "ps_attribute_lang"
@@ -17,3 +17,13 @@ type PsAttributeLang struct {
func (*PsAttributeLang) TableName() string { func (*PsAttributeLang) TableName() string {
return TableNamePsAttributeLang return TableNamePsAttributeLang
} }
var PsAttributeLangCols = struct {
IDAttribute gormcol.Field
IDLang gormcol.Field
Name gormcol.Field
}{
IDAttribute: gormcol.Field{}.Set((&PsAttributeLang{}).TableName(), "id_attribute"),
IDLang: gormcol.Field{}.Set((&PsAttributeLang{}).TableName(), "id_lang"),
Name: gormcol.Field{}.Set((&PsAttributeLang{}).TableName(), "name"),
}

View File

@@ -1,8 +1,8 @@
// Code generated by gorm.io/gen. DO NOT EDIT. // Code generated by gormcol. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
package prestadb package dbmodel
import "git.ma-al.com/goc_marek/gormcol"
const TableNamePsAttributeShop = "ps_attribute_shop" const TableNamePsAttributeShop = "ps_attribute_shop"
@@ -16,3 +16,11 @@ type PsAttributeShop struct {
func (*PsAttributeShop) TableName() string { func (*PsAttributeShop) TableName() string {
return TableNamePsAttributeShop return TableNamePsAttributeShop
} }
var PsAttributeShopCols = struct {
IDAttribute gormcol.Field
IDShop gormcol.Field
}{
IDAttribute: gormcol.Field{}.Set((&PsAttributeShop{}).TableName(), "id_attribute"),
IDShop: gormcol.Field{}.Set((&PsAttributeShop{}).TableName(), "id_shop"),
}

View File

@@ -1,8 +1,8 @@
// Code generated by gorm.io/gen. DO NOT EDIT. // Code generated by gormcol. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
package prestadb package dbmodel
import "git.ma-al.com/goc_marek/gormcol"
const TableNamePsAuthorizationRole = "ps_authorization_role" const TableNamePsAuthorizationRole = "ps_authorization_role"
@@ -16,3 +16,11 @@ type PsAuthorizationRole struct {
func (*PsAuthorizationRole) TableName() string { func (*PsAuthorizationRole) TableName() string {
return TableNamePsAuthorizationRole return TableNamePsAuthorizationRole
} }
var PsAuthorizationRoleCols = struct {
IDAuthorizationRole gormcol.Field
Slug gormcol.Field
}{
IDAuthorizationRole: gormcol.Field{}.Set((&PsAuthorizationRole{}).TableName(), "id_authorization_role"),
Slug: gormcol.Field{}.Set((&PsAuthorizationRole{}).TableName(), "slug"),
}

View File

@@ -0,0 +1,44 @@
// Code generated by gormcol. DO NOT EDIT.
package dbmodel
import "git.ma-al.com/goc_marek/gormcol"
const TableNamePsBadge = "ps_badge"
// PsBadge mapped from table <ps_badge>
type PsBadge struct {
IDBadge int32 `gorm:"column:id_badge;primaryKey;autoIncrement:true" json:"id_badge"`
IDPsBadge int32 `gorm:"column:id_ps_badge;not null" json:"id_ps_badge"`
Type string `gorm:"column:type;not null" json:"type"`
IDGroup int32 `gorm:"column:id_group;not null" json:"id_group"`
GroupPosition int32 `gorm:"column:group_position;not null" json:"group_position"`
Scoring int32 `gorm:"column:scoring;not null" json:"scoring"`
Awb *int32 `gorm:"column:awb" json:"awb"`
Validated bool `gorm:"column:validated;not null" json:"validated"`
}
// TableName PsBadge's table name
func (*PsBadge) TableName() string {
return TableNamePsBadge
}
var PsBadgeCols = struct {
IDBadge gormcol.Field
IDPsBadge gormcol.Field
Type gormcol.Field
IDGroup gormcol.Field
GroupPosition gormcol.Field
Scoring gormcol.Field
Awb gormcol.Field
Validated gormcol.Field
}{
IDBadge: gormcol.Field{}.Set((&PsBadge{}).TableName(), "id_badge"),
IDPsBadge: gormcol.Field{}.Set((&PsBadge{}).TableName(), "id_ps_badge"),
Type: gormcol.Field{}.Set((&PsBadge{}).TableName(), "type"),
IDGroup: gormcol.Field{}.Set((&PsBadge{}).TableName(), "id_group"),
GroupPosition: gormcol.Field{}.Set((&PsBadge{}).TableName(), "group_position"),
Scoring: gormcol.Field{}.Set((&PsBadge{}).TableName(), "scoring"),
Awb: gormcol.Field{}.Set((&PsBadge{}).TableName(), "awb"),
Validated: gormcol.Field{}.Set((&PsBadge{}).TableName(), "validated"),
}

View File

@@ -0,0 +1,35 @@
// Code generated by gormcol. DO NOT EDIT.
package dbmodel
import "git.ma-al.com/goc_marek/gormcol"
const TableNamePsBadgeLang = "ps_badge_lang"
// PsBadgeLang mapped from table <ps_badge_lang>
type PsBadgeLang struct {
IDBadge int32 `gorm:"column:id_badge;primaryKey" json:"id_badge"`
IDLang int32 `gorm:"column:id_lang;primaryKey" json:"id_lang"`
Name *string `gorm:"column:name" json:"name"`
Description *string `gorm:"column:description" json:"description"`
GroupName *string `gorm:"column:group_name" json:"group_name"`
}
// TableName PsBadgeLang's table name
func (*PsBadgeLang) TableName() string {
return TableNamePsBadgeLang
}
var PsBadgeLangCols = struct {
IDBadge gormcol.Field
IDLang gormcol.Field
Name gormcol.Field
Description gormcol.Field
GroupName gormcol.Field
}{
IDBadge: gormcol.Field{}.Set((&PsBadgeLang{}).TableName(), "id_badge"),
IDLang: gormcol.Field{}.Set((&PsBadgeLang{}).TableName(), "id_lang"),
Name: gormcol.Field{}.Set((&PsBadgeLang{}).TableName(), "name"),
Description: gormcol.Field{}.Set((&PsBadgeLang{}).TableName(), "description"),
GroupName: gormcol.Field{}.Set((&PsBadgeLang{}).TableName(), "group_name"),
}

View File

@@ -0,0 +1,83 @@
// Code generated by gormcol. DO NOT EDIT.
package dbmodel
import "git.ma-al.com/goc_marek/gormcol"
const TableNamePsCarrier = "ps_carrier"
// PsCarrier mapped from table <ps_carrier>
type PsCarrier struct {
IDCarrier int32 `gorm:"column:id_carrier;primaryKey;autoIncrement:true" json:"id_carrier"`
IDReference int32 `gorm:"column:id_reference;not null;index:reference,priority:1" json:"id_reference"`
IDTaxRulesGroup *int32 `gorm:"column:id_tax_rules_group;index:id_tax_rules_group,priority:1" json:"id_tax_rules_group"`
Name string `gorm:"column:name;not null" json:"name"`
URL *string `gorm:"column:url" json:"url"`
Active bool `gorm:"column:active;not null;index:deleted,priority:2;index:reference,priority:3" json:"active"`
Deleted bool `gorm:"column:deleted;not null;index:deleted,priority:1;index:reference,priority:2" json:"deleted"`
ShippingHandling bool `gorm:"column:shipping_handling;not null;default:1" json:"shipping_handling"`
RangeBehavior bool `gorm:"column:range_behavior;not null" json:"range_behavior"`
IsModule bool `gorm:"column:is_module;not null" json:"is_module"`
IsFree bool `gorm:"column:is_free;not null" json:"is_free"`
ShippingExternal bool `gorm:"column:shipping_external;not null" json:"shipping_external"`
NeedRange bool `gorm:"column:need_range;not null" json:"need_range"`
ExternalModuleName *string `gorm:"column:external_module_name" json:"external_module_name"`
ShippingMethod int32 `gorm:"column:shipping_method;not null" json:"shipping_method"`
Position int32 `gorm:"column:position;not null" json:"position"`
MaxWidth *int32 `gorm:"column:max_width" json:"max_width"`
MaxHeight *int32 `gorm:"column:max_height" json:"max_height"`
MaxDepth *int32 `gorm:"column:max_depth" json:"max_depth"`
MaxWeight *float64 `gorm:"column:max_weight;default:0.000000" json:"max_weight"`
Grade *int32 `gorm:"column:grade" json:"grade"`
}
// TableName PsCarrier's table name
func (*PsCarrier) TableName() string {
return TableNamePsCarrier
}
var PsCarrierCols = struct {
IDCarrier gormcol.Field
IDReference gormcol.Field
IDTaxRulesGroup gormcol.Field
Name gormcol.Field
URL gormcol.Field
Active gormcol.Field
Deleted gormcol.Field
ShippingHandling gormcol.Field
RangeBehavior gormcol.Field
IsModule gormcol.Field
IsFree gormcol.Field
ShippingExternal gormcol.Field
NeedRange gormcol.Field
ExternalModuleName gormcol.Field
ShippingMethod gormcol.Field
Position gormcol.Field
MaxWidth gormcol.Field
MaxHeight gormcol.Field
MaxDepth gormcol.Field
MaxWeight gormcol.Field
Grade gormcol.Field
}{
IDCarrier: gormcol.Field{}.Set((&PsCarrier{}).TableName(), "id_carrier"),
IDReference: gormcol.Field{}.Set((&PsCarrier{}).TableName(), "id_reference"),
IDTaxRulesGroup: gormcol.Field{}.Set((&PsCarrier{}).TableName(), "id_tax_rules_group"),
Name: gormcol.Field{}.Set((&PsCarrier{}).TableName(), "name"),
URL: gormcol.Field{}.Set((&PsCarrier{}).TableName(), "url"),
Active: gormcol.Field{}.Set((&PsCarrier{}).TableName(), "active"),
Deleted: gormcol.Field{}.Set((&PsCarrier{}).TableName(), "deleted"),
ShippingHandling: gormcol.Field{}.Set((&PsCarrier{}).TableName(), "shipping_handling"),
RangeBehavior: gormcol.Field{}.Set((&PsCarrier{}).TableName(), "range_behavior"),
IsModule: gormcol.Field{}.Set((&PsCarrier{}).TableName(), "is_module"),
IsFree: gormcol.Field{}.Set((&PsCarrier{}).TableName(), "is_free"),
ShippingExternal: gormcol.Field{}.Set((&PsCarrier{}).TableName(), "shipping_external"),
NeedRange: gormcol.Field{}.Set((&PsCarrier{}).TableName(), "need_range"),
ExternalModuleName: gormcol.Field{}.Set((&PsCarrier{}).TableName(), "external_module_name"),
ShippingMethod: gormcol.Field{}.Set((&PsCarrier{}).TableName(), "shipping_method"),
Position: gormcol.Field{}.Set((&PsCarrier{}).TableName(), "position"),
MaxWidth: gormcol.Field{}.Set((&PsCarrier{}).TableName(), "max_width"),
MaxHeight: gormcol.Field{}.Set((&PsCarrier{}).TableName(), "max_height"),
MaxDepth: gormcol.Field{}.Set((&PsCarrier{}).TableName(), "max_depth"),
MaxWeight: gormcol.Field{}.Set((&PsCarrier{}).TableName(), "max_weight"),
Grade: gormcol.Field{}.Set((&PsCarrier{}).TableName(), "grade"),
}

View File

@@ -1,8 +1,8 @@
// Code generated by gorm.io/gen. DO NOT EDIT. // Code generated by gormcol. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
package prestadb package dbmodel
import "git.ma-al.com/goc_marek/gormcol"
const TableNamePsCarrierGroup = "ps_carrier_group" const TableNamePsCarrierGroup = "ps_carrier_group"
@@ -16,3 +16,11 @@ type PsCarrierGroup struct {
func (*PsCarrierGroup) TableName() string { func (*PsCarrierGroup) TableName() string {
return TableNamePsCarrierGroup return TableNamePsCarrierGroup
} }
var PsCarrierGroupCols = struct {
IDCarrier gormcol.Field
IDGroup gormcol.Field
}{
IDCarrier: gormcol.Field{}.Set((&PsCarrierGroup{}).TableName(), "id_carrier"),
IDGroup: gormcol.Field{}.Set((&PsCarrierGroup{}).TableName(), "id_group"),
}

View File

@@ -1,8 +1,8 @@
// Code generated by gorm.io/gen. DO NOT EDIT. // Code generated by gormcol. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
package prestadb package dbmodel
import "git.ma-al.com/goc_marek/gormcol"
const TableNamePsCarrierLang = "ps_carrier_lang" const TableNamePsCarrierLang = "ps_carrier_lang"
@@ -18,3 +18,15 @@ type PsCarrierLang struct {
func (*PsCarrierLang) TableName() string { func (*PsCarrierLang) TableName() string {
return TableNamePsCarrierLang return TableNamePsCarrierLang
} }
var PsCarrierLangCols = struct {
IDCarrier gormcol.Field
IDShop gormcol.Field
IDLang gormcol.Field
Delay gormcol.Field
}{
IDCarrier: gormcol.Field{}.Set((&PsCarrierLang{}).TableName(), "id_carrier"),
IDShop: gormcol.Field{}.Set((&PsCarrierLang{}).TableName(), "id_shop"),
IDLang: gormcol.Field{}.Set((&PsCarrierLang{}).TableName(), "id_lang"),
Delay: gormcol.Field{}.Set((&PsCarrierLang{}).TableName(), "delay"),
}

View File

@@ -1,8 +1,8 @@
// Code generated by gorm.io/gen. DO NOT EDIT. // Code generated by gormcol. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
package prestadb package dbmodel
import "git.ma-al.com/goc_marek/gormcol"
const TableNamePsCarrierShop = "ps_carrier_shop" const TableNamePsCarrierShop = "ps_carrier_shop"
@@ -16,3 +16,11 @@ type PsCarrierShop struct {
func (*PsCarrierShop) TableName() string { func (*PsCarrierShop) TableName() string {
return TableNamePsCarrierShop return TableNamePsCarrierShop
} }
var PsCarrierShopCols = struct {
IDCarrier gormcol.Field
IDShop gormcol.Field
}{
IDCarrier: gormcol.Field{}.Set((&PsCarrierShop{}).TableName(), "id_carrier"),
IDShop: gormcol.Field{}.Set((&PsCarrierShop{}).TableName(), "id_shop"),
}

View File

@@ -1,8 +1,8 @@
// Code generated by gorm.io/gen. DO NOT EDIT. // Code generated by gormcol. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
package prestadb package dbmodel
import "git.ma-al.com/goc_marek/gormcol"
const TableNamePsCarrierTaxRulesGroupShop = "ps_carrier_tax_rules_group_shop" const TableNamePsCarrierTaxRulesGroupShop = "ps_carrier_tax_rules_group_shop"
@@ -17,3 +17,13 @@ type PsCarrierTaxRulesGroupShop struct {
func (*PsCarrierTaxRulesGroupShop) TableName() string { func (*PsCarrierTaxRulesGroupShop) TableName() string {
return TableNamePsCarrierTaxRulesGroupShop return TableNamePsCarrierTaxRulesGroupShop
} }
var PsCarrierTaxRulesGroupShopCols = struct {
IDCarrier gormcol.Field
IDTaxRulesGroup gormcol.Field
IDShop gormcol.Field
}{
IDCarrier: gormcol.Field{}.Set((&PsCarrierTaxRulesGroupShop{}).TableName(), "id_carrier"),
IDTaxRulesGroup: gormcol.Field{}.Set((&PsCarrierTaxRulesGroupShop{}).TableName(), "id_tax_rules_group"),
IDShop: gormcol.Field{}.Set((&PsCarrierTaxRulesGroupShop{}).TableName(), "id_shop"),
}

View File

@@ -1,8 +1,8 @@
// Code generated by gorm.io/gen. DO NOT EDIT. // Code generated by gormcol. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
package prestadb package dbmodel
import "git.ma-al.com/goc_marek/gormcol"
const TableNamePsCarrierZone = "ps_carrier_zone" const TableNamePsCarrierZone = "ps_carrier_zone"
@@ -16,3 +16,11 @@ type PsCarrierZone struct {
func (*PsCarrierZone) TableName() string { func (*PsCarrierZone) TableName() string {
return TableNamePsCarrierZone return TableNamePsCarrierZone
} }
var PsCarrierZoneCols = struct {
IDCarrier gormcol.Field
IDZone gormcol.Field
}{
IDCarrier: gormcol.Field{}.Set((&PsCarrierZone{}).TableName(), "id_carrier"),
IDZone: gormcol.Field{}.Set((&PsCarrierZone{}).TableName(), "id_zone"),
}

View File

@@ -1,10 +1,9 @@
// Code generated by gorm.io/gen. DO NOT EDIT. // Code generated by gormcol. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
package prestadb package dbmodel
import ( import (
"git.ma-al.com/goc_marek/gormcol"
"time" "time"
) )
@@ -41,3 +40,53 @@ type PsCart struct {
func (*PsCart) TableName() string { func (*PsCart) TableName() string {
return TableNamePsCart return TableNamePsCart
} }
var PsCartCols = struct {
IDCart gormcol.Field
IDShopGroup gormcol.Field
IDShop gormcol.Field
IDCarrier gormcol.Field
DeliveryOption gormcol.Field
IDLang gormcol.Field
IDAddressDelivery gormcol.Field
IDAddressInvoice gormcol.Field
IDCurrency gormcol.Field
IDCustomer gormcol.Field
IDGuest gormcol.Field
SecureKey gormcol.Field
Recyclable gormcol.Field
Gift gormcol.Field
GiftMessage gormcol.Field
MobileTheme gormcol.Field
AllowSeperatedPackage gormcol.Field
DateAdd gormcol.Field
DateUpd gormcol.Field
CheckoutSessionData gormcol.Field
CustomeShippingPriceNetto gormcol.Field
CustomeShippingPrice gormcol.Field
CustomeShippingTaxRate gormcol.Field
}{
IDCart: gormcol.Field{}.Set((&PsCart{}).TableName(), "id_cart"),
IDShopGroup: gormcol.Field{}.Set((&PsCart{}).TableName(), "id_shop_group"),
IDShop: gormcol.Field{}.Set((&PsCart{}).TableName(), "id_shop"),
IDCarrier: gormcol.Field{}.Set((&PsCart{}).TableName(), "id_carrier"),
DeliveryOption: gormcol.Field{}.Set((&PsCart{}).TableName(), "delivery_option"),
IDLang: gormcol.Field{}.Set((&PsCart{}).TableName(), "id_lang"),
IDAddressDelivery: gormcol.Field{}.Set((&PsCart{}).TableName(), "id_address_delivery"),
IDAddressInvoice: gormcol.Field{}.Set((&PsCart{}).TableName(), "id_address_invoice"),
IDCurrency: gormcol.Field{}.Set((&PsCart{}).TableName(), "id_currency"),
IDCustomer: gormcol.Field{}.Set((&PsCart{}).TableName(), "id_customer"),
IDGuest: gormcol.Field{}.Set((&PsCart{}).TableName(), "id_guest"),
SecureKey: gormcol.Field{}.Set((&PsCart{}).TableName(), "secure_key"),
Recyclable: gormcol.Field{}.Set((&PsCart{}).TableName(), "recyclable"),
Gift: gormcol.Field{}.Set((&PsCart{}).TableName(), "gift"),
GiftMessage: gormcol.Field{}.Set((&PsCart{}).TableName(), "gift_message"),
MobileTheme: gormcol.Field{}.Set((&PsCart{}).TableName(), "mobile_theme"),
AllowSeperatedPackage: gormcol.Field{}.Set((&PsCart{}).TableName(), "allow_seperated_package"),
DateAdd: gormcol.Field{}.Set((&PsCart{}).TableName(), "date_add"),
DateUpd: gormcol.Field{}.Set((&PsCart{}).TableName(), "date_upd"),
CheckoutSessionData: gormcol.Field{}.Set((&PsCart{}).TableName(), "checkout_session_data"),
CustomeShippingPriceNetto: gormcol.Field{}.Set((&PsCart{}).TableName(), "custome_shipping_price_netto"),
CustomeShippingPrice: gormcol.Field{}.Set((&PsCart{}).TableName(), "custome_shipping_price"),
CustomeShippingTaxRate: gormcol.Field{}.Set((&PsCart{}).TableName(), "custome_shipping_tax_rate"),
}

View File

@@ -1,8 +1,8 @@
// Code generated by gorm.io/gen. DO NOT EDIT. // Code generated by gormcol. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
package prestadb package dbmodel
import "git.ma-al.com/goc_marek/gormcol"
const TableNamePsCartCartRule = "ps_cart_cart_rule" const TableNamePsCartCartRule = "ps_cart_cart_rule"
@@ -16,3 +16,11 @@ type PsCartCartRule struct {
func (*PsCartCartRule) TableName() string { func (*PsCartCartRule) TableName() string {
return TableNamePsCartCartRule return TableNamePsCartCartRule
} }
var PsCartCartRuleCols = struct {
IDCart gormcol.Field
IDCartRule gormcol.Field
}{
IDCart: gormcol.Field{}.Set((&PsCartCartRule{}).TableName(), "id_cart"),
IDCartRule: gormcol.Field{}.Set((&PsCartCartRule{}).TableName(), "id_cart_rule"),
}

View File

@@ -1,10 +1,9 @@
// Code generated by gorm.io/gen. DO NOT EDIT. // Code generated by gormcol. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
package prestadb package dbmodel
import ( import (
"git.ma-al.com/goc_marek/gormcol"
"time" "time"
) )
@@ -26,3 +25,23 @@ type PsCartProduct struct {
func (*PsCartProduct) TableName() string { func (*PsCartProduct) TableName() string {
return TableNamePsCartProduct return TableNamePsCartProduct
} }
var PsCartProductCols = struct {
IDCart gormcol.Field
IDProduct gormcol.Field
IDAddressDelivery gormcol.Field
IDShop gormcol.Field
IDProductAttribute gormcol.Field
IDCustomization gormcol.Field
Quantity gormcol.Field
DateAdd gormcol.Field
}{
IDCart: gormcol.Field{}.Set((&PsCartProduct{}).TableName(), "id_cart"),
IDProduct: gormcol.Field{}.Set((&PsCartProduct{}).TableName(), "id_product"),
IDAddressDelivery: gormcol.Field{}.Set((&PsCartProduct{}).TableName(), "id_address_delivery"),
IDShop: gormcol.Field{}.Set((&PsCartProduct{}).TableName(), "id_shop"),
IDProductAttribute: gormcol.Field{}.Set((&PsCartProduct{}).TableName(), "id_product_attribute"),
IDCustomization: gormcol.Field{}.Set((&PsCartProduct{}).TableName(), "id_customization"),
Quantity: gormcol.Field{}.Set((&PsCartProduct{}).TableName(), "quantity"),
DateAdd: gormcol.Field{}.Set((&PsCartProduct{}).TableName(), "date_add"),
}

View File

@@ -1,10 +1,9 @@
// Code generated by gorm.io/gen. DO NOT EDIT. // Code generated by gormcol. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
package prestadb package dbmodel
import ( import (
"git.ma-al.com/goc_marek/gormcol"
"time" "time"
) )
@@ -51,3 +50,73 @@ type PsCartRule struct {
func (*PsCartRule) TableName() string { func (*PsCartRule) TableName() string {
return TableNamePsCartRule return TableNamePsCartRule
} }
var PsCartRuleCols = struct {
IDCartRule gormcol.Field
IDCustomer gormcol.Field
DateFrom gormcol.Field
DateTo gormcol.Field
Description gormcol.Field
Quantity gormcol.Field
QuantityPerUser gormcol.Field
Priority gormcol.Field
PartialUse gormcol.Field
Code gormcol.Field
MinimumAmount gormcol.Field
MinimumAmountTax gormcol.Field
MinimumAmountCurrency gormcol.Field
MinimumAmountShipping gormcol.Field
CountryRestriction gormcol.Field
CarrierRestriction gormcol.Field
GroupRestriction gormcol.Field
CartRuleRestriction gormcol.Field
ProductRestriction gormcol.Field
ShopRestriction gormcol.Field
FreeShipping gormcol.Field
ReductionPercent gormcol.Field
ReductionAmount gormcol.Field
ReductionTax gormcol.Field
ReductionCurrency gormcol.Field
ReductionProduct gormcol.Field
ReductionExcludeSpecial gormcol.Field
GiftProduct gormcol.Field
GiftProductAttribute gormcol.Field
Highlight gormcol.Field
Active gormcol.Field
DateAdd gormcol.Field
DateUpd gormcol.Field
}{
IDCartRule: gormcol.Field{}.Set((&PsCartRule{}).TableName(), "id_cart_rule"),
IDCustomer: gormcol.Field{}.Set((&PsCartRule{}).TableName(), "id_customer"),
DateFrom: gormcol.Field{}.Set((&PsCartRule{}).TableName(), "date_from"),
DateTo: gormcol.Field{}.Set((&PsCartRule{}).TableName(), "date_to"),
Description: gormcol.Field{}.Set((&PsCartRule{}).TableName(), "description"),
Quantity: gormcol.Field{}.Set((&PsCartRule{}).TableName(), "quantity"),
QuantityPerUser: gormcol.Field{}.Set((&PsCartRule{}).TableName(), "quantity_per_user"),
Priority: gormcol.Field{}.Set((&PsCartRule{}).TableName(), "priority"),
PartialUse: gormcol.Field{}.Set((&PsCartRule{}).TableName(), "partial_use"),
Code: gormcol.Field{}.Set((&PsCartRule{}).TableName(), "code"),
MinimumAmount: gormcol.Field{}.Set((&PsCartRule{}).TableName(), "minimum_amount"),
MinimumAmountTax: gormcol.Field{}.Set((&PsCartRule{}).TableName(), "minimum_amount_tax"),
MinimumAmountCurrency: gormcol.Field{}.Set((&PsCartRule{}).TableName(), "minimum_amount_currency"),
MinimumAmountShipping: gormcol.Field{}.Set((&PsCartRule{}).TableName(), "minimum_amount_shipping"),
CountryRestriction: gormcol.Field{}.Set((&PsCartRule{}).TableName(), "country_restriction"),
CarrierRestriction: gormcol.Field{}.Set((&PsCartRule{}).TableName(), "carrier_restriction"),
GroupRestriction: gormcol.Field{}.Set((&PsCartRule{}).TableName(), "group_restriction"),
CartRuleRestriction: gormcol.Field{}.Set((&PsCartRule{}).TableName(), "cart_rule_restriction"),
ProductRestriction: gormcol.Field{}.Set((&PsCartRule{}).TableName(), "product_restriction"),
ShopRestriction: gormcol.Field{}.Set((&PsCartRule{}).TableName(), "shop_restriction"),
FreeShipping: gormcol.Field{}.Set((&PsCartRule{}).TableName(), "free_shipping"),
ReductionPercent: gormcol.Field{}.Set((&PsCartRule{}).TableName(), "reduction_percent"),
ReductionAmount: gormcol.Field{}.Set((&PsCartRule{}).TableName(), "reduction_amount"),
ReductionTax: gormcol.Field{}.Set((&PsCartRule{}).TableName(), "reduction_tax"),
ReductionCurrency: gormcol.Field{}.Set((&PsCartRule{}).TableName(), "reduction_currency"),
ReductionProduct: gormcol.Field{}.Set((&PsCartRule{}).TableName(), "reduction_product"),
ReductionExcludeSpecial: gormcol.Field{}.Set((&PsCartRule{}).TableName(), "reduction_exclude_special"),
GiftProduct: gormcol.Field{}.Set((&PsCartRule{}).TableName(), "gift_product"),
GiftProductAttribute: gormcol.Field{}.Set((&PsCartRule{}).TableName(), "gift_product_attribute"),
Highlight: gormcol.Field{}.Set((&PsCartRule{}).TableName(), "highlight"),
Active: gormcol.Field{}.Set((&PsCartRule{}).TableName(), "active"),
DateAdd: gormcol.Field{}.Set((&PsCartRule{}).TableName(), "date_add"),
DateUpd: gormcol.Field{}.Set((&PsCartRule{}).TableName(), "date_upd"),
}

View File

@@ -1,8 +1,8 @@
// Code generated by gorm.io/gen. DO NOT EDIT. // Code generated by gormcol. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
package prestadb package dbmodel
import "git.ma-al.com/goc_marek/gormcol"
const TableNamePsCartRuleCarrier = "ps_cart_rule_carrier" const TableNamePsCartRuleCarrier = "ps_cart_rule_carrier"
@@ -16,3 +16,11 @@ type PsCartRuleCarrier struct {
func (*PsCartRuleCarrier) TableName() string { func (*PsCartRuleCarrier) TableName() string {
return TableNamePsCartRuleCarrier return TableNamePsCartRuleCarrier
} }
var PsCartRuleCarrierCols = struct {
IDCartRule gormcol.Field
IDCarrier gormcol.Field
}{
IDCartRule: gormcol.Field{}.Set((&PsCartRuleCarrier{}).TableName(), "id_cart_rule"),
IDCarrier: gormcol.Field{}.Set((&PsCartRuleCarrier{}).TableName(), "id_carrier"),
}

View File

@@ -1,8 +1,8 @@
// Code generated by gorm.io/gen. DO NOT EDIT. // Code generated by gormcol. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
package prestadb package dbmodel
import "git.ma-al.com/goc_marek/gormcol"
const TableNamePsCartRuleCombination = "ps_cart_rule_combination" const TableNamePsCartRuleCombination = "ps_cart_rule_combination"
@@ -16,3 +16,11 @@ type PsCartRuleCombination struct {
func (*PsCartRuleCombination) TableName() string { func (*PsCartRuleCombination) TableName() string {
return TableNamePsCartRuleCombination return TableNamePsCartRuleCombination
} }
var PsCartRuleCombinationCols = struct {
IDCartRule1 gormcol.Field
IDCartRule2 gormcol.Field
}{
IDCartRule1: gormcol.Field{}.Set((&PsCartRuleCombination{}).TableName(), "id_cart_rule_1"),
IDCartRule2: gormcol.Field{}.Set((&PsCartRuleCombination{}).TableName(), "id_cart_rule_2"),
}

View File

@@ -1,8 +1,8 @@
// Code generated by gorm.io/gen. DO NOT EDIT. // Code generated by gormcol. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
package prestadb package dbmodel
import "git.ma-al.com/goc_marek/gormcol"
const TableNamePsCartRuleCountry = "ps_cart_rule_country" const TableNamePsCartRuleCountry = "ps_cart_rule_country"
@@ -16,3 +16,11 @@ type PsCartRuleCountry struct {
func (*PsCartRuleCountry) TableName() string { func (*PsCartRuleCountry) TableName() string {
return TableNamePsCartRuleCountry return TableNamePsCartRuleCountry
} }
var PsCartRuleCountryCols = struct {
IDCartRule gormcol.Field
IDCountry gormcol.Field
}{
IDCartRule: gormcol.Field{}.Set((&PsCartRuleCountry{}).TableName(), "id_cart_rule"),
IDCountry: gormcol.Field{}.Set((&PsCartRuleCountry{}).TableName(), "id_country"),
}

View File

@@ -1,8 +1,8 @@
// Code generated by gorm.io/gen. DO NOT EDIT. // Code generated by gormcol. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
package prestadb package dbmodel
import "git.ma-al.com/goc_marek/gormcol"
const TableNamePsCartRuleGroup = "ps_cart_rule_group" const TableNamePsCartRuleGroup = "ps_cart_rule_group"
@@ -16,3 +16,11 @@ type PsCartRuleGroup struct {
func (*PsCartRuleGroup) TableName() string { func (*PsCartRuleGroup) TableName() string {
return TableNamePsCartRuleGroup return TableNamePsCartRuleGroup
} }
var PsCartRuleGroupCols = struct {
IDCartRule gormcol.Field
IDGroup gormcol.Field
}{
IDCartRule: gormcol.Field{}.Set((&PsCartRuleGroup{}).TableName(), "id_cart_rule"),
IDGroup: gormcol.Field{}.Set((&PsCartRuleGroup{}).TableName(), "id_group"),
}

View File

@@ -1,8 +1,8 @@
// Code generated by gorm.io/gen. DO NOT EDIT. // Code generated by gormcol. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
package prestadb package dbmodel
import "git.ma-al.com/goc_marek/gormcol"
const TableNamePsCartRuleLang = "ps_cart_rule_lang" const TableNamePsCartRuleLang = "ps_cart_rule_lang"
@@ -17,3 +17,13 @@ type PsCartRuleLang struct {
func (*PsCartRuleLang) TableName() string { func (*PsCartRuleLang) TableName() string {
return TableNamePsCartRuleLang return TableNamePsCartRuleLang
} }
var PsCartRuleLangCols = struct {
IDCartRule gormcol.Field
IDLang gormcol.Field
Name gormcol.Field
}{
IDCartRule: gormcol.Field{}.Set((&PsCartRuleLang{}).TableName(), "id_cart_rule"),
IDLang: gormcol.Field{}.Set((&PsCartRuleLang{}).TableName(), "id_lang"),
Name: gormcol.Field{}.Set((&PsCartRuleLang{}).TableName(), "name"),
}

View File

@@ -1,8 +1,8 @@
// Code generated by gorm.io/gen. DO NOT EDIT. // Code generated by gormcol. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
package prestadb package dbmodel
import "git.ma-al.com/goc_marek/gormcol"
const TableNamePsCartRuleProductRule = "ps_cart_rule_product_rule" const TableNamePsCartRuleProductRule = "ps_cart_rule_product_rule"
@@ -17,3 +17,13 @@ type PsCartRuleProductRule struct {
func (*PsCartRuleProductRule) TableName() string { func (*PsCartRuleProductRule) TableName() string {
return TableNamePsCartRuleProductRule return TableNamePsCartRuleProductRule
} }
var PsCartRuleProductRuleCols = struct {
IDProductRule gormcol.Field
IDProductRuleGroup gormcol.Field
Type gormcol.Field
}{
IDProductRule: gormcol.Field{}.Set((&PsCartRuleProductRule{}).TableName(), "id_product_rule"),
IDProductRuleGroup: gormcol.Field{}.Set((&PsCartRuleProductRule{}).TableName(), "id_product_rule_group"),
Type: gormcol.Field{}.Set((&PsCartRuleProductRule{}).TableName(), "type"),
}

View File

@@ -1,8 +1,8 @@
// Code generated by gorm.io/gen. DO NOT EDIT. // Code generated by gormcol. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
package prestadb package dbmodel
import "git.ma-al.com/goc_marek/gormcol"
const TableNamePsCartRuleProductRuleGroup = "ps_cart_rule_product_rule_group" const TableNamePsCartRuleProductRuleGroup = "ps_cart_rule_product_rule_group"
@@ -17,3 +17,13 @@ type PsCartRuleProductRuleGroup struct {
func (*PsCartRuleProductRuleGroup) TableName() string { func (*PsCartRuleProductRuleGroup) TableName() string {
return TableNamePsCartRuleProductRuleGroup return TableNamePsCartRuleProductRuleGroup
} }
var PsCartRuleProductRuleGroupCols = struct {
IDProductRuleGroup gormcol.Field
IDCartRule gormcol.Field
Quantity gormcol.Field
}{
IDProductRuleGroup: gormcol.Field{}.Set((&PsCartRuleProductRuleGroup{}).TableName(), "id_product_rule_group"),
IDCartRule: gormcol.Field{}.Set((&PsCartRuleProductRuleGroup{}).TableName(), "id_cart_rule"),
Quantity: gormcol.Field{}.Set((&PsCartRuleProductRuleGroup{}).TableName(), "quantity"),
}

View File

@@ -1,8 +1,8 @@
// Code generated by gorm.io/gen. DO NOT EDIT. // Code generated by gormcol. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
package prestadb package dbmodel
import "git.ma-al.com/goc_marek/gormcol"
const TableNamePsCartRuleProductRuleValue = "ps_cart_rule_product_rule_value" const TableNamePsCartRuleProductRuleValue = "ps_cart_rule_product_rule_value"
@@ -16,3 +16,11 @@ type PsCartRuleProductRuleValue struct {
func (*PsCartRuleProductRuleValue) TableName() string { func (*PsCartRuleProductRuleValue) TableName() string {
return TableNamePsCartRuleProductRuleValue return TableNamePsCartRuleProductRuleValue
} }
var PsCartRuleProductRuleValueCols = struct {
IDProductRule gormcol.Field
IDItem gormcol.Field
}{
IDProductRule: gormcol.Field{}.Set((&PsCartRuleProductRuleValue{}).TableName(), "id_product_rule"),
IDItem: gormcol.Field{}.Set((&PsCartRuleProductRuleValue{}).TableName(), "id_item"),
}

View File

@@ -1,8 +1,8 @@
// Code generated by gorm.io/gen. DO NOT EDIT. // Code generated by gormcol. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
package prestadb package dbmodel
import "git.ma-al.com/goc_marek/gormcol"
const TableNamePsCartRuleShop = "ps_cart_rule_shop" const TableNamePsCartRuleShop = "ps_cart_rule_shop"
@@ -16,3 +16,11 @@ type PsCartRuleShop struct {
func (*PsCartRuleShop) TableName() string { func (*PsCartRuleShop) TableName() string {
return TableNamePsCartRuleShop return TableNamePsCartRuleShop
} }
var PsCartRuleShopCols = struct {
IDCartRule gormcol.Field
IDShop gormcol.Field
}{
IDCartRule: gormcol.Field{}.Set((&PsCartRuleShop{}).TableName(), "id_cart_rule"),
IDShop: gormcol.Field{}.Set((&PsCartRuleShop{}).TableName(), "id_shop"),
}

View File

@@ -1,10 +1,9 @@
// Code generated by gorm.io/gen. DO NOT EDIT. // Code generated by gormcol. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
package prestadb package dbmodel
import ( import (
"git.ma-al.com/goc_marek/gormcol"
"time" "time"
) )
@@ -29,3 +28,29 @@ type PsCategory struct {
func (*PsCategory) TableName() string { func (*PsCategory) TableName() string {
return TableNamePsCategory return TableNamePsCategory
} }
var PsCategoryCols = struct {
IDCategory gormcol.Field
IDParent gormcol.Field
IDShopDefault gormcol.Field
LevelDepth gormcol.Field
Nleft gormcol.Field
Nright gormcol.Field
Active gormcol.Field
DateAdd gormcol.Field
DateUpd gormcol.Field
Position gormcol.Field
IsRootCategory gormcol.Field
}{
IDCategory: gormcol.Field{}.Set((&PsCategory{}).TableName(), "id_category"),
IDParent: gormcol.Field{}.Set((&PsCategory{}).TableName(), "id_parent"),
IDShopDefault: gormcol.Field{}.Set((&PsCategory{}).TableName(), "id_shop_default"),
LevelDepth: gormcol.Field{}.Set((&PsCategory{}).TableName(), "level_depth"),
Nleft: gormcol.Field{}.Set((&PsCategory{}).TableName(), "nleft"),
Nright: gormcol.Field{}.Set((&PsCategory{}).TableName(), "nright"),
Active: gormcol.Field{}.Set((&PsCategory{}).TableName(), "active"),
DateAdd: gormcol.Field{}.Set((&PsCategory{}).TableName(), "date_add"),
DateUpd: gormcol.Field{}.Set((&PsCategory{}).TableName(), "date_upd"),
Position: gormcol.Field{}.Set((&PsCategory{}).TableName(), "position"),
IsRootCategory: gormcol.Field{}.Set((&PsCategory{}).TableName(), "is_root_category"),
}

View File

@@ -1,8 +1,8 @@
// Code generated by gorm.io/gen. DO NOT EDIT. // Code generated by gormcol. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
package prestadb package dbmodel
import "git.ma-al.com/goc_marek/gormcol"
const TableNamePsCategoryGroup = "ps_category_group" const TableNamePsCategoryGroup = "ps_category_group"
@@ -16,3 +16,11 @@ type PsCategoryGroup struct {
func (*PsCategoryGroup) TableName() string { func (*PsCategoryGroup) TableName() string {
return TableNamePsCategoryGroup return TableNamePsCategoryGroup
} }
var PsCategoryGroupCols = struct {
IDCategory gormcol.Field
IDGroup gormcol.Field
}{
IDCategory: gormcol.Field{}.Set((&PsCategoryGroup{}).TableName(), "id_category"),
IDGroup: gormcol.Field{}.Set((&PsCategoryGroup{}).TableName(), "id_group"),
}

View File

@@ -0,0 +1,47 @@
// Code generated by gormcol. DO NOT EDIT.
package dbmodel
import "git.ma-al.com/goc_marek/gormcol"
const TableNamePsCategoryLang = "ps_category_lang"
// PsCategoryLang mapped from table <ps_category_lang>
type PsCategoryLang struct {
IDCategory int32 `gorm:"column:id_category;primaryKey" json:"id_category"`
IDShop int32 `gorm:"column:id_shop;primaryKey;default:1" json:"id_shop"`
IDLang int32 `gorm:"column:id_lang;primaryKey" json:"id_lang"`
Name string `gorm:"column:name;not null;index:category_name,priority:1" json:"name"`
Description *string `gorm:"column:description" json:"description"`
LinkRewrite string `gorm:"column:link_rewrite;not null" json:"link_rewrite"`
MetaTitle *string `gorm:"column:meta_title" json:"meta_title"`
MetaKeywords *string `gorm:"column:meta_keywords" json:"meta_keywords"`
MetaDescription *string `gorm:"column:meta_description" json:"meta_description"`
}
// TableName PsCategoryLang's table name
func (*PsCategoryLang) TableName() string {
return TableNamePsCategoryLang
}
var PsCategoryLangCols = struct {
IDCategory gormcol.Field
IDShop gormcol.Field
IDLang gormcol.Field
Name gormcol.Field
Description gormcol.Field
LinkRewrite gormcol.Field
MetaTitle gormcol.Field
MetaKeywords gormcol.Field
MetaDescription gormcol.Field
}{
IDCategory: gormcol.Field{}.Set((&PsCategoryLang{}).TableName(), "id_category"),
IDShop: gormcol.Field{}.Set((&PsCategoryLang{}).TableName(), "id_shop"),
IDLang: gormcol.Field{}.Set((&PsCategoryLang{}).TableName(), "id_lang"),
Name: gormcol.Field{}.Set((&PsCategoryLang{}).TableName(), "name"),
Description: gormcol.Field{}.Set((&PsCategoryLang{}).TableName(), "description"),
LinkRewrite: gormcol.Field{}.Set((&PsCategoryLang{}).TableName(), "link_rewrite"),
MetaTitle: gormcol.Field{}.Set((&PsCategoryLang{}).TableName(), "meta_title"),
MetaKeywords: gormcol.Field{}.Set((&PsCategoryLang{}).TableName(), "meta_keywords"),
MetaDescription: gormcol.Field{}.Set((&PsCategoryLang{}).TableName(), "meta_description"),
}

View File

@@ -1,8 +1,8 @@
// Code generated by gorm.io/gen. DO NOT EDIT. // Code generated by gormcol. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
package prestadb package dbmodel
import "git.ma-al.com/goc_marek/gormcol"
const TableNamePsCategoryProduct = "ps_category_product" const TableNamePsCategoryProduct = "ps_category_product"
@@ -17,3 +17,13 @@ type PsCategoryProduct struct {
func (*PsCategoryProduct) TableName() string { func (*PsCategoryProduct) TableName() string {
return TableNamePsCategoryProduct return TableNamePsCategoryProduct
} }
var PsCategoryProductCols = struct {
IDCategory gormcol.Field
IDProduct gormcol.Field
Position gormcol.Field
}{
IDCategory: gormcol.Field{}.Set((&PsCategoryProduct{}).TableName(), "id_category"),
IDProduct: gormcol.Field{}.Set((&PsCategoryProduct{}).TableName(), "id_product"),
Position: gormcol.Field{}.Set((&PsCategoryProduct{}).TableName(), "position"),
}

View File

@@ -1,8 +1,8 @@
// Code generated by gorm.io/gen. DO NOT EDIT. // Code generated by gormcol. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
package prestadb package dbmodel
import "git.ma-al.com/goc_marek/gormcol"
const TableNamePsCategoryShop = "ps_category_shop" const TableNamePsCategoryShop = "ps_category_shop"
@@ -17,3 +17,13 @@ type PsCategoryShop struct {
func (*PsCategoryShop) TableName() string { func (*PsCategoryShop) TableName() string {
return TableNamePsCategoryShop return TableNamePsCategoryShop
} }
var PsCategoryShopCols = struct {
IDCategory gormcol.Field
IDShop gormcol.Field
Position gormcol.Field
}{
IDCategory: gormcol.Field{}.Set((&PsCategoryShop{}).TableName(), "id_category"),
IDShop: gormcol.Field{}.Set((&PsCategoryShop{}).TableName(), "id_shop"),
Position: gormcol.Field{}.Set((&PsCategoryShop{}).TableName(), "position"),
}

View File

@@ -0,0 +1,35 @@
// Code generated by gormcol. DO NOT EDIT.
package dbmodel
import "git.ma-al.com/goc_marek/gormcol"
const TableNamePsCm = "ps_cms"
// PsCm mapped from table <ps_cms>
type PsCm struct {
IDCms int32 `gorm:"column:id_cms;primaryKey;autoIncrement:true" json:"id_cms"`
IDCmsCategory int32 `gorm:"column:id_cms_category;not null" json:"id_cms_category"`
Position int32 `gorm:"column:position;not null" json:"position"`
Active bool `gorm:"column:active;not null" json:"active"`
Indexation bool `gorm:"column:indexation;not null;default:1" json:"indexation"`
}
// TableName PsCm's table name
func (*PsCm) TableName() string {
return TableNamePsCm
}
var PsCmCols = struct {
IDCms gormcol.Field
IDCmsCategory gormcol.Field
Position gormcol.Field
Active gormcol.Field
Indexation gormcol.Field
}{
IDCms: gormcol.Field{}.Set((&PsCm{}).TableName(), "id_cms"),
IDCmsCategory: gormcol.Field{}.Set((&PsCm{}).TableName(), "id_cms_category"),
Position: gormcol.Field{}.Set((&PsCm{}).TableName(), "position"),
Active: gormcol.Field{}.Set((&PsCm{}).TableName(), "active"),
Indexation: gormcol.Field{}.Set((&PsCm{}).TableName(), "indexation"),
}

View File

@@ -1,10 +1,9 @@
// Code generated by gorm.io/gen. DO NOT EDIT. // Code generated by gormcol. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
package prestadb package dbmodel
import ( import (
"git.ma-al.com/goc_marek/gormcol"
"time" "time"
) )
@@ -25,3 +24,21 @@ type PsCmsCategory struct {
func (*PsCmsCategory) TableName() string { func (*PsCmsCategory) TableName() string {
return TableNamePsCmsCategory return TableNamePsCmsCategory
} }
var PsCmsCategoryCols = struct {
IDCmsCategory gormcol.Field
IDParent gormcol.Field
LevelDepth gormcol.Field
Active gormcol.Field
DateAdd gormcol.Field
DateUpd gormcol.Field
Position gormcol.Field
}{
IDCmsCategory: gormcol.Field{}.Set((&PsCmsCategory{}).TableName(), "id_cms_category"),
IDParent: gormcol.Field{}.Set((&PsCmsCategory{}).TableName(), "id_parent"),
LevelDepth: gormcol.Field{}.Set((&PsCmsCategory{}).TableName(), "level_depth"),
Active: gormcol.Field{}.Set((&PsCmsCategory{}).TableName(), "active"),
DateAdd: gormcol.Field{}.Set((&PsCmsCategory{}).TableName(), "date_add"),
DateUpd: gormcol.Field{}.Set((&PsCmsCategory{}).TableName(), "date_upd"),
Position: gormcol.Field{}.Set((&PsCmsCategory{}).TableName(), "position"),
}

View File

@@ -0,0 +1,47 @@
// Code generated by gormcol. DO NOT EDIT.
package dbmodel
import "git.ma-al.com/goc_marek/gormcol"
const TableNamePsCmsCategoryLang = "ps_cms_category_lang"
// PsCmsCategoryLang mapped from table <ps_cms_category_lang>
type PsCmsCategoryLang struct {
IDCmsCategory int32 `gorm:"column:id_cms_category;primaryKey" json:"id_cms_category"`
IDLang int32 `gorm:"column:id_lang;primaryKey" json:"id_lang"`
IDShop int32 `gorm:"column:id_shop;primaryKey;default:1" json:"id_shop"`
Name string `gorm:"column:name;not null;index:category_name,priority:1" json:"name"`
Description *string `gorm:"column:description" json:"description"`
LinkRewrite string `gorm:"column:link_rewrite;not null" json:"link_rewrite"`
MetaTitle *string `gorm:"column:meta_title" json:"meta_title"`
MetaKeywords *string `gorm:"column:meta_keywords" json:"meta_keywords"`
MetaDescription *string `gorm:"column:meta_description" json:"meta_description"`
}
// TableName PsCmsCategoryLang's table name
func (*PsCmsCategoryLang) TableName() string {
return TableNamePsCmsCategoryLang
}
var PsCmsCategoryLangCols = struct {
IDCmsCategory gormcol.Field
IDLang gormcol.Field
IDShop gormcol.Field
Name gormcol.Field
Description gormcol.Field
LinkRewrite gormcol.Field
MetaTitle gormcol.Field
MetaKeywords gormcol.Field
MetaDescription gormcol.Field
}{
IDCmsCategory: gormcol.Field{}.Set((&PsCmsCategoryLang{}).TableName(), "id_cms_category"),
IDLang: gormcol.Field{}.Set((&PsCmsCategoryLang{}).TableName(), "id_lang"),
IDShop: gormcol.Field{}.Set((&PsCmsCategoryLang{}).TableName(), "id_shop"),
Name: gormcol.Field{}.Set((&PsCmsCategoryLang{}).TableName(), "name"),
Description: gormcol.Field{}.Set((&PsCmsCategoryLang{}).TableName(), "description"),
LinkRewrite: gormcol.Field{}.Set((&PsCmsCategoryLang{}).TableName(), "link_rewrite"),
MetaTitle: gormcol.Field{}.Set((&PsCmsCategoryLang{}).TableName(), "meta_title"),
MetaKeywords: gormcol.Field{}.Set((&PsCmsCategoryLang{}).TableName(), "meta_keywords"),
MetaDescription: gormcol.Field{}.Set((&PsCmsCategoryLang{}).TableName(), "meta_description"),
}

View File

@@ -1,8 +1,8 @@
// Code generated by gorm.io/gen. DO NOT EDIT. // Code generated by gormcol. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
package prestadb package dbmodel
import "git.ma-al.com/goc_marek/gormcol"
const TableNamePsCmsCategoryShop = "ps_cms_category_shop" const TableNamePsCmsCategoryShop = "ps_cms_category_shop"
@@ -16,3 +16,11 @@ type PsCmsCategoryShop struct {
func (*PsCmsCategoryShop) TableName() string { func (*PsCmsCategoryShop) TableName() string {
return TableNamePsCmsCategoryShop return TableNamePsCmsCategoryShop
} }
var PsCmsCategoryShopCols = struct {
IDCmsCategory gormcol.Field
IDShop gormcol.Field
}{
IDCmsCategory: gormcol.Field{}.Set((&PsCmsCategoryShop{}).TableName(), "id_cms_category"),
IDShop: gormcol.Field{}.Set((&PsCmsCategoryShop{}).TableName(), "id_shop"),
}

View File

@@ -0,0 +1,47 @@
// Code generated by gormcol. DO NOT EDIT.
package dbmodel
import "git.ma-al.com/goc_marek/gormcol"
const TableNamePsCmsLang = "ps_cms_lang"
// PsCmsLang mapped from table <ps_cms_lang>
type PsCmsLang struct {
IDCms int32 `gorm:"column:id_cms;primaryKey" json:"id_cms"`
IDLang int32 `gorm:"column:id_lang;primaryKey" json:"id_lang"`
IDShop int32 `gorm:"column:id_shop;primaryKey;default:1" json:"id_shop"`
MetaTitle string `gorm:"column:meta_title;not null" json:"meta_title"`
HeadSeoTitle *string `gorm:"column:head_seo_title" json:"head_seo_title"`
MetaDescription *string `gorm:"column:meta_description" json:"meta_description"`
MetaKeywords *string `gorm:"column:meta_keywords" json:"meta_keywords"`
Content *string `gorm:"column:content" json:"content"`
LinkRewrite string `gorm:"column:link_rewrite;not null" json:"link_rewrite"`
}
// TableName PsCmsLang's table name
func (*PsCmsLang) TableName() string {
return TableNamePsCmsLang
}
var PsCmsLangCols = struct {
IDCms gormcol.Field
IDLang gormcol.Field
IDShop gormcol.Field
MetaTitle gormcol.Field
HeadSeoTitle gormcol.Field
MetaDescription gormcol.Field
MetaKeywords gormcol.Field
Content gormcol.Field
LinkRewrite gormcol.Field
}{
IDCms: gormcol.Field{}.Set((&PsCmsLang{}).TableName(), "id_cms"),
IDLang: gormcol.Field{}.Set((&PsCmsLang{}).TableName(), "id_lang"),
IDShop: gormcol.Field{}.Set((&PsCmsLang{}).TableName(), "id_shop"),
MetaTitle: gormcol.Field{}.Set((&PsCmsLang{}).TableName(), "meta_title"),
HeadSeoTitle: gormcol.Field{}.Set((&PsCmsLang{}).TableName(), "head_seo_title"),
MetaDescription: gormcol.Field{}.Set((&PsCmsLang{}).TableName(), "meta_description"),
MetaKeywords: gormcol.Field{}.Set((&PsCmsLang{}).TableName(), "meta_keywords"),
Content: gormcol.Field{}.Set((&PsCmsLang{}).TableName(), "content"),
LinkRewrite: gormcol.Field{}.Set((&PsCmsLang{}).TableName(), "link_rewrite"),
}

View File

@@ -1,8 +1,8 @@
// Code generated by gorm.io/gen. DO NOT EDIT. // Code generated by gormcol. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
package prestadb package dbmodel
import "git.ma-al.com/goc_marek/gormcol"
const TableNamePsCmsRole = "ps_cms_role" const TableNamePsCmsRole = "ps_cms_role"
@@ -17,3 +17,13 @@ type PsCmsRole struct {
func (*PsCmsRole) TableName() string { func (*PsCmsRole) TableName() string {
return TableNamePsCmsRole return TableNamePsCmsRole
} }
var PsCmsRoleCols = struct {
IDCmsRole gormcol.Field
Name gormcol.Field
IDCms gormcol.Field
}{
IDCmsRole: gormcol.Field{}.Set((&PsCmsRole{}).TableName(), "id_cms_role"),
Name: gormcol.Field{}.Set((&PsCmsRole{}).TableName(), "name"),
IDCms: gormcol.Field{}.Set((&PsCmsRole{}).TableName(), "id_cms"),
}

View File

@@ -0,0 +1,32 @@
// Code generated by gormcol. DO NOT EDIT.
package dbmodel
import "git.ma-al.com/goc_marek/gormcol"
const TableNamePsCmsRoleLang = "ps_cms_role_lang"
// PsCmsRoleLang mapped from table <ps_cms_role_lang>
type PsCmsRoleLang struct {
IDCmsRole int32 `gorm:"column:id_cms_role;primaryKey" json:"id_cms_role"`
IDLang int32 `gorm:"column:id_lang;primaryKey" json:"id_lang"`
IDShop int32 `gorm:"column:id_shop;primaryKey" json:"id_shop"`
Name *string `gorm:"column:name" json:"name"`
}
// TableName PsCmsRoleLang's table name
func (*PsCmsRoleLang) TableName() string {
return TableNamePsCmsRoleLang
}
var PsCmsRoleLangCols = struct {
IDCmsRole gormcol.Field
IDLang gormcol.Field
IDShop gormcol.Field
Name gormcol.Field
}{
IDCmsRole: gormcol.Field{}.Set((&PsCmsRoleLang{}).TableName(), "id_cms_role"),
IDLang: gormcol.Field{}.Set((&PsCmsRoleLang{}).TableName(), "id_lang"),
IDShop: gormcol.Field{}.Set((&PsCmsRoleLang{}).TableName(), "id_shop"),
Name: gormcol.Field{}.Set((&PsCmsRoleLang{}).TableName(), "name"),
}

View File

@@ -1,8 +1,8 @@
// Code generated by gorm.io/gen. DO NOT EDIT. // Code generated by gormcol. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
package prestadb package dbmodel
import "git.ma-al.com/goc_marek/gormcol"
const TableNamePsCmsShop = "ps_cms_shop" const TableNamePsCmsShop = "ps_cms_shop"
@@ -16,3 +16,11 @@ type PsCmsShop struct {
func (*PsCmsShop) TableName() string { func (*PsCmsShop) TableName() string {
return TableNamePsCmsShop return TableNamePsCmsShop
} }
var PsCmsShopCols = struct {
IDCms gormcol.Field
IDShop gormcol.Field
}{
IDCms: gormcol.Field{}.Set((&PsCmsShop{}).TableName(), "id_cms"),
IDShop: gormcol.Field{}.Set((&PsCmsShop{}).TableName(), "id_shop"),
}

View File

@@ -0,0 +1,59 @@
// Code generated by gormcol. DO NOT EDIT.
package dbmodel
import (
"git.ma-al.com/goc_marek/gormcol"
"time"
)
const TableNamePsCondition = "ps_condition"
// PsCondition mapped from table <ps_condition>
type PsCondition struct {
IDCondition int32 `gorm:"column:id_condition;primaryKey;autoIncrement:true" json:"id_condition"`
IDPsCondition int32 `gorm:"column:id_ps_condition;primaryKey" json:"id_ps_condition"`
Type string `gorm:"column:type;not null" json:"type"`
Request *string `gorm:"column:request" json:"request"`
Operator *string `gorm:"column:operator" json:"operator"`
Value *string `gorm:"column:value" json:"value"`
Result *string `gorm:"column:result" json:"result"`
CalculationType *string `gorm:"column:calculation_type" json:"calculation_type"`
CalculationDetail *string `gorm:"column:calculation_detail" json:"calculation_detail"`
Validated bool `gorm:"column:validated;not null" json:"validated"`
DateAdd time.Time `gorm:"column:date_add;not null" json:"date_add"`
DateUpd time.Time `gorm:"column:date_upd;not null" json:"date_upd"`
}
// TableName PsCondition's table name
func (*PsCondition) TableName() string {
return TableNamePsCondition
}
var PsConditionCols = struct {
IDCondition gormcol.Field
IDPsCondition gormcol.Field
Type gormcol.Field
Request gormcol.Field
Operator gormcol.Field
Value gormcol.Field
Result gormcol.Field
CalculationType gormcol.Field
CalculationDetail gormcol.Field
Validated gormcol.Field
DateAdd gormcol.Field
DateUpd gormcol.Field
}{
IDCondition: gormcol.Field{}.Set((&PsCondition{}).TableName(), "id_condition"),
IDPsCondition: gormcol.Field{}.Set((&PsCondition{}).TableName(), "id_ps_condition"),
Type: gormcol.Field{}.Set((&PsCondition{}).TableName(), "type"),
Request: gormcol.Field{}.Set((&PsCondition{}).TableName(), "request"),
Operator: gormcol.Field{}.Set((&PsCondition{}).TableName(), "operator"),
Value: gormcol.Field{}.Set((&PsCondition{}).TableName(), "value"),
Result: gormcol.Field{}.Set((&PsCondition{}).TableName(), "result"),
CalculationType: gormcol.Field{}.Set((&PsCondition{}).TableName(), "calculation_type"),
CalculationDetail: gormcol.Field{}.Set((&PsCondition{}).TableName(), "calculation_detail"),
Validated: gormcol.Field{}.Set((&PsCondition{}).TableName(), "validated"),
DateAdd: gormcol.Field{}.Set((&PsCondition{}).TableName(), "date_add"),
DateUpd: gormcol.Field{}.Set((&PsCondition{}).TableName(), "date_upd"),
}

View File

@@ -1,8 +1,8 @@
// Code generated by gorm.io/gen. DO NOT EDIT. // Code generated by gormcol. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
package prestadb package dbmodel
import "git.ma-al.com/goc_marek/gormcol"
const TableNamePsConditionAdvice = "ps_condition_advice" const TableNamePsConditionAdvice = "ps_condition_advice"
@@ -17,3 +17,13 @@ type PsConditionAdvice struct {
func (*PsConditionAdvice) TableName() string { func (*PsConditionAdvice) TableName() string {
return TableNamePsConditionAdvice return TableNamePsConditionAdvice
} }
var PsConditionAdviceCols = struct {
IDCondition gormcol.Field
IDAdvice gormcol.Field
Display gormcol.Field
}{
IDCondition: gormcol.Field{}.Set((&PsConditionAdvice{}).TableName(), "id_condition"),
IDAdvice: gormcol.Field{}.Set((&PsConditionAdvice{}).TableName(), "id_advice"),
Display: gormcol.Field{}.Set((&PsConditionAdvice{}).TableName(), "display"),
}

View File

@@ -1,8 +1,8 @@
// Code generated by gorm.io/gen. DO NOT EDIT. // Code generated by gormcol. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
package prestadb package dbmodel
import "git.ma-al.com/goc_marek/gormcol"
const TableNamePsConditionBadge = "ps_condition_badge" const TableNamePsConditionBadge = "ps_condition_badge"
@@ -16,3 +16,11 @@ type PsConditionBadge struct {
func (*PsConditionBadge) TableName() string { func (*PsConditionBadge) TableName() string {
return TableNamePsConditionBadge return TableNamePsConditionBadge
} }
var PsConditionBadgeCols = struct {
IDCondition gormcol.Field
IDBadge gormcol.Field
}{
IDCondition: gormcol.Field{}.Set((&PsConditionBadge{}).TableName(), "id_condition"),
IDBadge: gormcol.Field{}.Set((&PsConditionBadge{}).TableName(), "id_badge"),
}

View File

@@ -1,10 +1,9 @@
// Code generated by gorm.io/gen. DO NOT EDIT. // Code generated by gormcol. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
package prestadb package dbmodel
import ( import (
"git.ma-al.com/goc_marek/gormcol"
"time" "time"
) )
@@ -25,3 +24,21 @@ type PsConfiguration struct {
func (*PsConfiguration) TableName() string { func (*PsConfiguration) TableName() string {
return TableNamePsConfiguration return TableNamePsConfiguration
} }
var PsConfigurationCols = struct {
IDConfiguration gormcol.Field
IDShopGroup gormcol.Field
IDShop gormcol.Field
Name gormcol.Field
Value gormcol.Field
DateAdd gormcol.Field
DateUpd gormcol.Field
}{
IDConfiguration: gormcol.Field{}.Set((&PsConfiguration{}).TableName(), "id_configuration"),
IDShopGroup: gormcol.Field{}.Set((&PsConfiguration{}).TableName(), "id_shop_group"),
IDShop: gormcol.Field{}.Set((&PsConfiguration{}).TableName(), "id_shop"),
Name: gormcol.Field{}.Set((&PsConfiguration{}).TableName(), "name"),
Value: gormcol.Field{}.Set((&PsConfiguration{}).TableName(), "value"),
DateAdd: gormcol.Field{}.Set((&PsConfiguration{}).TableName(), "date_add"),
DateUpd: gormcol.Field{}.Set((&PsConfiguration{}).TableName(), "date_upd"),
}

View File

@@ -1,10 +1,9 @@
// Code generated by gorm.io/gen. DO NOT EDIT. // Code generated by gormcol. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
package prestadb package dbmodel
import ( import (
"git.ma-al.com/goc_marek/gormcol"
"time" "time"
) )
@@ -25,3 +24,21 @@ type PsConfigurationKpi struct {
func (*PsConfigurationKpi) TableName() string { func (*PsConfigurationKpi) TableName() string {
return TableNamePsConfigurationKpi return TableNamePsConfigurationKpi
} }
var PsConfigurationKpiCols = struct {
IDConfigurationKpi gormcol.Field
IDShopGroup gormcol.Field
IDShop gormcol.Field
Name gormcol.Field
Value gormcol.Field
DateAdd gormcol.Field
DateUpd gormcol.Field
}{
IDConfigurationKpi: gormcol.Field{}.Set((&PsConfigurationKpi{}).TableName(), "id_configuration_kpi"),
IDShopGroup: gormcol.Field{}.Set((&PsConfigurationKpi{}).TableName(), "id_shop_group"),
IDShop: gormcol.Field{}.Set((&PsConfigurationKpi{}).TableName(), "id_shop"),
Name: gormcol.Field{}.Set((&PsConfigurationKpi{}).TableName(), "name"),
Value: gormcol.Field{}.Set((&PsConfigurationKpi{}).TableName(), "value"),
DateAdd: gormcol.Field{}.Set((&PsConfigurationKpi{}).TableName(), "date_add"),
DateUpd: gormcol.Field{}.Set((&PsConfigurationKpi{}).TableName(), "date_upd"),
}

View File

@@ -1,10 +1,9 @@
// Code generated by gorm.io/gen. DO NOT EDIT. // Code generated by gormcol. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
package prestadb package dbmodel
import ( import (
"git.ma-al.com/goc_marek/gormcol"
"time" "time"
) )
@@ -22,3 +21,15 @@ type PsConfigurationKpiLang struct {
func (*PsConfigurationKpiLang) TableName() string { func (*PsConfigurationKpiLang) TableName() string {
return TableNamePsConfigurationKpiLang return TableNamePsConfigurationKpiLang
} }
var PsConfigurationKpiLangCols = struct {
IDConfigurationKpi gormcol.Field
IDLang gormcol.Field
Value gormcol.Field
DateUpd gormcol.Field
}{
IDConfigurationKpi: gormcol.Field{}.Set((&PsConfigurationKpiLang{}).TableName(), "id_configuration_kpi"),
IDLang: gormcol.Field{}.Set((&PsConfigurationKpiLang{}).TableName(), "id_lang"),
Value: gormcol.Field{}.Set((&PsConfigurationKpiLang{}).TableName(), "value"),
DateUpd: gormcol.Field{}.Set((&PsConfigurationKpiLang{}).TableName(), "date_upd"),
}

View File

@@ -1,10 +1,9 @@
// Code generated by gorm.io/gen. DO NOT EDIT. // Code generated by gormcol. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
package prestadb package dbmodel
import ( import (
"git.ma-al.com/goc_marek/gormcol"
"time" "time"
) )
@@ -22,3 +21,15 @@ type PsConfigurationLang struct {
func (*PsConfigurationLang) TableName() string { func (*PsConfigurationLang) TableName() string {
return TableNamePsConfigurationLang return TableNamePsConfigurationLang
} }
var PsConfigurationLangCols = struct {
IDConfiguration gormcol.Field
IDLang gormcol.Field
Value gormcol.Field
DateUpd gormcol.Field
}{
IDConfiguration: gormcol.Field{}.Set((&PsConfigurationLang{}).TableName(), "id_configuration"),
IDLang: gormcol.Field{}.Set((&PsConfigurationLang{}).TableName(), "id_lang"),
Value: gormcol.Field{}.Set((&PsConfigurationLang{}).TableName(), "value"),
DateUpd: gormcol.Field{}.Set((&PsConfigurationLang{}).TableName(), "date_upd"),
}

View File

@@ -1,10 +1,9 @@
// Code generated by gorm.io/gen. DO NOT EDIT. // Code generated by gormcol. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
package prestadb package dbmodel
import ( import (
"git.ma-al.com/goc_marek/gormcol"
"time" "time"
) )
@@ -26,3 +25,23 @@ type PsConnection struct {
func (*PsConnection) TableName() string { func (*PsConnection) TableName() string {
return TableNamePsConnection return TableNamePsConnection
} }
var PsConnectionCols = struct {
IDConnections gormcol.Field
IDShopGroup gormcol.Field
IDShop gormcol.Field
IDGuest gormcol.Field
IDPage gormcol.Field
IPAddress gormcol.Field
DateAdd gormcol.Field
HTTPReferer gormcol.Field
}{
IDConnections: gormcol.Field{}.Set((&PsConnection{}).TableName(), "id_connections"),
IDShopGroup: gormcol.Field{}.Set((&PsConnection{}).TableName(), "id_shop_group"),
IDShop: gormcol.Field{}.Set((&PsConnection{}).TableName(), "id_shop"),
IDGuest: gormcol.Field{}.Set((&PsConnection{}).TableName(), "id_guest"),
IDPage: gormcol.Field{}.Set((&PsConnection{}).TableName(), "id_page"),
IPAddress: gormcol.Field{}.Set((&PsConnection{}).TableName(), "ip_address"),
DateAdd: gormcol.Field{}.Set((&PsConnection{}).TableName(), "date_add"),
HTTPReferer: gormcol.Field{}.Set((&PsConnection{}).TableName(), "http_referer"),
}

View File

@@ -1,10 +1,9 @@
// Code generated by gorm.io/gen. DO NOT EDIT. // Code generated by gormcol. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
package prestadb package dbmodel
import ( import (
"git.ma-al.com/goc_marek/gormcol"
"time" "time"
) )
@@ -22,3 +21,15 @@ type PsConnectionsPage struct {
func (*PsConnectionsPage) TableName() string { func (*PsConnectionsPage) TableName() string {
return TableNamePsConnectionsPage return TableNamePsConnectionsPage
} }
var PsConnectionsPageCols = struct {
IDConnections gormcol.Field
IDPage gormcol.Field
TimeStart gormcol.Field
TimeEnd gormcol.Field
}{
IDConnections: gormcol.Field{}.Set((&PsConnectionsPage{}).TableName(), "id_connections"),
IDPage: gormcol.Field{}.Set((&PsConnectionsPage{}).TableName(), "id_page"),
TimeStart: gormcol.Field{}.Set((&PsConnectionsPage{}).TableName(), "time_start"),
TimeEnd: gormcol.Field{}.Set((&PsConnectionsPage{}).TableName(), "time_end"),
}

View File

@@ -1,10 +1,9 @@
// Code generated by gorm.io/gen. DO NOT EDIT. // Code generated by gormcol. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
package prestadb package dbmodel
import ( import (
"git.ma-al.com/goc_marek/gormcol"
"time" "time"
) )
@@ -24,3 +23,19 @@ type PsConnectionsSource struct {
func (*PsConnectionsSource) TableName() string { func (*PsConnectionsSource) TableName() string {
return TableNamePsConnectionsSource return TableNamePsConnectionsSource
} }
var PsConnectionsSourceCols = struct {
IDConnectionsSource gormcol.Field
IDConnections gormcol.Field
HTTPReferer gormcol.Field
RequestURI gormcol.Field
Keywords gormcol.Field
DateAdd gormcol.Field
}{
IDConnectionsSource: gormcol.Field{}.Set((&PsConnectionsSource{}).TableName(), "id_connections_source"),
IDConnections: gormcol.Field{}.Set((&PsConnectionsSource{}).TableName(), "id_connections"),
HTTPReferer: gormcol.Field{}.Set((&PsConnectionsSource{}).TableName(), "http_referer"),
RequestURI: gormcol.Field{}.Set((&PsConnectionsSource{}).TableName(), "request_uri"),
Keywords: gormcol.Field{}.Set((&PsConnectionsSource{}).TableName(), "keywords"),
DateAdd: gormcol.Field{}.Set((&PsConnectionsSource{}).TableName(), "date_add"),
}

View File

@@ -1,8 +1,8 @@
// Code generated by gorm.io/gen. DO NOT EDIT. // Code generated by gormcol. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
package prestadb package dbmodel
import "git.ma-al.com/goc_marek/gormcol"
const TableNamePsContact = "ps_contact" const TableNamePsContact = "ps_contact"
@@ -18,3 +18,15 @@ type PsContact struct {
func (*PsContact) TableName() string { func (*PsContact) TableName() string {
return TableNamePsContact return TableNamePsContact
} }
var PsContactCols = struct {
IDContact gormcol.Field
Email gormcol.Field
CustomerService gormcol.Field
Position gormcol.Field
}{
IDContact: gormcol.Field{}.Set((&PsContact{}).TableName(), "id_contact"),
Email: gormcol.Field{}.Set((&PsContact{}).TableName(), "email"),
CustomerService: gormcol.Field{}.Set((&PsContact{}).TableName(), "customer_service"),
Position: gormcol.Field{}.Set((&PsContact{}).TableName(), "position"),
}

View File

@@ -0,0 +1,32 @@
// Code generated by gormcol. DO NOT EDIT.
package dbmodel
import "git.ma-al.com/goc_marek/gormcol"
const TableNamePsContactLang = "ps_contact_lang"
// PsContactLang mapped from table <ps_contact_lang>
type PsContactLang struct {
IDContact int32 `gorm:"column:id_contact;primaryKey" json:"id_contact"`
IDLang int32 `gorm:"column:id_lang;primaryKey" json:"id_lang"`
Name string `gorm:"column:name;not null" json:"name"`
Description *string `gorm:"column:description" json:"description"`
}
// TableName PsContactLang's table name
func (*PsContactLang) TableName() string {
return TableNamePsContactLang
}
var PsContactLangCols = struct {
IDContact gormcol.Field
IDLang gormcol.Field
Name gormcol.Field
Description gormcol.Field
}{
IDContact: gormcol.Field{}.Set((&PsContactLang{}).TableName(), "id_contact"),
IDLang: gormcol.Field{}.Set((&PsContactLang{}).TableName(), "id_lang"),
Name: gormcol.Field{}.Set((&PsContactLang{}).TableName(), "name"),
Description: gormcol.Field{}.Set((&PsContactLang{}).TableName(), "description"),
}

View File

@@ -1,8 +1,8 @@
// Code generated by gorm.io/gen. DO NOT EDIT. // Code generated by gormcol. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
package prestadb package dbmodel
import "git.ma-al.com/goc_marek/gormcol"
const TableNamePsContactShop = "ps_contact_shop" const TableNamePsContactShop = "ps_contact_shop"
@@ -16,3 +16,11 @@ type PsContactShop struct {
func (*PsContactShop) TableName() string { func (*PsContactShop) TableName() string {
return TableNamePsContactShop return TableNamePsContactShop
} }
var PsContactShopCols = struct {
IDContact gormcol.Field
IDShop gormcol.Field
}{
IDContact: gormcol.Field{}.Set((&PsContactShop{}).TableName(), "id_contact"),
IDShop: gormcol.Field{}.Set((&PsContactShop{}).TableName(), "id_shop"),
}

View File

@@ -1,8 +1,8 @@
// Code generated by gorm.io/gen. DO NOT EDIT. // Code generated by gormcol. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
package prestadb package dbmodel
import "git.ma-al.com/goc_marek/gormcol"
const TableNamePsCountry = "ps_country" const TableNamePsCountry = "ps_country"
@@ -25,3 +25,29 @@ type PsCountry struct {
func (*PsCountry) TableName() string { func (*PsCountry) TableName() string {
return TableNamePsCountry return TableNamePsCountry
} }
var PsCountryCols = struct {
IDCountry gormcol.Field
IDZone gormcol.Field
IDCurrency gormcol.Field
IsoCode gormcol.Field
CallPrefix gormcol.Field
Active gormcol.Field
ContainsStates gormcol.Field
NeedIdentificationNumber gormcol.Field
NeedZipCode gormcol.Field
ZipCodeFormat gormcol.Field
DisplayTaxLabel gormcol.Field
}{
IDCountry: gormcol.Field{}.Set((&PsCountry{}).TableName(), "id_country"),
IDZone: gormcol.Field{}.Set((&PsCountry{}).TableName(), "id_zone"),
IDCurrency: gormcol.Field{}.Set((&PsCountry{}).TableName(), "id_currency"),
IsoCode: gormcol.Field{}.Set((&PsCountry{}).TableName(), "iso_code"),
CallPrefix: gormcol.Field{}.Set((&PsCountry{}).TableName(), "call_prefix"),
Active: gormcol.Field{}.Set((&PsCountry{}).TableName(), "active"),
ContainsStates: gormcol.Field{}.Set((&PsCountry{}).TableName(), "contains_states"),
NeedIdentificationNumber: gormcol.Field{}.Set((&PsCountry{}).TableName(), "need_identification_number"),
NeedZipCode: gormcol.Field{}.Set((&PsCountry{}).TableName(), "need_zip_code"),
ZipCodeFormat: gormcol.Field{}.Set((&PsCountry{}).TableName(), "zip_code_format"),
DisplayTaxLabel: gormcol.Field{}.Set((&PsCountry{}).TableName(), "display_tax_label"),
}

View File

@@ -1,8 +1,8 @@
// Code generated by gorm.io/gen. DO NOT EDIT. // Code generated by gormcol. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
package prestadb package dbmodel
import "git.ma-al.com/goc_marek/gormcol"
const TableNamePsCountryLang = "ps_country_lang" const TableNamePsCountryLang = "ps_country_lang"
@@ -17,3 +17,13 @@ type PsCountryLang struct {
func (*PsCountryLang) TableName() string { func (*PsCountryLang) TableName() string {
return TableNamePsCountryLang return TableNamePsCountryLang
} }
var PsCountryLangCols = struct {
IDCountry gormcol.Field
IDLang gormcol.Field
Name gormcol.Field
}{
IDCountry: gormcol.Field{}.Set((&PsCountryLang{}).TableName(), "id_country"),
IDLang: gormcol.Field{}.Set((&PsCountryLang{}).TableName(), "id_lang"),
Name: gormcol.Field{}.Set((&PsCountryLang{}).TableName(), "name"),
}

View File

@@ -1,8 +1,8 @@
// Code generated by gorm.io/gen. DO NOT EDIT. // Code generated by gormcol. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
package prestadb package dbmodel
import "git.ma-al.com/goc_marek/gormcol"
const TableNamePsCountryShop = "ps_country_shop" const TableNamePsCountryShop = "ps_country_shop"
@@ -16,3 +16,11 @@ type PsCountryShop struct {
func (*PsCountryShop) TableName() string { func (*PsCountryShop) TableName() string {
return TableNamePsCountryShop return TableNamePsCountryShop
} }
var PsCountryShopCols = struct {
IDCountry gormcol.Field
IDShop gormcol.Field
}{
IDCountry: gormcol.Field{}.Set((&PsCountryShop{}).TableName(), "id_country"),
IDShop: gormcol.Field{}.Set((&PsCountryShop{}).TableName(), "id_shop"),
}

View File

@@ -0,0 +1,44 @@
// Code generated by gormcol. DO NOT EDIT.
package dbmodel
import "git.ma-al.com/goc_marek/gormcol"
const TableNamePsCurrency = "ps_currency"
// PsCurrency mapped from table <ps_currency>
type PsCurrency struct {
IDCurrency int32 `gorm:"column:id_currency;primaryKey;autoIncrement:true" json:"id_currency"`
Name string `gorm:"column:name;not null" json:"name"`
IsoCode string `gorm:"column:iso_code;not null;index:currency_iso_code,priority:1;default:0" json:"iso_code"`
NumericIsoCode *string `gorm:"column:numeric_iso_code" json:"numeric_iso_code"`
Precision int32 `gorm:"column:precision;not null;default:6" json:"precision"`
ConversionRate float64 `gorm:"column:conversion_rate;not null" json:"conversion_rate"`
Deleted bool `gorm:"column:deleted;not null" json:"deleted"`
Active bool `gorm:"column:active;not null;default:1" json:"active"`
}
// TableName PsCurrency's table name
func (*PsCurrency) TableName() string {
return TableNamePsCurrency
}
var PsCurrencyCols = struct {
IDCurrency gormcol.Field
Name gormcol.Field
IsoCode gormcol.Field
NumericIsoCode gormcol.Field
Precision gormcol.Field
ConversionRate gormcol.Field
Deleted gormcol.Field
Active gormcol.Field
}{
IDCurrency: gormcol.Field{}.Set((&PsCurrency{}).TableName(), "id_currency"),
Name: gormcol.Field{}.Set((&PsCurrency{}).TableName(), "name"),
IsoCode: gormcol.Field{}.Set((&PsCurrency{}).TableName(), "iso_code"),
NumericIsoCode: gormcol.Field{}.Set((&PsCurrency{}).TableName(), "numeric_iso_code"),
Precision: gormcol.Field{}.Set((&PsCurrency{}).TableName(), "precision"),
ConversionRate: gormcol.Field{}.Set((&PsCurrency{}).TableName(), "conversion_rate"),
Deleted: gormcol.Field{}.Set((&PsCurrency{}).TableName(), "deleted"),
Active: gormcol.Field{}.Set((&PsCurrency{}).TableName(), "active"),
}

View File

@@ -1,8 +1,8 @@
// Code generated by gorm.io/gen. DO NOT EDIT. // Code generated by gormcol. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
package prestadb package dbmodel
import "git.ma-al.com/goc_marek/gormcol"
const TableNamePsCurrencyLang = "ps_currency_lang" const TableNamePsCurrencyLang = "ps_currency_lang"
@@ -18,3 +18,15 @@ type PsCurrencyLang struct {
func (*PsCurrencyLang) TableName() string { func (*PsCurrencyLang) TableName() string {
return TableNamePsCurrencyLang return TableNamePsCurrencyLang
} }
var PsCurrencyLangCols = struct {
IDCurrency gormcol.Field
IDLang gormcol.Field
Name gormcol.Field
Symbol gormcol.Field
}{
IDCurrency: gormcol.Field{}.Set((&PsCurrencyLang{}).TableName(), "id_currency"),
IDLang: gormcol.Field{}.Set((&PsCurrencyLang{}).TableName(), "id_lang"),
Name: gormcol.Field{}.Set((&PsCurrencyLang{}).TableName(), "name"),
Symbol: gormcol.Field{}.Set((&PsCurrencyLang{}).TableName(), "symbol"),
}

View File

@@ -1,8 +1,8 @@
// Code generated by gorm.io/gen. DO NOT EDIT. // Code generated by gormcol. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
package prestadb package dbmodel
import "git.ma-al.com/goc_marek/gormcol"
const TableNamePsCurrencyShop = "ps_currency_shop" const TableNamePsCurrencyShop = "ps_currency_shop"
@@ -17,3 +17,13 @@ type PsCurrencyShop struct {
func (*PsCurrencyShop) TableName() string { func (*PsCurrencyShop) TableName() string {
return TableNamePsCurrencyShop return TableNamePsCurrencyShop
} }
var PsCurrencyShopCols = struct {
IDCurrency gormcol.Field
IDShop gormcol.Field
ConversionRate gormcol.Field
}{
IDCurrency: gormcol.Field{}.Set((&PsCurrencyShop{}).TableName(), "id_currency"),
IDShop: gormcol.Field{}.Set((&PsCurrencyShop{}).TableName(), "id_shop"),
ConversionRate: gormcol.Field{}.Set((&PsCurrencyShop{}).TableName(), "conversion_rate"),
}

View File

@@ -1,10 +1,9 @@
// Code generated by gorm.io/gen. DO NOT EDIT. // Code generated by gormcol. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
package prestadb package dbmodel
import ( import (
"git.ma-al.com/goc_marek/gormcol"
"time" "time"
) )
@@ -51,3 +50,73 @@ type PsCustomer struct {
func (*PsCustomer) TableName() string { func (*PsCustomer) TableName() string {
return TableNamePsCustomer return TableNamePsCustomer
} }
var PsCustomerCols = struct {
IDCustomer gormcol.Field
IDShopGroup gormcol.Field
IDShop gormcol.Field
IDGender gormcol.Field
IDDefaultGroup gormcol.Field
IDLang gormcol.Field
IDRisk gormcol.Field
Company gormcol.Field
Siret gormcol.Field
Ape gormcol.Field
Firstname gormcol.Field
Lastname gormcol.Field
Email gormcol.Field
Passwd gormcol.Field
LastPasswdGen gormcol.Field
Birthday gormcol.Field
Newsletter gormcol.Field
IPRegistrationNewsletter gormcol.Field
NewsletterDateAdd gormcol.Field
Optin gormcol.Field
Website gormcol.Field
OutstandingAllowAmount gormcol.Field
ShowPublicPrices gormcol.Field
MaxPaymentDays gormcol.Field
SecureKey gormcol.Field
Note gormcol.Field
Active gormcol.Field
IsGuest gormcol.Field
Deleted gormcol.Field
DateAdd gormcol.Field
DateUpd gormcol.Field
ResetPasswordToken gormcol.Field
ResetPasswordValidity gormcol.Field
}{
IDCustomer: gormcol.Field{}.Set((&PsCustomer{}).TableName(), "id_customer"),
IDShopGroup: gormcol.Field{}.Set((&PsCustomer{}).TableName(), "id_shop_group"),
IDShop: gormcol.Field{}.Set((&PsCustomer{}).TableName(), "id_shop"),
IDGender: gormcol.Field{}.Set((&PsCustomer{}).TableName(), "id_gender"),
IDDefaultGroup: gormcol.Field{}.Set((&PsCustomer{}).TableName(), "id_default_group"),
IDLang: gormcol.Field{}.Set((&PsCustomer{}).TableName(), "id_lang"),
IDRisk: gormcol.Field{}.Set((&PsCustomer{}).TableName(), "id_risk"),
Company: gormcol.Field{}.Set((&PsCustomer{}).TableName(), "company"),
Siret: gormcol.Field{}.Set((&PsCustomer{}).TableName(), "siret"),
Ape: gormcol.Field{}.Set((&PsCustomer{}).TableName(), "ape"),
Firstname: gormcol.Field{}.Set((&PsCustomer{}).TableName(), "firstname"),
Lastname: gormcol.Field{}.Set((&PsCustomer{}).TableName(), "lastname"),
Email: gormcol.Field{}.Set((&PsCustomer{}).TableName(), "email"),
Passwd: gormcol.Field{}.Set((&PsCustomer{}).TableName(), "passwd"),
LastPasswdGen: gormcol.Field{}.Set((&PsCustomer{}).TableName(), "last_passwd_gen"),
Birthday: gormcol.Field{}.Set((&PsCustomer{}).TableName(), "birthday"),
Newsletter: gormcol.Field{}.Set((&PsCustomer{}).TableName(), "newsletter"),
IPRegistrationNewsletter: gormcol.Field{}.Set((&PsCustomer{}).TableName(), "ip_registration_newsletter"),
NewsletterDateAdd: gormcol.Field{}.Set((&PsCustomer{}).TableName(), "newsletter_date_add"),
Optin: gormcol.Field{}.Set((&PsCustomer{}).TableName(), "optin"),
Website: gormcol.Field{}.Set((&PsCustomer{}).TableName(), "website"),
OutstandingAllowAmount: gormcol.Field{}.Set((&PsCustomer{}).TableName(), "outstanding_allow_amount"),
ShowPublicPrices: gormcol.Field{}.Set((&PsCustomer{}).TableName(), "show_public_prices"),
MaxPaymentDays: gormcol.Field{}.Set((&PsCustomer{}).TableName(), "max_payment_days"),
SecureKey: gormcol.Field{}.Set((&PsCustomer{}).TableName(), "secure_key"),
Note: gormcol.Field{}.Set((&PsCustomer{}).TableName(), "note"),
Active: gormcol.Field{}.Set((&PsCustomer{}).TableName(), "active"),
IsGuest: gormcol.Field{}.Set((&PsCustomer{}).TableName(), "is_guest"),
Deleted: gormcol.Field{}.Set((&PsCustomer{}).TableName(), "deleted"),
DateAdd: gormcol.Field{}.Set((&PsCustomer{}).TableName(), "date_add"),
DateUpd: gormcol.Field{}.Set((&PsCustomer{}).TableName(), "date_upd"),
ResetPasswordToken: gormcol.Field{}.Set((&PsCustomer{}).TableName(), "reset_password_token"),
ResetPasswordValidity: gormcol.Field{}.Set((&PsCustomer{}).TableName(), "reset_password_validity"),
}

Some files were not shown because too many files have changed in this diff Show More