Skip to content

Commit 932aa61

Browse files
authored
fix(api): convert room apis (#39827)
1 parent c3eb913 commit 932aa61

File tree

15 files changed

+528
-355
lines changed

15 files changed

+528
-355
lines changed

apps/meteor/app/api/server/ApiClass.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,8 @@ export class APIClass<TBasePath extends string = '', TOperations extends Record<
288288
};
289289
}
290290

291+
public failure(): FailureResult<string>;
292+
291293
public failure<T>(result?: T): FailureResult<T>;
292294

293295
public failure<T, TErrorType extends string, TStack extends string, TErrorDetails>(
@@ -363,6 +365,10 @@ export class APIClass<TBasePath extends string = '', TOperations extends Record<
363365
};
364366
}
365367

368+
public unauthorized(): UnauthorizedResult<string>;
369+
370+
public unauthorized<T>(msg: T): UnauthorizedResult<T>;
371+
366372
public unauthorized<T>(msg?: T): UnauthorizedResult<T> {
367373
return {
368374
statusCode: 401,

apps/meteor/app/api/server/lib/rooms.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ export async function findChannelAndPrivateAutocompleteWithPagination({
153153
};
154154
}
155155

156-
export async function findRoomsAvailableForTeams({ uid, name }: { uid: string; name: string }): Promise<{
156+
export async function findRoomsAvailableForTeams({ uid, name }: { uid: string; name?: string }): Promise<{
157157
items: IRoom[];
158158
}> {
159159
const options: FindOptions<IRoom> = {

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

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import { getPaginationItems } from '../helpers/getPaginationItems';
1919
type CallHistoryList = PaginatedRequest<{
2020
filter?: string;
2121
direction?: CallHistoryItem['direction'];
22-
state?: CallHistoryItemState[] | CallHistoryItemState;
22+
state?: CallHistoryItemState[];
2323
}>;
2424

2525
const CallHistoryListSchema = {
@@ -42,20 +42,10 @@ const CallHistoryListSchema = {
4242
enum: ['inbound', 'outbound'],
4343
},
4444
state: {
45-
// our clients serialize arrays as `state=value1&state=value2`, but if there's a single value the parser doesn't know it is an array, so we need to support both arrays and direct values
46-
// if a client tries to send a JSON array, our parser will treat it as a string and the type validation will reject it
47-
// This means this param won't work from Swagger UI
48-
oneOf: [
49-
{
50-
type: 'array',
51-
items: {
52-
$ref: '#/components/schemas/CallHistoryItemState',
53-
},
54-
},
55-
{
56-
$ref: '#/components/schemas/CallHistoryItemState',
57-
},
58-
],
45+
type: 'array',
46+
items: {
47+
$ref: '#/components/schemas/CallHistoryItemState',
48+
},
5949
},
6050
},
6151
required: [],

0 commit comments

Comments
 (0)