-
Notifications
You must be signed in to change notification settings - Fork 10.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Chore: convert import.js endpoints to TS (#25956)
<!-- This is a pull request template, you do not need to uncomment or remove the comments, they won't show up in the PR text. --> <!-- Your Pull Request name should start with one of the following tags [NEW] For new features [IMPROVE] For an improvement (performance or little improvements) in existing features [FIX] For bug fixes that affect the end-user [BREAK] For pull requests including breaking changes Chore: For small tasks Doc: For documentation --> <!-- Checklist!!! If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code. - I have read the Contributing Guide - https://github.com/RocketChat/Rocket.Chat/blob/develop/.github/CONTRIBUTING.md#contributing-to-rocketchat doc - I have signed the CLA - https://cla-assistant.io/RocketChat/Rocket.Chat - Lint and unit tests pass locally with my changes - I have added tests that prove my fix is effective or that my feature works (if applicable) - I have added necessary documentation (if applicable) - Any dependent changes have been merged and published in downstream modules --> ## Proposed changes (including videos or screenshots) <!-- CHANGELOG --> <!-- Describe the big picture of your changes here to communicate to the maintainers why we should accept this pull request. If it fixes a bug or resolves a feature request, be sure to link to that issue below. This description will appear in the release notes if we accept the contribution. --> Converted the `apps/meteor/app/api/server/v1/import.js` to ts and created endpoint typings on the `packages/rest-typings/src/v1/import` folder. <!-- END CHANGELOG --> ## Issue(s) <!-- Link the issues being closed by or related to this PR. For example, you can use #594 if this PR closes issue number 594 --> ## Steps to test or reproduce <!-- Mention how you would reproduce the bug if not mentioned on the issue page already. Also mention which screens are going to have the changes if applicable --> ## Further comments <!-- If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc... -->
- Loading branch information
1 parent
d408c31
commit 70f5fbe
Showing
12 changed files
with
289 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
packages/rest-typings/src/v1/import/DownloadPendingAvatarsParamsPOST.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import Ajv from 'ajv'; | ||
|
||
const ajv = new Ajv({ | ||
coerceTypes: true, | ||
}); | ||
|
||
export type DownloadPendingAvatarsParamsPOST = { | ||
userId: string; | ||
count: number; | ||
}; | ||
|
||
const DownloadPendingAvatarsParamsPOSTSchema = { | ||
type: 'object', | ||
properties: { | ||
userId: { | ||
type: 'string', | ||
}, | ||
count: { | ||
type: 'number', | ||
}, | ||
}, | ||
additionalProperties: false, | ||
required: ['userId', 'count'], | ||
}; | ||
|
||
export const isDownloadPendingAvatarsParamsPOST = ajv.compile<DownloadPendingAvatarsParamsPOST>(DownloadPendingAvatarsParamsPOSTSchema); |
26 changes: 26 additions & 0 deletions
26
packages/rest-typings/src/v1/import/DownloadPendingFilesParamsPOST.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import Ajv from 'ajv'; | ||
|
||
const ajv = new Ajv({ | ||
coerceTypes: true, | ||
}); | ||
|
||
export type DownloadPendingFilesParamsPOST = { | ||
userId: string; | ||
count: number; | ||
}; | ||
|
||
const DownloadPendingFilesParamsPOSTSchema = { | ||
type: 'object', | ||
properties: { | ||
userId: { | ||
type: 'string', | ||
}, | ||
count: { | ||
type: 'number', | ||
}, | ||
}, | ||
additionalProperties: false, | ||
required: ['userId', 'count'], | ||
}; | ||
|
||
export const isDownloadPendingFilesParamsPOST = ajv.compile<DownloadPendingFilesParamsPOST>(DownloadPendingFilesParamsPOSTSchema); |
28 changes: 28 additions & 0 deletions
28
packages/rest-typings/src/v1/import/DownloadPublicImportFileParamsPOST.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import Ajv from 'ajv'; | ||
|
||
const ajv = new Ajv({ | ||
coerceTypes: true, | ||
}); | ||
|
||
export type DownloadPublicImportFileParamsPOST = { | ||
fileUrl: string; | ||
importerKey: string; | ||
}; | ||
|
||
const DownloadPublicImportFileParamsPostSchema = { | ||
type: 'object', | ||
properties: { | ||
fileUrl: { | ||
type: 'string', | ||
}, | ||
importerKey: { | ||
type: 'string', | ||
}, | ||
}, | ||
additionalProperties: false, | ||
required: ['fileUrl', 'importerKey'], | ||
}; | ||
|
||
export const isDownloadPublicImportFileParamsPOST = ajv.compile<DownloadPublicImportFileParamsPOST>( | ||
DownloadPublicImportFileParamsPostSchema, | ||
); |
28 changes: 28 additions & 0 deletions
28
packages/rest-typings/src/v1/import/GetCurrentImportOperationParamsGET.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import Ajv from 'ajv'; | ||
|
||
const ajv = new Ajv({ | ||
coerceTypes: true, | ||
}); | ||
|
||
export type GetCurrentImportOperationParamsGET = { | ||
userId: string; | ||
operation: string; | ||
}; | ||
|
||
const GetCurrentImportOperationParamsGETSchema = { | ||
type: 'object', | ||
properties: { | ||
userId: { | ||
type: 'string', | ||
}, | ||
operation: { | ||
type: 'string', | ||
}, | ||
}, | ||
additionalProperties: false, | ||
required: ['userId', 'operation'], | ||
}; | ||
|
||
export const isGetCurrentImportOperationParamsGET = ajv.compile<GetCurrentImportOperationParamsGET>( | ||
GetCurrentImportOperationParamsGETSchema, | ||
); |
22 changes: 22 additions & 0 deletions
22
packages/rest-typings/src/v1/import/GetImportFileDataParamsGET.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import Ajv from 'ajv'; | ||
|
||
const ajv = new Ajv({ | ||
coerceTypes: true, | ||
}); | ||
|
||
export type GetImportFileDataParamsGET = { | ||
userId: string; | ||
}; | ||
|
||
const GetImportFileDataParamsGETSchema = { | ||
type: 'object', | ||
properties: { | ||
userId: { | ||
type: 'string', | ||
}, | ||
}, | ||
additionalProperties: false, | ||
required: ['userId'], | ||
}; | ||
|
||
export const isGetImportFileDataParamsGET = ajv.compile<GetImportFileDataParamsGET>(GetImportFileDataParamsGETSchema); |
22 changes: 22 additions & 0 deletions
22
packages/rest-typings/src/v1/import/GetImportProgressParamsGET.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import Ajv from 'ajv'; | ||
|
||
const ajv = new Ajv({ | ||
coerceTypes: true, | ||
}); | ||
|
||
export type GetImportProgressParamsGET = { | ||
userId: string; | ||
}; | ||
|
||
const GetImportProgressParamsGETSchema = { | ||
type: 'object', | ||
properties: { | ||
userId: { | ||
type: 'string', | ||
}, | ||
}, | ||
additionalProperties: false, | ||
required: ['userId'], | ||
}; | ||
|
||
export const isGetImportProgressParamsGET = ajv.compile<GetImportProgressParamsGET>(GetImportProgressParamsGETSchema); |
24 changes: 24 additions & 0 deletions
24
packages/rest-typings/src/v1/import/GetLatestImportOperationsParamsGET.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import Ajv from 'ajv'; | ||
|
||
const ajv = new Ajv({ | ||
coerceTypes: true, | ||
}); | ||
|
||
export type GetLatestImportOperationsParamsGET = { | ||
userId: string; | ||
}; | ||
|
||
const GetLatestImportOperationsParamsGETSchema = { | ||
type: 'object', | ||
properties: { | ||
userId: { | ||
type: 'string', | ||
}, | ||
}, | ||
additionalProperties: false, | ||
required: ['userId'], | ||
}; | ||
|
||
export const isGetLatestImportOperationsParamsGET = ajv.compile<GetLatestImportOperationsParamsGET>( | ||
GetLatestImportOperationsParamsGETSchema, | ||
); |
22 changes: 22 additions & 0 deletions
22
packages/rest-typings/src/v1/import/StartImportParamsPOST.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import Ajv, { JSONSchemaType } from 'ajv'; | ||
|
||
const ajv = new Ajv({ | ||
coerceTypes: true, | ||
}); | ||
|
||
export type StartImportParamsPOST = { | ||
input: string; | ||
}; | ||
|
||
const StartImportParamsPostSchema: JSONSchemaType<StartImportParamsPOST> = { | ||
type: 'object', | ||
properties: { | ||
input: { | ||
type: 'string', | ||
}, | ||
}, | ||
additionalProperties: false, | ||
required: ['input'], | ||
}; | ||
|
||
export const isStartImportParamsPOST = ajv.compile<StartImportParamsPOST>(StartImportParamsPostSchema); |
34 changes: 34 additions & 0 deletions
34
packages/rest-typings/src/v1/import/UploadImportFileParamsPOST.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import Ajv from 'ajv'; | ||
|
||
const ajv = new Ajv({ | ||
coerceTypes: true, | ||
}); | ||
|
||
export type UploadImportFileParamsPOST = { | ||
binaryContent: string; | ||
contentType: string; | ||
fileName: string; | ||
importerKey: string; | ||
}; | ||
|
||
const UploadImportFileParamsPostSchema = { | ||
type: 'object', | ||
properties: { | ||
binaryContent: { | ||
type: 'string', | ||
}, | ||
contentType: { | ||
type: 'string', | ||
}, | ||
fileName: { | ||
type: 'string', | ||
}, | ||
importerKey: { | ||
type: 'string', | ||
}, | ||
}, | ||
additionalProperties: false, | ||
required: ['binaryContent', 'contentType', 'fileName', 'importerKey'], | ||
}; | ||
|
||
export const isUploadImportFileParamsPOST = ajv.compile<UploadImportFileParamsPOST>(UploadImportFileParamsPostSchema); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters