@xrystal/core 3.21.8 → 3.21.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -103,7 +103,13 @@ export class ControllerService extends Controller {
|
|
|
103
103
|
}).getResponse);
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
|
-
|
|
106
|
+
let logicResult = logic ? await logic(p) : null;
|
|
107
|
+
if (logicResult && typeof logicResult === 'object' && typeof logicResult.response === 'function') {
|
|
108
|
+
logicResult = await logicResult.response();
|
|
109
|
+
}
|
|
110
|
+
if (logicResult instanceof Response || (logicResult?.constructor?.name === 'Response')) {
|
|
111
|
+
return logicResult;
|
|
112
|
+
}
|
|
107
113
|
if (logicResult?.status === false) {
|
|
108
114
|
return currentRes.status(logicResult.code || 400).send(new ResponseSchema({
|
|
109
115
|
status: false,
|
|
@@ -111,9 +117,10 @@ export class ControllerService extends Controller {
|
|
|
111
117
|
code: logicResult.code || 400
|
|
112
118
|
}).getResponse);
|
|
113
119
|
}
|
|
114
|
-
if (logicResult instanceof Response)
|
|
115
|
-
return logicResult;
|
|
116
120
|
const resResult = response ? await response({ ...p, logicResult }) : logicResult;
|
|
121
|
+
if (resResult instanceof Response || (resResult?.constructor?.name === 'Response')) {
|
|
122
|
+
return resResult;
|
|
123
|
+
}
|
|
117
124
|
let finalMessage = '';
|
|
118
125
|
let rawMessageValue = '';
|
|
119
126
|
const messageSource = resResult?.message || (typeof resResult === 'string' || Array.isArray(resResult) ? resResult : '');
|