Skip to content

Commit 1fb01a2

Browse files
committed
feat: refactor getEndOfDayReportFunction to accept date as a direct parameter instead of an object
1 parent 05ecc53 commit 1fb01a2

1 file changed

Lines changed: 6 additions & 9 deletions

File tree

actions/gls-action/src/functions/getEndOfDayReportFunction.ts

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
//TODO: Why is the request data here wrapped within a object and isn't a direct parameter
2-
31
import axios from "axios";
42
import {
53
Description, DisplayIcon,
@@ -14,14 +12,13 @@ import {
1412
} from "@code0-tech/hercules";
1513
import { getAuthToken } from "../helpers.js";
1614
import {
17-
EndOfDayRequestData,
1815
EndOfDayResponseData,
1916
EndOfDayResponseDataSchema,
2017
} from "../data_types/glsEndOfDay.js";
2118

2219
@Identifier("getEndOfDayReport")
2320
@DisplayIcon("codezero:gls")
24-
@Signature("(data: GLS_END_OF_DAY_REQUEST_DATA): GLS_END_OF_DAY_RESPONSE_DATA")
21+
@Signature("(date: string): GLS_END_OF_DAY_RESPONSE_DATA")
2522
@Name({ code: "en-US", content: "Get end of day report" })
2623
@DisplayMessage({ code: "en-US", content: "Get end of day report" })
2724
@Documentation({
@@ -33,17 +30,17 @@ import {
3330
content: "Retrieves all shipments dispatched on a given date. Useful for reconciliation and end-of-day processing.",
3431
})
3532
@Parameter({
36-
runtimeName: "data",
37-
name: [{ code: "en-US", content: "Data" }],
38-
description: [{ code: "en-US", content: "The end of day report request data." }],
33+
runtimeName: "date",
34+
name: [{ code: "en-US", content: "Date" }],
35+
description: [{ code: "en-US", content: "The dispatch date to retrieve shipments for, in ISO format (YYYY-MM-DD)." }],
3936
})
4037
export class GetEndOfDayReportFunction {
41-
async run(context: FunctionContext, data: EndOfDayRequestData): Promise<EndOfDayResponseData> {
38+
async run(context: FunctionContext, date: string): Promise<EndOfDayResponseData> {
4239
const url = context.matchedConfig.findConfig("ship_it_api_url") as string;
4340

4441
try {
4542
const result = await axios.post(
46-
`${url}/rs/shipments/endofday?date=${data.date}`,
43+
`${url}/rs/shipments/endofday?date=${date}`,
4744
{},
4845
{
4946
headers: {

0 commit comments

Comments
 (0)