mirror of
https://github.com/Kingsrook/qqq.git
synced 2025-07-17 20:50:44 +00:00
Adding status object in standard loadVia steps and updating it in api insert; add user timezone header to session
This commit is contained in:
@ -81,6 +81,12 @@ public class APIInsertAction extends AbstractAPIAction implements InsertInterfac
|
||||
|
||||
for(QRecord record : insertInput.getRecords())
|
||||
{
|
||||
//////////////////////////////////////////////////////////
|
||||
// hmm, unclear if this should always be done... //
|
||||
// is added initially for registering easypost trackers //
|
||||
//////////////////////////////////////////////////////////
|
||||
insertInput.getAsyncJobCallback().incrementCurrent();
|
||||
|
||||
postOneRecord(insertOutput, table, connectionManager, record);
|
||||
|
||||
if(insertInput.getRecords().size() > 1 && apiActionUtil.getMillisToSleepAfterEveryCall() > 0)
|
||||
|
@ -32,8 +32,9 @@ import com.kingsrook.qqq.backend.core.model.metadata.QBackendMetaData;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.QInstance;
|
||||
import com.kingsrook.qqq.backend.core.model.session.QSession;
|
||||
import com.kingsrook.qqq.backend.module.api.model.metadata.APIBackendMetaData;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.condition.DisabledOnOs;
|
||||
import org.junit.jupiter.api.condition.OS;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||
@ -42,7 +43,7 @@ import static org.junit.jupiter.api.Assertions.assertNull;
|
||||
/*******************************************************************************
|
||||
**
|
||||
*******************************************************************************/
|
||||
@Disabled // OnOs(OS.LINUX)
|
||||
@DisabledOnOs(OS.LINUX)
|
||||
public class EasyPostApiTest
|
||||
{
|
||||
|
||||
|
@ -5,9 +5,12 @@
|
||||
package com.kingsrook.qqq.backend.module.api;
|
||||
|
||||
|
||||
import java.io.IOException;
|
||||
import com.kingsrook.qqq.backend.core.model.data.QRecord;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.tables.QTableMetaData;
|
||||
import com.kingsrook.qqq.backend.module.api.actions.BaseAPIActionUtil;
|
||||
import org.apache.http.entity.AbstractHttpEntity;
|
||||
import org.apache.http.entity.StringEntity;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.json.JSONObject;
|
||||
@ -23,14 +26,21 @@ public class EasyPostUtils extends BaseAPIActionUtil
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Build an HTTP Entity (e.g., for a PUT or POST) from a QRecord. Can be
|
||||
** overridden if an API doesn't do a basic json object. Or, can override a
|
||||
** helper method, such as recordToJsonObject.
|
||||
**
|
||||
*******************************************************************************/
|
||||
@Override
|
||||
protected JSONObject recordToJsonObject(QTableMetaData table, QRecord record)
|
||||
protected AbstractHttpEntity recordToEntity(QTableMetaData table, QRecord record) throws IOException
|
||||
{
|
||||
JSONObject inner = super.recordToJsonObject(table, record);
|
||||
JSONObject outer = new JSONObject();
|
||||
outer.put(getBackendDetails(table).getTableWrapperObjectName(), inner);
|
||||
return (outer);
|
||||
JSONObject body = recordToJsonObject(table, record);
|
||||
JSONObject wrapper = new JSONObject();
|
||||
String tablePath = getBackendDetails(table).getTableWrapperObjectName();
|
||||
wrapper.put(tablePath, body);
|
||||
String json = wrapper.toString();
|
||||
LOG.debug(json);
|
||||
return (new StringEntity(json));
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user