replaced mock with actual post call
This commit is contained in:
@@ -60,7 +60,7 @@ const upsertData = async (
|
|||||||
// Insert new entries in chunks
|
// Insert new entries in chunks
|
||||||
console.time("insertion time");
|
console.time("insertion time");
|
||||||
const chunks = chunkArray(entries, chunkSize);
|
const chunks = chunkArray(entries, chunkSize);
|
||||||
// .map(async (chunk) => {
|
// .map(async (chunk) => {
|
||||||
// await surreal.insert<BookingEntry>(tableName, chunk);
|
// await surreal.insert<BookingEntry>(tableName, chunk);
|
||||||
// });
|
// });
|
||||||
// for (let i = 0; i < chunks.length; i += 2) {
|
// for (let i = 0; i < chunks.length; i += 2) {
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import type {
|
|||||||
import Fetch from "node-fetch";
|
import Fetch from "node-fetch";
|
||||||
import { HttpsProxyAgent } from "https-proxy-agent";
|
import { HttpsProxyAgent } from "https-proxy-agent";
|
||||||
|
|
||||||
export type APIRespnose<T> = {
|
export type APIResponse<T> = {
|
||||||
code: number;
|
code: number;
|
||||||
success: boolean;
|
success: boolean;
|
||||||
message: string;
|
message: string;
|
||||||
@@ -57,7 +57,7 @@ export async function postDataToApi(payload: {
|
|||||||
data: PostDataEntry[];
|
data: PostDataEntry[];
|
||||||
users: ApiPostUserWithParent[];
|
users: ApiPostUserWithParent[];
|
||||||
}) {
|
}) {
|
||||||
const responses = [] as APIRespnose<[]>[];
|
const responses = [] as APIResponse<[]>[];
|
||||||
const responsesIds = [] as { requestId: number; bookId: string }[];
|
const responsesIds = [] as { requestId: number; bookId: string }[];
|
||||||
let failedResponses = 0;
|
let failedResponses = 0;
|
||||||
let successResponses = 0;
|
let successResponses = 0;
|
||||||
@@ -116,7 +116,7 @@ export async function postDataToApi(payload: {
|
|||||||
drawId,
|
drawId,
|
||||||
date,
|
date,
|
||||||
);
|
);
|
||||||
const res = await mockSendBatchRequest(
|
const res = await sendBatchRequest(
|
||||||
session,
|
session,
|
||||||
dealerId,
|
dealerId,
|
||||||
payload.draw,
|
payload.draw,
|
||||||
@@ -124,7 +124,7 @@ export async function postDataToApi(payload: {
|
|||||||
message,
|
message,
|
||||||
);
|
);
|
||||||
let rj:
|
let rj:
|
||||||
| APIRespnose<{
|
| APIResponse<{
|
||||||
bookDtos: {
|
bookDtos: {
|
||||||
bookId: string;
|
bookId: string;
|
||||||
requestId: number;
|
requestId: number;
|
||||||
|
|||||||
Reference in New Issue
Block a user