(20241218) Can now send tags to apply with the payment request itself, and can even update tags later.

This commit is contained in:
2024-12-18 10:24:42 +05:30
parent 85cc330711
commit c340ebcba5
7 changed files with 388 additions and 4 deletions
+10 -1
View File
@@ -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
# ---------------------------------------------------------------------------------------------------------------------