unitysvc-services 0.1.0__py3-none-any.whl → 0.1.4__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.
@@ -1,8 +1,8 @@
1
1
  from datetime import datetime
2
2
 
3
- from pydantic import BaseModel, ConfigDict, EmailStr, Field, HttpUrl
3
+ from pydantic import BaseModel, ConfigDict, EmailStr, Field, HttpUrl, field_validator
4
4
 
5
- from unitysvc_services.models.base import Document, SellerTypeEnum
5
+ from unitysvc_services.models.base import Document, SellerStatusEnum, SellerTypeEnum, validate_name
6
6
 
7
7
 
8
8
  class SellerV1(BaseModel):
@@ -98,13 +98,19 @@ class SellerV1(BaseModel):
98
98
  # fields for business operation purposes
99
99
  #
100
100
 
101
- # Status flags - these would typically be set by the backend
102
- is_active: bool = Field(
103
- default=True,
104
- description="Whether the seller is active on the marketplace",
101
+ # Status field to track seller state
102
+ status: SellerStatusEnum = Field(
103
+ default=SellerStatusEnum.active,
104
+ description="Seller status: active, disabled, or incomplete",
105
105
  )
106
106
 
107
107
  is_verified: bool = Field(
108
108
  default=False,
109
109
  description="Whether the seller has been verified (KYC/business verification)",
110
110
  )
111
+
112
+ @field_validator("name")
113
+ @classmethod
114
+ def validate_name_format(cls, v: str) -> str:
115
+ """Validate that seller name uses URL-safe identifiers."""
116
+ return validate_name(v, "seller", allow_slash=False)
@@ -1,7 +1,7 @@
1
1
  from datetime import datetime
2
2
  from typing import Any
3
3
 
4
- from pydantic import BaseModel, ConfigDict, Field, HttpUrl
4
+ from pydantic import BaseModel, ConfigDict, Field, HttpUrl, field_validator
5
5
 
6
6
  from unitysvc_services.models.base import (
7
7
  AccessInterface,
@@ -10,6 +10,7 @@ from unitysvc_services.models.base import (
10
10
  ServiceTypeEnum,
11
11
  TagEnum,
12
12
  UpstreamStatusEnum,
13
+ validate_name,
13
14
  )
14
15
 
15
16
 
@@ -78,3 +79,9 @@ class ServiceV1(BaseModel):
78
79
  # a list of pricing models
79
80
  #
80
81
  upstream_price: Pricing | None = Field(description="List of pricing information")
82
+
83
+ @field_validator("name")
84
+ @classmethod
85
+ def validate_name_format(cls, v: str) -> str:
86
+ """Validate that service name uses valid identifiers (allows slashes for hierarchical names)."""
87
+ return validate_name(v, "service", allow_slash=True)
@@ -19,7 +19,7 @@ console = Console()
19
19
  def populate(
20
20
  data_dir: Path | None = typer.Argument(
21
21
  None,
22
- help="Directory containing provider data files (default: ./data or UNITYSVC_DATA_DIR env var)",
22
+ help="Directory containing provider data files (default: current directory)",
23
23
  ),
24
24
  provider_name: str | None = typer.Option(
25
25
  None,
@@ -41,11 +41,7 @@ def populate(
41
41
  """
42
42
  # Set data directory
43
43
  if data_dir is None:
44
- data_dir_str = os.getenv("UNITYSVC_DATA_DIR")
45
- if data_dir_str:
46
- data_dir = Path(data_dir_str)
47
- else:
48
- data_dir = Path.cwd() / "data"
44
+ data_dir = Path.cwd()
49
45
 
50
46
  if not data_dir.is_absolute():
51
47
  data_dir = Path.cwd() / data_dir