(20260309) Added new 'mode' for formatting the muster roll.
This commit is contained in:
@@ -208,7 +208,7 @@ async def muster_roll_report_generate(
|
|||||||
pass # ... already an array
|
pass # ... already an array
|
||||||
elif inbound_data.mode == "map":
|
elif inbound_data.mode == "map":
|
||||||
report_data["report"] = {
|
report_data["report"] = {
|
||||||
r["User ID"]: {k: v for k,v in r.items() if k != "User ID"}
|
r["User ID"]: {k: v for k, v in r.items() if k != "User ID"}
|
||||||
for r in report_data["report"]
|
for r in report_data["report"]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -86,6 +86,7 @@ class CosecMusterRollReportRequestData(BaseModel):
|
|||||||
|
|
||||||
mode: Literal["array", "map"] = Field(
|
mode: Literal["array", "map"] = Field(
|
||||||
description = "The format in which the response is desired.",
|
description = "The format in which the response is desired.",
|
||||||
|
default = "array",
|
||||||
frozen = True,
|
frozen = True,
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -118,11 +119,16 @@ class CosecMusterRollReportRequestData(BaseModel):
|
|||||||
)
|
)
|
||||||
return value
|
return value
|
||||||
|
|
||||||
@field_validator("groupIds", mode = "after")
|
@field_validator("groupIds", mode = "before")
|
||||||
def parse_group_ids(cls, value):
|
def parse_group_ids(cls, value):
|
||||||
if isinstance(value, str): value = value.split(",")
|
if isinstance(value, str): value = value.split(",")
|
||||||
return value
|
return value
|
||||||
|
|
||||||
|
@field_validator("mode", mode = "before")
|
||||||
|
def parse_mode(cls, value):
|
||||||
|
if isinstance(value, str): value = value.lower()
|
||||||
|
return value
|
||||||
|
|
||||||
|
|
||||||
# *****************************************************************************************************************
|
# *****************************************************************************************************************
|
||||||
# ***** ****
|
# ***** ****
|
||||||
|
|||||||
Reference in New Issue
Block a user