(20241218) Can now add tags to SMS messages while sending them, and small 'limit' bug fixed in listing mails where a huge no. of tokens are being sent.
This commit is contained in:
@@ -164,8 +164,9 @@ class PGPaymentListData(BaseModel):
|
||||
# ┗┛┗┻┗┗┗┻┗┻┗┗┗┛┛┗
|
||||
|
||||
@field_validator("tokenKeys", "tags", "paymentStatus", mode = "before")
|
||||
def ensure_list(cls, value):
|
||||
def ensure_unique_list(cls, value):
|
||||
if not isinstance(value, list): value = [value]
|
||||
value = list(set(value))
|
||||
return value
|
||||
|
||||
|
||||
|
||||
@@ -139,8 +139,9 @@ class MailListRequestData(BaseModel):
|
||||
# ┗┛┗┻┗┗┗┻┗┻┗┗┗┛┛┗
|
||||
|
||||
@field_validator("tokenKeys", "tags", mode = "before")
|
||||
def ensure_list(cls, value):
|
||||
def ensure_unique_list(cls, value):
|
||||
if not isinstance(value, list): value = [value]
|
||||
value = list(set(value))
|
||||
return value
|
||||
|
||||
|
||||
|
||||
@@ -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, List
|
||||
from typing import Optional, Literal, Union, List, Any
|
||||
|
||||
# My utils:
|
||||
from utils_v2.string import regex
|
||||
@@ -179,6 +179,7 @@ class SMSSendRequestData(BaseModel):
|
||||
|
||||
tokenKey: ObjectId = Field(description = "the auth token to use to send this message")
|
||||
message: List[NimbusSMSIndiaMessage] | List[SavvyBulkSMSKenyaMessage]
|
||||
tags: List[Any]
|
||||
|
||||
# ┏┓ ┏•
|
||||
# ┃ ┏┓┏┓╋┓┏┓
|
||||
@@ -204,6 +205,10 @@ class SMSSendRequestData(BaseModel):
|
||||
if not isinstance(value, list): value = [value]
|
||||
return value
|
||||
|
||||
@field_validator("tags", mode = "before")
|
||||
def null_to_list(cls, value):
|
||||
return [] if value is None else value
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
Reference in New Issue
Block a user