(20241218) Can now send tags to apply with the payment request itself, and can even update tags later.
This commit is contained in:
@@ -37,7 +37,7 @@ sys.path.append("..")
|
||||
|
||||
# For making data behaviour_models:
|
||||
from pydantic import BaseModel, Field, field_validator, PastDatetime
|
||||
from typing import Optional, Literal, Union
|
||||
from typing import Optional, Literal, Union, List, Any
|
||||
|
||||
# My utils:
|
||||
from utils_v2.string import regex
|
||||
@@ -188,6 +188,11 @@ class PGPaymentRequestData(BaseModel):
|
||||
frozen = True
|
||||
)
|
||||
|
||||
tags: List[Any] = Field(
|
||||
description = "any no. of tags to apply to this payment record to make search and filtering easy later",
|
||||
default = None
|
||||
)
|
||||
|
||||
# ┏┓ ┏•
|
||||
# ┃ ┏┓┏┓╋┓┏┓
|
||||
# ┗┛┗┛┛┗┛┗┗┫
|
||||
@@ -213,6 +218,10 @@ class PGPaymentRequestData(BaseModel):
|
||||
if currency is None: raise ValueError("invalid currency code, please use iso 4217 standard")
|
||||
return value
|
||||
|
||||
@field_validator("tags", mode = "before")
|
||||
def null_to_empty_list(cls, value):
|
||||
return [] if value is None else value
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
Reference in New Issue
Block a user