This commit is contained in:
@@ -59,6 +59,8 @@ public class ApiController {
|
||||
|
||||
private final Map<Integer, RequestHandler> handlers;
|
||||
|
||||
private final Map<Integer, RequestHandler> internalHandlers;
|
||||
|
||||
private final FileEntityService fileEntityService;
|
||||
|
||||
private final AuthService authService;
|
||||
@@ -126,6 +128,35 @@ public class ApiController {
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("/internal/data")
|
||||
public ResponseEntity<?> handleInternalPostRequest(@RequestBody BaseRequest request) {
|
||||
Integer msgId = request.getMsgId();
|
||||
BaseResponse response;
|
||||
RequestHandler handler = internalHandlers.get(msgId);
|
||||
|
||||
try {
|
||||
if (handler == null) {
|
||||
response = new BaseResponse(msgId,
|
||||
MessageCode.MSG_ID_NOT_FOUND.getCode(),
|
||||
MessageCode.MSG_ID_NOT_FOUND.getDescription(),
|
||||
new HashMap<>());
|
||||
} else {
|
||||
response = handler.handle(request);
|
||||
}
|
||||
|
||||
return ResponseEntity.ok().body(response);
|
||||
} catch (Exception e) {
|
||||
log.error("Handler execution failed for msgId: {}", msgId, e);
|
||||
|
||||
BaseResponse errorResponse = new BaseResponse(msgId,
|
||||
MessageCode.INVALID_JSON_BODY.getCode(),
|
||||
MessageCode.INVALID_JSON_BODY.getDescription(),
|
||||
new HashMap<>());
|
||||
|
||||
return ResponseEntity.ok().body(errorResponse);
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("/v{version}/files/chunk")
|
||||
public ResponseEntity<BaseResponse> uploadChunk(
|
||||
@PathVariable("version") int version,
|
||||
|
||||
Reference in New Issue
Block a user