Skip to content

Commit

Permalink
stdDomain设置为csv-list将会导致返回值类型变为List<String>
Browse files Browse the repository at this point in the history
  • Loading branch information
entropy-cloud committed Jul 25, 2024
1 parent 5ca6d8d commit 8731718
Show file tree
Hide file tree
Showing 6 changed files with 85 additions and 0 deletions.
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
LOG_ID,USER_NAME,USER_ID,SESSION_ID,OPERATION,DESCRIPTION,ACTION_TIME,USED_TIME,RESULT_STATUS,ERROR_CODE,RET_MESSAGE,OP_REQUEST,OP_RESPONSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"data": [
{
"id": "@var:NopAuthOpLog@logId",
"logId": "@var:NopAuthOpLog@logId",
"userName": "aaa",
"userId": "a",
"sessionId": "123",
"operation": null,
"description": null,
"actionTime": "@var:NopAuthOpLog@actionTime",
"usedTime": 0,
"resultStatus": 1,
"errorCode": null,
"retMessage": null,
"opRequest": null,
"opResponse": [
"a",
"b",
"c"
]
}
],
"status": 0
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
_chgType,LOG_ID,USER_NAME,USER_ID,SESSION_ID,OPERATION,DESCRIPTION,ACTION_TIME,USED_TIME,RESULT_STATUS,ERROR_CODE,RET_MESSAGE,OP_REQUEST,OP_RESPONSE
A,@var:NopAuthOpLog@logId,aaa,a,123,,,@var:NopAuthOpLog@actionTime,@var:NopAuthOpLog@usedTime,1,,,,"a,b,c"
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package io.nop.auth.service;

import io.nop.api.core.annotations.autotest.EnableSnapshot;
import io.nop.api.core.annotations.autotest.NopTestConfig;
import io.nop.api.core.beans.ApiRequest;
import io.nop.api.core.beans.ApiResponse;
import io.nop.api.core.time.CoreMetrics;
import io.nop.auth.dao.entity.NopAuthOpLog;
import io.nop.autotest.junit.JunitAutoTestCase;
import io.nop.dao.api.IDaoProvider;
import io.nop.dao.api.IEntityDao;
import io.nop.graphql.core.IGraphQLExecutionContext;
import io.nop.graphql.core.engine.IGraphQLEngine;
import jakarta.inject.Inject;
import org.junit.jupiter.api.Test;

@NopTestConfig(localDb = true, initDatabaseSchema = true)
public class TestMetaGen extends JunitAutoTestCase {

@Inject
IGraphQLEngine graphQLEngine;

@Inject
IDaoProvider daoProvider;

@EnableSnapshot
@Test
public void testCsvList() {
saveData();
ApiRequest<Void> request = new ApiRequest<>();
IGraphQLExecutionContext gqlCtx = graphQLEngine.newRpcContext(null, "NopAuthOpLog__findList", request);
ApiResponse<?> response = graphQLEngine.executeRpc(gqlCtx);
output("response.json5", response);
}

private void saveData() {
IEntityDao<NopAuthOpLog> dao = daoProvider.daoFor(NopAuthOpLog.class);
NopAuthOpLog log = new NopAuthOpLog();
log.setSessionId("123");
log.setActionTime(CoreMetrics.currentTimestamp());
log.setUserId("a");
log.setUsedTime(0L);
log.setUserName("aaa");
log.setOpResponse("a,b,c");
log.setResultStatus(1);
dao.saveEntity(log);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<meta x:extends="super" x:schema="/nop/schema/xmeta.xdef"
xmlns:x="/nop/schema/xdsl.xdef" xmlns:graphql="graphql" xmlns:filter="filter">

<props>
<prop name="opResponse">
<schema stdDomain="csv-list" />
</prop>
</props>
</meta>

0 comments on commit 8731718

Please sign in to comment.