shop_system_models 0.0.1.dev27006__py3-none-any.whl → 0.0.1.dev27337__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- shop_system_models/shop_api/shop/request/details.py +10 -28
- shop_system_models/shop_api/shop/request/orders.py +83 -62
- shop_system_models/shop_api/shop/response/extra_product_options.py +1 -0
- shop_system_models/shop_api/shop/response/products.py +1 -0
- {shop_system_models-0.0.1.dev27006.dist-info → shop_system_models-0.0.1.dev27337.dist-info}/METADATA +1 -1
- {shop_system_models-0.0.1.dev27006.dist-info → shop_system_models-0.0.1.dev27337.dist-info}/RECORD +7 -7
- {shop_system_models-0.0.1.dev27006.dist-info → shop_system_models-0.0.1.dev27337.dist-info}/WHEEL +0 -0
@@ -5,33 +5,15 @@ from pydantic import BaseModel, Field
|
|
5
5
|
|
6
6
|
|
7
7
|
|
8
|
+
class NocoDBConfig(BaseModel):
|
9
|
+
nocodb_project_id: Optional[str] = None
|
10
|
+
nocodb_categories_table: Optional[str] = None
|
11
|
+
nocodb_products_table: Optional[str] = None
|
12
|
+
nocodb_orders_table: Optional[str] = None
|
13
|
+
nocodb_status_table: Optional[str] = None
|
14
|
+
nocodb_bot_commands_table: Optional[str] = None
|
15
|
+
nocodb_options_table: Optional[str] = ""
|
16
|
+
nocodb_options_category_table: Optional[str] = ""
|
17
|
+
|
8
18
|
|
9
|
-
class ShopDetailsModel(BaseModel):
|
10
|
-
shop_id: str
|
11
|
-
shop_name: str
|
12
|
-
friendly_name: str
|
13
|
-
shop_language: str = "RU"
|
14
|
-
shop_api_url: str = "https://marketplace-api-dev.tg-shops.com"
|
15
|
-
contact_phone: str | None = None
|
16
|
-
contact_email: str
|
17
|
-
orders_chat_id: int
|
18
|
-
orders_history_chat_id: Optional[int] = None
|
19
|
-
search_enabled: Optional[bool] = False
|
20
|
-
warehouse_accounting: bool = False
|
21
|
-
bot_url: str | None = None
|
22
|
-
bot_token: str
|
23
|
-
payment_token: str | None = None
|
24
|
-
placeholder: str
|
25
|
-
order_process: str
|
26
|
-
nocodb_project_id: str
|
27
|
-
nocodb_categories_table: str
|
28
|
-
nocodb_products_table: str
|
29
|
-
nocodb_orders_table: str
|
30
|
-
nocodb_status_table: str
|
31
|
-
nocodb_bot_commands_table: str
|
32
|
-
nocodb_options_table: Optional[str] = None
|
33
|
-
nocodb_options_category_table: Optional[str] = None
|
34
|
-
topic_chat_id: Optional[int] = None
|
35
|
-
premium_expiration_date: Optional[datetime] = None
|
36
|
-
web_app_url: str = ""
|
37
19
|
|
@@ -2,86 +2,109 @@ from datetime import datetime
|
|
2
2
|
from typing import Optional, List, Dict, Any, Union
|
3
3
|
from pydantic import Field, field_validator, BaseModel
|
4
4
|
|
5
|
-
from shop_system_models.shop_api import MetaBaseModel
|
6
5
|
from shop_system_models.shop_api.shop.response.baskets import UserBasketResponseModelV2
|
7
|
-
from
|
6
|
+
from pydantic_core.core_schema import ValidationInfo
|
7
|
+
from shop_system_models.consts.country_codes import ISO3166
|
8
8
|
|
9
9
|
|
10
|
-
|
11
|
-
|
10
|
+
|
11
|
+
class ExtraFieldPayload(BaseModel):
|
12
12
|
name: str
|
13
13
|
value: str
|
14
14
|
|
15
15
|
|
16
16
|
class OrderDeliveryTypeModel(BaseModel):
|
17
|
-
"""Model for order delivery details."""
|
18
17
|
name: str
|
19
|
-
address:
|
20
|
-
amount:
|
21
|
-
extra_fields_payload:
|
18
|
+
address: str | None = ""
|
19
|
+
amount: float | None = 0.0
|
20
|
+
extra_fields_payload: list[ExtraFieldPayload] | None = []
|
22
21
|
|
23
22
|
|
24
|
-
class Coordinates(
|
25
|
-
|
26
|
-
|
27
|
-
longitude: Optional[float] = None
|
23
|
+
class Coordinates(BaseModel):
|
24
|
+
latitude: float | None = None
|
25
|
+
longitude: float | None = None
|
28
26
|
|
29
27
|
|
30
|
-
class AddressModel(
|
31
|
-
|
32
|
-
|
33
|
-
address: Optional[str] = None
|
28
|
+
class AddressModel(BaseModel):
|
29
|
+
coordinates: Coordinates | None = None
|
30
|
+
address: str | None = None
|
34
31
|
|
35
32
|
|
36
|
-
class ExtraField(
|
37
|
-
"""Model for defining extra fields."""
|
33
|
+
class ExtraField(BaseModel):
|
38
34
|
name: str
|
39
35
|
description: str
|
40
|
-
is_required:
|
36
|
+
is_required: bool | None
|
41
37
|
|
42
38
|
|
43
|
-
class DeliveryTypeModel(
|
44
|
-
"""Delivery type configuration model."""
|
39
|
+
class DeliveryTypeModel(BaseModel):
|
45
40
|
name: str
|
46
41
|
amount: float = 0.0
|
47
|
-
is_address_required:
|
48
|
-
address_hint:
|
49
|
-
extra_fields:
|
42
|
+
is_address_required: bool | None = False
|
43
|
+
address_hint: str | None = ""
|
44
|
+
extra_fields: list[ExtraField] = []
|
50
45
|
is_timepicker_required: bool = False
|
51
|
-
details:
|
52
|
-
country:
|
53
|
-
country_code:
|
54
|
-
city:
|
55
|
-
delivery_location:
|
56
|
-
delivery_radius:
|
57
|
-
delivery_min_hour:
|
58
|
-
delivery_max_hour:
|
59
|
-
delivery_minutes_interval:
|
60
|
-
delivery_min_day:
|
61
|
-
delivery_max_day:
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
46
|
+
details: str | None = ""
|
47
|
+
country: str | None = ""
|
48
|
+
country_code: str | None = "" # ISO format, ex.: RU, KZ, BY...
|
49
|
+
city: str | None = ""
|
50
|
+
delivery_location: Coordinates | None = None
|
51
|
+
delivery_radius: int | None = None
|
52
|
+
delivery_min_hour: int | None = None
|
53
|
+
delivery_max_hour: int | None = None
|
54
|
+
delivery_minutes_interval: int | None = None
|
55
|
+
delivery_min_day: int | None = None
|
56
|
+
delivery_max_day: int | None = None
|
57
|
+
|
58
|
+
@field_validator("country_code", mode="before")
|
59
|
+
def set_country_code(cls, value, values: ValidationInfo):
|
60
|
+
country_code_upper = value.upper()
|
61
|
+
if ISO3166.get(country_code_upper):
|
62
|
+
return country_code_upper
|
63
|
+
return "RU"
|
64
|
+
|
65
|
+
|
66
|
+
def format_order_number(order_count: int) -> str:
|
67
|
+
return f"#{order_count:04}"
|
68
|
+
|
69
|
+
|
70
|
+
"""
|
71
|
+
{
|
72
|
+
"user_id": 123,
|
73
|
+
"basket_id": None,
|
74
|
+
"basket": None,
|
75
|
+
"status": "booking_request",
|
76
|
+
"delivery": None,
|
77
|
+
"delivery_date_from": None,
|
78
|
+
"user_contact_number": None,
|
79
|
+
"client_coordinates": None,
|
80
|
+
"comment": "",# НАДО
|
81
|
+
"payment_type_id": # НАДО
|
82
|
+
"preview_url": ''
|
83
|
+
"booking_details": {
|
84
|
+
"booking_id": "123123",
|
85
|
+
"from_date": datetime.now(),
|
86
|
+
"till_date": datetime.now(),
|
87
|
+
"item_id": "123123",
|
88
|
+
}
|
89
|
+
}"""
|
90
|
+
|
91
|
+
|
92
|
+
class BookingOrderModel(BaseModel):
|
66
93
|
booking_id: str
|
67
94
|
from_date: datetime
|
68
95
|
till_date: datetime
|
69
96
|
item_id: str
|
70
97
|
|
71
98
|
|
72
|
-
class CreateOrderModel(
|
73
|
-
|
74
|
-
delivery: Optional[OrderDeliveryTypeModel] = None
|
99
|
+
class CreateOrderModel(BaseModel):
|
100
|
+
delivery: OrderDeliveryTypeModel | None = None
|
75
101
|
delivery_date_from: datetime = Field(default_factory=datetime.now)
|
76
|
-
comment:
|
77
|
-
user_contact_number:
|
78
|
-
payment_type_id:
|
79
|
-
booking_details:
|
80
|
-
preview_url:
|
81
|
-
|
102
|
+
comment: str | None = None
|
103
|
+
user_contact_number: str | None = None
|
104
|
+
payment_type_id: str | None = None
|
105
|
+
booking_details: BookingOrderModel | None = None
|
106
|
+
preview_url: str | None = ""
|
82
107
|
|
83
|
-
class ProductsInBasket(ProductResponseModel):
|
84
|
-
count_in_basket: int = 1
|
85
108
|
|
86
109
|
class OrderPaymentDetails(BaseModel):
|
87
110
|
title: str
|
@@ -90,21 +113,19 @@ class OrderPaymentDetails(BaseModel):
|
|
90
113
|
link: str
|
91
114
|
|
92
115
|
|
93
|
-
# This depends on UserBasketResponseModelV2 which we'll define in a separate file
|
94
|
-
# For now, we'll create a placeholder class that can be updated later
|
95
116
|
class OrderModel(CreateOrderModel):
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
updated: datetime = Field(default_factory=datetime.now)
|
117
|
+
basket: UserBasketResponseModelV2
|
118
|
+
user_id: str | None = None
|
119
|
+
basket_id: str | None = None
|
120
|
+
status: str | None = None
|
121
|
+
client_coordinates: AddressModel | None = None
|
122
|
+
created: datetime = datetime.now()
|
123
|
+
updated: datetime = datetime.now()
|
104
124
|
order_number: str = "#0001"
|
105
|
-
process_key:
|
106
|
-
coupon:
|
125
|
+
process_key: int | None = None
|
126
|
+
coupon: str | None = None
|
107
127
|
admin_message_id: str | None = None
|
128
|
+
|
108
129
|
payment_data: OrderPaymentDetails | None = None
|
109
130
|
|
110
131
|
|
@@ -17,3 +17,4 @@ class ExtraOptionCategoriesResponseModel(MetaBaseModel):
|
|
17
17
|
choice_count: int = 0 # How many options user can select from this category, 0 means no limit
|
18
18
|
is_required: bool | None = False # If true, user must select at least one option from this category
|
19
19
|
options: list[ExtraOptionResponseModel] = []
|
20
|
+
metadata = {}
|
@@ -22,6 +22,7 @@ class ProductResponseModel(BaseProductResponseModel):
|
|
22
22
|
related_products: list["ProductResponseModel"] | None = []
|
23
23
|
secret_urls: list[str] = []
|
24
24
|
checkout_modes: list[ProductCheckoutModes] = []
|
25
|
+
metadata = {}
|
25
26
|
|
26
27
|
@field_validator("checkout_modes")
|
27
28
|
def convert_status(cls, value: list[ProductCheckoutModes]):
|
{shop_system_models-0.0.1.dev27006.dist-info → shop_system_models-0.0.1.dev27337.dist-info}/RECORD
RENAMED
@@ -58,8 +58,8 @@ shop_system_models/shop_api/shop/request/__init__.py,sha256=kFEy1H52PuduvkyKZtFe
|
|
58
58
|
shop_system_models/shop_api/shop/request/baskets.py,sha256=pQsnXoekis2_5aZYmktUa5YAp3vCAv5MNpD1wBTtDsM,1123
|
59
59
|
shop_system_models/shop_api/shop/request/categories.py,sha256=Z5BTycKC3rQfBP5GI2s3VpxaGxJ3DstfwmJpgF8EVXw,626
|
60
60
|
shop_system_models/shop_api/shop/request/coupons.py,sha256=9TigEAUKie8Rdg38llkQ6oSRl3aWzppJd1FvWEllolI,1537
|
61
|
-
shop_system_models/shop_api/shop/request/details.py,sha256=
|
62
|
-
shop_system_models/shop_api/shop/request/orders.py,sha256=
|
61
|
+
shop_system_models/shop_api/shop/request/details.py,sha256=yn-dLVbyaabp8r0XVgJ5bVh2-tKpoxbAFhuPZ2fZoyQ,519
|
62
|
+
shop_system_models/shop_api/shop/request/orders.py,sha256=Q3DRwCYA-qE3TEdns4l320xBRCgnyFyDVYfaP1wNIV4,4601
|
63
63
|
shop_system_models/shop_api/shop/request/payment_methods.py,sha256=KnHM0nz9lp3J8vQ36QIra_jEiaF2uEipNnKKYKsFD6g,388
|
64
64
|
shop_system_models/shop_api/shop/request/products.py,sha256=LKIxg0OcmD-uGK9DkuCVJzOgqOv3LWmCa2W5c-uX0os,1076
|
65
65
|
shop_system_models/shop_api/shop/request/review.py,sha256=jZOaKx2cPymXnd2RjWKnKZZvSHljYDG3VdyPSWAi54o,270
|
@@ -69,13 +69,13 @@ shop_system_models/shop_api/shop/response/basic.py,sha256=-RzTETvhIaOBR9TGRXGMHz
|
|
69
69
|
shop_system_models/shop_api/shop/response/baskets.py,sha256=Yg2Etwxu-91mpzojO_zI16A2agBD7Bm2mOay1BAH0Bw,860
|
70
70
|
shop_system_models/shop_api/shop/response/categories.py,sha256=TCOTNOkFczVjsnUQ_gdTM1JjQVlkav7xce6ZTWWqVOA,851
|
71
71
|
shop_system_models/shop_api/shop/response/coupons.py,sha256=bNh4okw0kWBBEPBUyd4h5ZqfXXcdaIUv3ZSYRdsuuYI,433
|
72
|
-
shop_system_models/shop_api/shop/response/extra_product_options.py,sha256=
|
72
|
+
shop_system_models/shop_api/shop/response/extra_product_options.py,sha256=JlFRMHaAOp7z_U_xtjWmOnXC3mh3WOe9FvxQXr6mLqY,617
|
73
73
|
shop_system_models/shop_api/shop/response/initialization_data.py,sha256=F29pCrajXIA-6xdYzqWudnygLGBIrk4wUUHPqbahWpE,884
|
74
74
|
shop_system_models/shop_api/shop/response/orders.py,sha256=4Mprkcq_Q8fK2cv4HvMpAkGRimPh3Jf85aZKXfI4Mf8,699
|
75
75
|
shop_system_models/shop_api/shop/response/payment_methods.py,sha256=gSb5zU_8LX4x4gtqfC_it1jFxJ7i-XxNNd15ho54VhQ,371
|
76
|
-
shop_system_models/shop_api/shop/response/products.py,sha256=
|
76
|
+
shop_system_models/shop_api/shop/response/products.py,sha256=rL93YywEooIwI6WUzAe-VYpLM4axPKWsPd8sIj5xsA0,1293
|
77
77
|
shop_system_models/shop_api/shop/response/review.py,sha256=k5jzgS1HinyjbGfR6gnJENB5WufAedsMS77-vZm6fdw,486
|
78
78
|
shop_system_models/shop_api/shop/response/users.py,sha256=DdZOTxGxQdxEg1yZi4v4mm8V8O0pV6K7zc6DWylLrMY,141
|
79
|
-
shop_system_models-0.0.1.
|
80
|
-
shop_system_models-0.0.1.
|
81
|
-
shop_system_models-0.0.1.
|
79
|
+
shop_system_models-0.0.1.dev27337.dist-info/METADATA,sha256=dP0uuc3PbetEH8BmYCPPGFGOJ6IqJsVcVVDVkfS1W_Q,978
|
80
|
+
shop_system_models-0.0.1.dev27337.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
|
81
|
+
shop_system_models-0.0.1.dev27337.dist-info/RECORD,,
|
{shop_system_models-0.0.1.dev27006.dist-info → shop_system_models-0.0.1.dev27337.dist-info}/WHEEL
RENAMED
File without changes
|