Skip to content

Commit

Permalink
JNG-4759 fix mapped operation range (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
noherczeg authored Apr 17, 2023
1 parent b0ecbb9 commit 435d2bf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,9 @@ public static String classTypeRestPath(ClassType classType, String suffix) {
.collect(Collectors.joining("/")) + effectiveSuffix;
}

public static String classTypeRestPathThreeParams(ClassType classType, String first, String second) {
String suffix = first + second;
public static String operationRestPath(ClassType classType, OperationType operation, String suffix) {
String effectiveSuffix = suffix == null ? "" : suffix;
return "/" + stream(classType.getName().split("::"))
.skip(1)
.filter(i -> i != "_default_transferobjecttypes")
.collect(Collectors.joining("/")) + effectiveSuffix;
return classTypeRestPath(classType, "") + "/" + operation.getName() + effectiveSuffix;
}

public static String stringConcat(String... strings) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ export class {{ classType.serviceClassName }}Impl extends JudoAxiosService imple
* @throws {AxiosError} With data containing {@link Array<FeedbackItem>} for status codes: 400, 401, 403.
*/
async {{ operation.name }}({{# if operation.isMapped }}owner: JudoIdentifiable<{{ getClassName classType }}>{{/ if }}{{# if operation.input }}{{# if operation.isMapped }},{{/ if }}target:{{ getClassName operation.input.target }}{{/ if }}): Promise<{{# if operation.output }}{{ classDataName operation.output.target "Stored" }}{{ else }}void{{/ if }}> {
const path = '{{ classTypeRestPathThreeParams classType "/" operation.name }}';
const path = '{{ operationRestPath classType operation '' }}';
const response = await this.axios.post(this.getPathForActor(path){{# if operation.input }}, target{{ else }}, undefined{{/ if }}{{# if operation.isMapped }}, {
headers: {
'X-Judo-SignedIdentifier': owner.__signedIdentifier!,
Expand All @@ -172,7 +172,7 @@ export class {{ classType.serviceClassName }}Impl extends JudoAxiosService imple
* @throws {AxiosError} With data containing {@link Array<FeedbackItem>} for status codes: 401, 403.
*/
async getRangeFor{{ firstToUpper operation.name }}(owner?: {{ classDataName classType "Stored" }}, queryCustomizer?:{{ classDataName operation.input.target "QueryCustomizer" }}): Promise<Array<{{ classDataName operation.input.target "Stored" }}>> {
const path = '{{ classTypeRestPath classType "/" operation.name "/~range" }}';
const path = '{{ operationRestPath classType operation '/~range' }}';
const response = await this.axios.post(this.getPathForActor(path), { owner: owner ?? {}, queryCustomizer: queryCustomizer ?? {} });

return response.data;
Expand Down

0 comments on commit 435d2bf

Please sign in to comment.