Skip to content

Commit 9af3565

Browse files
committed
chore(api): align push migration with openapi template
1 parent 11be43e commit 9af3565

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

.changeset/migrate-push-endpoints.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
22
"@rocket.chat/meteor": minor
3+
"@rocket.chat/core-typings": minor
34
"@rocket.chat/rest-typings": minor
45
---
56

apps/meteor/app/api/server/v1/push.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Push } from '@rocket.chat/core-services';
2-
import type { IPushToken, IPushTokenTypes } from '@rocket.chat/core-typings';
2+
import type { IMessage, IPushNotificationConfig, IPushToken, IPushTokenTypes } from '@rocket.chat/core-typings';
33
import { Messages, PushToken, Users, Rooms, Settings } from '@rocket.chat/models';
44
import {
55
ajv,
@@ -227,7 +227,7 @@ const pushTokenEndpoints = API.v1
227227
authRequired: true,
228228
query: isPushGetProps,
229229
response: {
230-
200: ajv.compile<{ data: { message: object; notification: object }; success: true }>({
230+
200: ajv.compile<SuccessResult<{ data: { message: IMessage; notification: IPushNotificationConfig } }>['body']>({
231231
type: 'object',
232232
properties: {
233233
data: {
@@ -280,7 +280,7 @@ const pushTokenEndpoints = API.v1
280280
{
281281
authRequired: true,
282282
response: {
283-
200: ajv.compile<{ pushGatewayEnabled: boolean; defaultPushGateway: boolean; success: true }>({
283+
200: ajv.compile<SuccessResult<{ pushGatewayEnabled: boolean; defaultPushGateway: boolean }>['body']>({
284284
type: 'object',
285285
properties: {
286286
pushGatewayEnabled: { type: 'boolean' },
@@ -316,7 +316,7 @@ const pushTestEndpoints = API.v1.post(
316316
response: {
317317
400: validateBadRequestErrorResponse,
318318
401: validateUnauthorizedErrorResponse,
319-
200: ajv.compile<{ tokensCount: number }>({
319+
200: ajv.compile<SuccessResult<{ tokensCount: number }>['body']>({
320320
type: 'object',
321321
properties: {
322322
tokensCount: { type: 'integer' },

packages/core-typings/src/Ajv.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import type { IMessage } from './IMessage';
1212
import type { IModerationAudit, IModerationReport } from './IModerationReport';
1313
import type { IOAuthApps } from './IOAuthApps';
1414
import type { IPermission } from './IPermission';
15+
import type { IPushNotificationConfig } from './IPushNotificationConfig';
1516
import type { IRole } from './IRole';
1617
import type { IRoom, IDirectoryChannelResult } from './IRoom';
1718
import type { ISubscription } from './ISubscription';
@@ -49,6 +50,7 @@ export const schemas = typia.json.schemas<
4950
| IModerationAudit
5051
| IModerationReport
5152
| IBanner
53+
| IPushNotificationConfig
5254
),
5355
CallHistoryItem,
5456
ICustomUserStatus,

0 commit comments

Comments
 (0)