diff --git a/package.json b/package.json index 9665c69..1be8986 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "tiny-crud", - "version": "1.1.1", + "version": "1.1.2", "description": "Lightweight Data Repository Based on Git Issue API", "main": "dist/bundle.cjs.js", "module": "dist/bundle.esm.js", diff --git a/src/repository-lib/base/base-repository.ts b/src/repository-lib/base/base-repository.ts index 9d4b59f..f48b444 100644 --- a/src/repository-lib/base/base-repository.ts +++ b/src/repository-lib/base/base-repository.ts @@ -56,11 +56,6 @@ export abstract class BaseRepository { protected cleanParams(params?: BaseParams): BaseParams | undefined { if (params == null) return; const copyParams = JSON.parse(JSON.stringify(params)); - for (const key in copyParams) { - if (copyParams[key] == null) { - delete copyParams[key]; - } - } return Object.keys(copyParams).length > 0 ? copyParams : undefined; } @@ -71,7 +66,7 @@ export abstract class BaseRepository { */ async find(params?: BaseParams): Promise { const url = this.getRoute(RouteType.find); - const response = await this.request.get(url, params); + const response = await this.request.get(url, this.cleanParams(params)); return response.map((item) => this.deserialize(item)); } diff --git a/src/repository-lib/gitee/gitee-repository.ts b/src/repository-lib/gitee/gitee-repository.ts index 83c78bd..2cacbd8 100644 --- a/src/repository-lib/gitee/gitee-repository.ts +++ b/src/repository-lib/gitee/gitee-repository.ts @@ -25,7 +25,7 @@ export class GiteeRepository extends BaseRepository { * @returns A promise that resolves to an array of items. */ async find(params?: GiteeParams): Promise { - return super.find(this.cleanParams(params)); + return super.find(params); } /** diff --git a/src/repository-lib/github/github-repository.ts b/src/repository-lib/github/github-repository.ts index 7a8078d..246eb93 100644 --- a/src/repository-lib/github/github-repository.ts +++ b/src/repository-lib/github/github-repository.ts @@ -24,7 +24,7 @@ export class GithubRepository extends BaseRepository { * @returns A promise that resolves to an array of items. */ async find(params?: GithubParams): Promise { - return super.find(this.cleanParams(params)); + return super.find(params); } /** diff --git a/src/repository-lib/gitlab/gitlab-repository.ts b/src/repository-lib/gitlab/gitlab-repository.ts index 805392c..db36294 100644 --- a/src/repository-lib/gitlab/gitlab-repository.ts +++ b/src/repository-lib/gitlab/gitlab-repository.ts @@ -41,8 +41,8 @@ export class GitlabRepository extends BaseRepository { */ async find(params?: GitlabParams): Promise { const url = this.getRoute(RouteType.find); - const response = await this.request.get(url, this.cleanParams(params)); - return response.filter(item => item['system'] === false).map((item) => this.deserialize(item)); + const response = await this.request.get(url, super.cleanParams(params)); + return response.filter(item => item['system'] === false).map((item) => super.deserialize(item)); } /** @@ -54,9 +54,9 @@ export class GitlabRepository extends BaseRepository { */ async updateById(id: number, data: PlainObject): Promise { const url = this.getRoute(RouteType.updateById, id); - const body = this.serialize>(data); + const body = super.serialize>(data); const response = await this.request.put(url, body); - return this.deserialize(response); + return super.deserialize(response); } /**