regression: remove query field on groups messages listing (#33802)
parent
bf05700542
commit
d1e14a0a85
@ -0,0 +1,6 @@ |
||||
--- |
||||
'@rocket.chat/rest-typings': major |
||||
'@rocket.chat/meteor': major |
||||
--- |
||||
|
||||
Changes groups messages listing endpoint by moving query params from the 'query' attribute to standard query parameters. |
||||
@ -0,0 +1,22 @@ |
||||
import { api, credentials, request } from './api-data'; |
||||
|
||||
export const createGroup = ({ name }: { name: string }) => { |
||||
if (!name) { |
||||
throw new Error('"name" is required in "createGroup" test helper'); |
||||
} |
||||
return request.post(api('groups.create')).set(credentials).send({ name }); |
||||
}; |
||||
|
||||
export const deleteGroup = ({ groupId, roomName }: { groupId?: string; roomName?: string }) => { |
||||
if (!groupId && !roomName) { |
||||
throw new Error('"groupId" or "roomName" is required in "deleteGroup" test helper'); |
||||
} |
||||
|
||||
return request |
||||
.post(api('groups.delete')) |
||||
.set(credentials) |
||||
.send({ |
||||
...(groupId && { groupId }), |
||||
...(roomName && { roomName }), |
||||
}); |
||||
}; |
||||
@ -1,32 +0,0 @@ |
||||
import Ajv from 'ajv'; |
||||
|
||||
import type { PaginatedRequest } from '../../helpers/PaginatedRequest'; |
||||
import type { GroupsBaseProps } from './BaseProps'; |
||||
import { withGroupBaseProperties } from './BaseProps'; |
||||
|
||||
const ajv = new Ajv({ |
||||
coerceTypes: true, |
||||
}); |
||||
|
||||
export type GroupsMessageProps = PaginatedRequest<GroupsBaseProps>; |
||||
|
||||
const GroupsMessagePropsSchema = withGroupBaseProperties({ |
||||
count: { |
||||
type: 'number', |
||||
nullable: true, |
||||
}, |
||||
offset: { |
||||
type: 'number', |
||||
nullable: true, |
||||
}, |
||||
sort: { |
||||
type: 'string', |
||||
nullable: true, |
||||
}, |
||||
query: { |
||||
type: 'string', |
||||
nullable: true, |
||||
}, |
||||
}); |
||||
|
||||
export const isGroupsMessageProps = ajv.compile<GroupsMessageProps>(GroupsMessagePropsSchema); |
||||
@ -0,0 +1,50 @@ |
||||
import type { IRoom } from '@rocket.chat/core-typings'; |
||||
import Ajv from 'ajv'; |
||||
|
||||
import type { PaginatedRequest } from '../../helpers/PaginatedRequest'; |
||||
import { withGroupBaseProperties } from './BaseProps'; |
||||
|
||||
const ajv = new Ajv({ |
||||
coerceTypes: true, |
||||
}); |
||||
|
||||
export type GroupsMessagesProps = PaginatedRequest<{ |
||||
roomId: IRoom['_id']; |
||||
mentionIds?: string; |
||||
starredIds?: string; |
||||
pinned?: boolean; |
||||
query?: Record<string, any>; |
||||
}>; |
||||
|
||||
const GroupsMessagesPropsSchema = withGroupBaseProperties({ |
||||
roomId: { |
||||
type: 'string', |
||||
}, |
||||
mentionIds: { |
||||
type: 'string', |
||||
}, |
||||
starredIds: { |
||||
type: 'string', |
||||
}, |
||||
pinned: { |
||||
type: 'string', |
||||
}, |
||||
count: { |
||||
type: 'number', |
||||
nullable: true, |
||||
}, |
||||
offset: { |
||||
type: 'number', |
||||
nullable: true, |
||||
}, |
||||
sort: { |
||||
type: 'string', |
||||
nullable: true, |
||||
}, |
||||
query: { |
||||
type: 'string', |
||||
nullable: true, |
||||
}, |
||||
}); |
||||
|
||||
export const isGroupsMessagesProps = ajv.compile<GroupsMessagesProps>(GroupsMessagesPropsSchema); |
||||
Loading…
Reference in new issue