feat: add start time and end time
Some checks failed
it-academy/dry-wash-pl/pipeline/head There was a failure building this commit
Some checks failed
it-academy/dry-wash-pl/pipeline/head There was a failure building this commit
This commit is contained in:
parent
939f107d1c
commit
6ca7de9467
@ -1,4 +1,5 @@
|
|||||||
import { getConfigValue } from '@brojs/cli';
|
import { getConfigValue } from '@brojs/cli';
|
||||||
|
import dayjs from 'dayjs';
|
||||||
|
|
||||||
enum ArmEndpoints {
|
enum ArmEndpoints {
|
||||||
ORDERS = '/arm/orders',
|
ORDERS = '/arm/orders',
|
||||||
@ -9,12 +10,15 @@ const armService = () => {
|
|||||||
const endpoint = getConfigValue('dry-wash.api');
|
const endpoint = getConfigValue('dry-wash.api');
|
||||||
|
|
||||||
const fetchOrders = async ({ date }: { date: Date }) => {
|
const fetchOrders = async ({ date }: { date: Date }) => {
|
||||||
|
let startDate = dayjs(date).startOf('day').toISOString();
|
||||||
|
let endDate = dayjs(date).endOf('day').toISOString();
|
||||||
|
|
||||||
const response = await fetch(`${endpoint}${ArmEndpoints.ORDERS}`, {
|
const response = await fetch(`${endpoint}${ArmEndpoints.ORDERS}`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
},
|
},
|
||||||
body: JSON.stringify({ date }),
|
body: JSON.stringify({ startDate, endDate }),
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
|
Loading…
Reference in New Issue
Block a user