Skip to content

Commit 93b3386

Browse files
pierre-lehnen-rcgaolin1
authored andcommitted
chore: improve exported type for 'call-history.info' endpoint (RocketChat#37905)
1 parent 5654e4c commit 93b3386

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

apps/meteor/app/api/server/v1/call-history.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ const callHistoryListEndpoints = API.v1.get(
156156

157157
type CallHistoryListEndpoints = ExtractRoutesFromAPI<typeof callHistoryListEndpoints>;
158158

159-
type CallHistoryInfo = { historyId: string; callId: never } | { callId: string; historyId: never };
159+
type CallHistoryInfo = { historyId: string } | { callId: string };
160160

161161
const CallHistoryInfoSchema = {
162162
oneOf: [
@@ -224,13 +224,15 @@ const callHistoryInfoEndpoints = API.v1.get(
224224
authRequired: true,
225225
},
226226
async function action() {
227-
if (!this.queryParams.historyId && !this.queryParams.callId) {
227+
const { historyId, callId } = this.queryParams as Record<string, never> & typeof this.queryParams;
228+
229+
if (!historyId && !callId) {
228230
return API.v1.failure();
229231
}
230232

231-
const item = await (this.queryParams.historyId
232-
? CallHistory.findOneByIdAndUid(this.queryParams.historyId, this.userId)
233-
: CallHistory.findOneByCallIdAndUid(this.queryParams.callId, this.userId));
233+
const item = await (historyId
234+
? CallHistory.findOneByIdAndUid(historyId, this.userId)
235+
: CallHistory.findOneByCallIdAndUid(callId, this.userId));
234236

235237
if (!item) {
236238
return API.v1.notFound();

0 commit comments

Comments
 (0)